What Is OpenPLC?

This project for building an Arduino Uno or compatible PLC illustrates OpenPLC’s effective and low-cost tools for automation development.

Dr. Don Wilcher

April 26, 2024

10 Min Read
A functional output LED indicator. DON WILCHER

At a Glance

  • OpenPLC is a fully functional open-source PLC based on IEC standard 61131-3.
  • It can support Arduino, ESP32, ESP8266, and Raspberry Pi platforms.
  • Get an appreciation for OpenPLC’s utility by building an Hello World PLC.

OpenPLC is an open-source industrial controls 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: 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 several iterative versions of the open-source programming language toolchain. Today’s version 3 provides support for a variety of Arduino, ESP32, ESP8266, and Raspberry Pi platforms. The software version 3 can run ST code on a target Microchip ATMEGA328 8-bit microcontroller. A runtime feature allows installing C-code on the Raspberry Pi. The runtime feature provides a dashboard to display the Raspberry Pi-based PLC input/output devices running on the Broadcom BCM 2711 (version 4B) and BCM 2937 (version 3B) microcontrollers. Figure 1 shows a typical runtime dashboard executing a Hello World LD program.

Related:AI Allows Modeling PLC Programs at the Component Level


Figure 2 illustrates the Hello World simulator LD program environment.


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 this website

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 system 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 3. 

Related:Meet the Arduino Uno R4 Minima and WiFi, Part 1


As an additional reference, here is the author’s solderless breadboard PLC shown in Figure 4.


The tactile pushbutton switch PB1 and PB2 are wired as digital logic switches. When pressing PB1 or PB2, approximately +5 VDC  is applied to pins 3 and 2, respectively. To illustrate the method of testing the wired digital switches, Figure 5 is presented. You will notice in the Tinkercad circuit model the digital voltmeter is attached across resistor R1. One end of the USB cable is inserted into the Arduino Uno. The other end of the cable is inserted into your PLC development machine’s USB port. A power-on LED will be visible on the Arduino Uno printed circuit board (PCB); this indicator signifies the ATMEGA328 microcontroller and the supporting electronic circuits on the printed circuit board (PCB) are active or powered.


You will place your digital voltmeter across R1 of the actual PLC prototype shown in Figure 4 and press the PB1 tactile switch. An approximate reading of +5 V should be displayed on the electrical measurement instrument’s LCD. If the voltage reading is not approximately +5 V, check your wiring and repeat the measurement. You will perform the same test measurement on the PB2 tactile switch. Press the PB2 tactile switch to read approximately +5 V on the digital voltmeter. Congratulations, you have functional digital logic switches for your Arduino PLC. You will now wire and test the output LED indicator on a solderless breadboard. Figure 6 shows the Tinkercad circuits model of the wired and powered output LED indicator on the solderless breadboard. You will use this circuit model as a reference when testing the output LED indicator on the actual solderless breadboard prototype.

Related:Arduino’s Latest Board Targets Cloud Applications


If your output LED indicator is turn on, job well done! Your output LED indicator is working properly. Remove the USB cable from your PLC development machine’s USB port. Replace the red wire attached to the 560-ohm (Ω) resistor with a long jumper wire. You will take the end of the jumper wire attached to the 560-Ω resistor and insert it into cavity 7 (D7) of the female header connector mounted to the Arduino Uno’s PCB. Congratulations, you have wired and tested digital logic switches and an output LED indicator of your prototype Arduino Uno PLC. The final stage of the PLC project is to build and upload the OpenPLC Hello World LD program to the Arduino Uno PLC. Before proceeding to the final step of the OpenPLC project, insert the USB cable into your PLC development machine’s USB port.

Building a Basic LD Program in OpenPLC

You will create a project directory folder on your PLC development machine. Next, create a project folder in which the OpenPLC-generated files are stored with the LD program. You will name the project folder, "HelloWorld." With the project folder created, open the OpenPLC software by clicking its icon with your mouse. The OpenPLC will direct you to your project directory folder. With the mouse, select the HelloWorld project folder. Once the HelloWorld project folder has been selected, the OpenPLC editor will appear on the screen.


You will create the Hello World LD program by selecting File>New with your mouse. A small box will appear on the PLC development screen. Fill in the textbox labeled POU Name with HelloWorld as shown in Figure 8. For the Language dropdown list, select LD with the mouse. Click the OK button to finalize creating a new LD program.


