PLC programming and Raspberry PI

Through failing with plc programming and raspberry pi what we learnt?

So you have just gotten hold of a new raspberry pi three and think you are about to conquer the world. Let us share our experiences with you in integrating this wonderful board with the lovely world of plc programming. First thing to note is if you are going with serial connectivity and don’t want to run up the walls. You must beware of turning on the serial enabled function on your raspberry pi. What this in actual fact does is allows raspbian to log it’s internal logging to your serial ports. If you want a world of hate for yourself and your new un boxed baby do not turn this on.

Generally you would want to use a well known and generally used protocol such as modbus. To talk to your automation devices however with the feature of raspbian enabled this will ruin all possibility of you communicating with your pi to your plc or HMI devices. Best to turn this bad boy off and enable uart in your boot config. For those who don’t know this is found in /boot/config.txt. You will see something called enable_uart=0 change that to a 1 and reboot. If you have done this correctly you should have the ports /dev/ttyS0 available on booting up.

What else can go wrong?

If you have not updated your pi’s firmware yet this is a must and your serial ports will throw you gibberish if you use screen /dev/ttyS0 115200. Update your firmware with one simply command sudo rpi-update.  If you have done all this and now your screen session works. You should have no trouble communicating with your plc devices. Now you can chill on the beach and enjoy your cocktail because your time has finally arrived. You can now control your plcs from your raspberry pi using pymodbus or whatever flavour of modbus library you prefer. Do not fall into this trap. Learn from this.

If you have more queries please visit our plc programming partner’s website : plc programming

Leave a Reply

Your email address will not be published. Required fields are marked *