Search code examples
javaplc

How to connect java with plc data


I have a new project about plc (siemens), but I dont know how they work. What I have to do, is by given some data from the plc I have to handle the data and to display it on a simple GUI. The PLC (I dont know if there are different types) that I have to use is a "proximity sensor" which only capture if something is infront of it, then it hasto send some data to my program in Java and then I have to display it on the GUI (Basically some red or green circles) I dont have to handle the behavior of the PLC, I just have to do display a red or green circle by given the data from the PLC

Questions:

I thought of Java because I know that is a powerful language, but is it the best for what I have to do?

Second if Java is the best choice, are there any librarys for working with PLC?

Third... I started to read something about some languages like:

  • Functional Block Diagram (FBD)

What are they for?


Solution

  • "The PLC(...) that I have to use is a "proximity sensor" which only capture something in front of it."

    Do you mean to state here that you are connecting a proximity sensor to a PLC, reading the data from the PLC and back to your UI program OR do you want to read the proximity sensor directly back to your UI program? If it’s the latter connect your sensor to a microcontroller and then send the data serially to your computer.

    If you are using a PLC you will need some interface card (i.e. digital or analogue). Connect your sensor to the applicable card. If you want to read an S7 PLC you will need a library - libnodave is a good one. If you are using a library like libnodave you will need to use ones of its supported languages - it includes Java but you can also use others e.g. C. You could also use Snap7.

    FBD is one of the IEC61131-3 programming languages - see: http://www.automation.com/pdf_articles/IEC_Programming_Thayer_L.pdf