Page 16 - HTN_JanFeb23
P. 16

Number 1 in a Series
Written by: Dr. Don Wilcher, CETa, EE, MSEIT
OpenPLC is an open-source industrial control platform that allows the transformation of popular microcontrollers into a programmable logic controller (PLC). OpenPLC is a fully functional open-source PLC based on the International Electrotechnical Commission’s (IEC) standard 61131-3 on Functional Programming Languages. There are five functional programming languages associated with IEC 61131-3 standard; they are: Structured Text (ST), Instruction List (IL), Ladder Diagram (LD), Sequence Function Chart (SFC), and the Functional Block Diagram (FBD). The most common programming language used with the PLC, is LD. The IEC 61131-3 standard considers software and hardware requirements to develop effective low-cost automation control systems. Therefore, the IEC 6113-3 standard defines the basic software architecture and programming languages for PLCs.
Versions of OpenPLC
The technical development path of the OpenPLC platform consisted of two basic versions of the open-source programming language toolchain, version 1.0 and version 1.2b. Version 1.0 provides a simulator for testing LD programs. The software version can run ST code on a target Microchip ATMEGA328 8bit microcontroller. Version 1.0 provides a runtime feature that allows installing C-code on the ATMEGA328 microcontroller. The runtime feature provides a dashboard to display the Microchip-based PLC input/output devices running on the ATMEGA328 microcontroller. Figure 1 shows a typical runtime dashboard executing a Hello World LD program.
Figure 1. OpenPLC Hello World runtime dashboard
Getting Hands-On with OpenPLC
With an understanding of the OpenPLC open-source platform, you are now ready to build an Arduino Uno or compatible PLC. The first step to building an open-source PLC is downloading the development tool. You can download the OpenPLC software from the following website address: download/.
Figure 3. OpenPLC website
   Version 1.2b provides a simulator for testing LD programs. Like version 1.0, a generated ST code is converted into a binary file that is uploaded to the ATMEGA328 microcontroller. Further, version 1.2b can program various Arduino platforms and popular microcontrollers like the ESP32 and the ESP8266 programmable devices. Figure 2 illustrates the Hello World simulator LD program environment.
Figure 2. The Hello World simulator LD program environment
You will select the software for your PLC development machine’s operating systems. With the OpenPLC software downloaded from the website, you will install the programming tool onto your PLC development machine. With the latest version of OpenPLC, installation is a matter of clicking an executable file with your mouse. Congratulations on installing OpenPLC! You are ready to build your first OpenPLC project, Hello World.
First OpenPLC project: Hello World
You will wire an Arduino Uno or compatible using a few discrete electronic components on a solderless breadboard. The Hello World PLC project lights up an LED when pressing a tactile pushbutton switch. You will wire your Arduino Uno or compatible PLC using the electronic circuit schematic diagram shown in Figure 4.
Figure 4. The Arduino Uno PLC electronic circuit schematic diagram.
 As an additional reference, here is the author’s solderless breadboard PLC shown in Figure 5.

   14   15   16   17   18