With the project box completed, you are ready to create I/O tags. For Hello World LD, there are two tags: HelloWorld_PB and HelloWorld_LED.  Click the plus sign with your mouse to create the two I/O tags. Your I/O tags listing should look like Figure 9.


You will notice the columns’ Type and Location in the I/O tags listing. Click in the HelloWorld_PB’s Type cell and select BOOL. Repeat the selection process for HelloWorld_LED.  With the tactile pushbutton switch providing digital information (ON/OFF) and the output LED indicator being commanded to turn ON and OFF, the data type is Boolean, thus the selection of BOOL. The location column is the PLC address for the specified I/O pins of the Arduino Uno ATMEGA328 microcontroller. Type the addresses as shown in Figure 10. With the I/O tags listing completed, you will create an LD program. The two primary PLC bit instructions you will use for the Hello World project are the Examine If Closed (XIC) and Output Energized (OTE). The location of these bit instructions is in the programming toolbar. 


You will build the Hello World LD program by selecting the XIC and OTE bit instructions and placing them in the LD program build section of the OpenPLC editor. The tags you created will be associated by selecting the correct bit instructions. Alternatively, OpenPLC uses a contact for XIC and a coil for OTE bit instructions.  Figure 11 shows the tags associated with the correct bit instructions.


You will connect the XIC and OTE bit instructions to the left and right power rails. With the mouse, select the power rail and configure the number of pins. The pins are the rungs for the LD program. Figure 12 illustrates the selection and configuration process of the power rails.


The final step of building the LD program is connecting the XIC and OTE bit instructions. With the mouse, click the right end of the HelloWorld_PB XIC bit and drag it to create a line. Continue dragging the line to connect to the left side of the HelloWorld_LED OTE bit. This line creates a rung to manage the XIC and OTE bit instructions control logic operation. The completed LD program is shown in Figure 13.


Super job building the Hello World LD program! You will simulate the LD program to test the logic. Click the sunglasses next to the Config0.Res.instance0 dropdown box. After clicking the sunglasses, you will see the left rung attached to the HelloWorld_PB XIC bit instruction turn green. Green means the LD program is ready to be simulated. Figure 15 shows the LD program is ready to be simulated. Select the running man at the taskbar to run the LD program. The PLC Started text will be displayed in the PLC log section of the editor.



To interact with the simulation, right-click with your mouse and select Force True from the presented selection list. The Hello World_LED OTE bit should turn green. Right-click with your mouse and select Force True from the selection list. You will notice the Hello World_LED OTE turning OFF or displayed as black. Congratulations, you have run a simulation event for the Hello World LD program. The final step of the project is to upload the LD program to the Arduino Uno PLC.

Uploading and Testing the Hello World LD program on the Arduino Uno PLC


You may find the correct COM port using your PLC development machine’s Device Manager. With the Arduino Uno board and the COM port selected, click the Upload button. After the runtime tool has converted the ST program to C-code then to a binary file and uploaded it to the Arduino Uno, a Done message will be displayed in the compilation output window. Figure 16 illustrates the uploaded Hello World LD program to the Arduino Uno PLC. Press the PB1 tactile switch on the solderless breadboard prototype, and the LED shall turn on. Releasing the tactile pushbutton switch will turn off the LED. 

About the Author(s)

Dr. Don Wilcher

Dr. Don Wilcher, an Electrical Engineer, is an Associate Certified Electronics Technician (CETa), a Technical Education Researcher, Instructor, Maker, Emerging Technology Lecturer, Electronics Project writer, and Book Author. His Learn Electronics with Arduino book, published by Apress, has been cited 80 times in academic journals and referenced on patents. 

He is the Director of Manufacturing and Technology at Jefferson State Community College. His research interest is Embedded Controls, Robotics Education, Machine Learning, and Artificial Intelligence applications and their impact on Personalized Learning, Competency-Based Models curriculum, and instructional development in Mechatronics, Automation, IoT, Electronics, Robotics, and Industrial Maintenance Technologies. He is also the Founder and owner of MaDon Research LLC, an instructional technology consulting, technical training, and electronics project writing company serving Electronics Marketing Media, Technical and Engineering Education companies.

Sign up for the Design News Daily newsletter.

You May Also Like