How to Use your Raspberry Pi as a PLC
PLC programming is very common in industry and home automation. The new Elektor book PLC Programming with the Raspberry Pi and the OpenPLC Project describes how to turn your Raspbery Pi 4 into a industrial Programmable Logic Controller.
PLC with a Raspberry Pi
After software installation on the Raspberry Pi and the PC, the book gives a description of the hardware. It then goes on with examples in the different programming languages complying with the IEC 61131-3 standard. This book also explains in detail how to use the PLC editor and how to load and execute the programs on the Raspberry Pi. All IEC languages are explained with examples, from Ladder Diagrams (LD) and Structured Control Language (ST) to Special Function Charts (SFC).
Networking gets thorough attention too with Arduino- and ESP8266-based ModbusRTU and ModbusTCP modules. I/O circuits complying with the 24 V industry standard may also be of interest for the reader.
In the following video, Asma takes you through the book. As she explains, you will learn how to start programming with the PLC Editor. "You will create your programs in various programming languages, translate and upload them to the Raspberry Pi for testing," she notes.
Networking gets some attention as well. An Arduino Uno and the ESP8266 are programmed, as ModbusRTU or ModbusTCP modules, to enable access to external peripherals, reading sensors and switching electrical loads. The detailed book wraps up with details about commands for ST and LD.