OPENPLC TUTORIAL

OpenPLC on a Raspberry Pi or Arduino: Build a Real PLC on a Hobby Board (Video)

Eric Romine's lesson on programming an Arduino with OpenPLC, with a written companion: the free toolchain, the board options and their list prices, and a start/stop to flash.

By EDWartens engineering team 26 September 2026 6 min
OpenPLC on a Raspberry Pi or Arduino: Build a Real PLC on a Hobby Board (Video)

This OpenPLC tutorial shows how to turn an Arduino or a Raspberry Pi into a working PLC with open-source software. Write ladder logic in the OpenPLC Editor, test it on the built-in simulator, then send it to a board. On the makers' own stores, an Arduino UNO Rev3 lists at €29.30 and a Raspberry Pi 4 starts from US$35.

“Basics 03: Programming an Arduino Board with OpenPLC” by Eric Romine, 17 min. Played from the creator's own YouTube channel; the video belongs to them.

In this lesson by Eric Romine, part three of his OpenPLC basics series, you see an Arduino board programmed with OpenPLC. It sits in the hardware module of our free OpenPLC course. Watch it through once. Then follow along, and check your work against the steps below.

Why build a PLC on a hobby board

A simulator teaches the logic. A board teaches the rest: that inputs are real wires, that a button bounces, that an output needs something to drive. OpenPLC lets you feel that without buying an industrial controller. The same IEC 61131-3 ideas you use here (ladder, function blocks, timers, counters) are the ones in CODESYS, TwinCAT and the big vendor tools.

Be clear about the limits. An Arduino works at 5 V logic and a Raspberry Pi's GPIO at 3.3 V; neither has the isolated 24 V I/O, certifications or ruggedness of an industrial PLC. Use them to learn and for home projects, never for a machine where a fault could hurt someone.

What OpenPLC is

OpenPLC's maintainers describe it as open-source industrial automation software, free to use, modify and distribute, with support for ladder logic, structured text, function block diagram and instruction list. It has two parts:

  • OpenPLC Editor, a desktop application for Windows, macOS and Linux, published under GPL-3.0. Its board list includes Arduino boards (Uno, Mega, Nano, Due and others), ESP32 and Raspberry Pi, plus an OpenPLC Simulator target that emulates a board, so you can test with nothing plugged in.
  • OpenPLC Runtime v4, published under the MIT licence, which runs programs on Linux computers such as a Raspberry Pi. It has prebuilt binaries for amd64, arm64 and armv7, installs with a script, and is controlled from the Editor.

Choose a target

Where an OpenPLC program can run (prices checked 26 Sept 2026)
Where an OpenPLC program can run (prices checked 26 Sept 2026)

Board prices are list prices on each maker's own store on 26 September 2026: €29.30 for the Arduino UNO Rev3 on the Arduino store (including VAT) and "from $35" for the Raspberry Pi 4 on raspberrypi.com. You will also need a USB cable, a push button, an LED and resistors for the Arduino, or a power supply and microSD card for the Pi. Prices for those, and for ESP32 boards, vary too much by country and seller to quote.

Our advice: start on the simulator, move to an Arduino for your first real button and LED, and use a Raspberry Pi when you want Modbus, an HMI or a program too big for a microcontroller.

Step by step: a start/stop on an Arduino

From ladder to a blinking LED, in order
From ladder to a blinking LED, in order

1. Install the Editor. Download the OpenPLC Editor for your operating system from the project's official pages.

2. Create a project. Start a new project and add a program in ladder diagram.

3. Write the rung. Declare three BOOL variables: START_PB, STOP_PB and LAMP. Build the classic seal-in: START_PB in parallel with a contact of LAMP, in series with STOP_PB, driving a LAMP coil.

4. Simulate first. Select the OpenPLC Simulator target and run the program. Force START_PB on and off, and confirm LAMP latches and STOP_PB releases it. Fixing logic here is far quicker than on a board.

5. Choose the board. Switch the target to your Arduino model.

6. Map the I/O. Assign START_PB and STOP_PB to digital inputs and LAMP to a digital output, using the Editor's pin table for your board. OpenPLC uses IEC located addresses, such as %IX0.0 for a digital input and %QX0.0 for a digital output, and the Editor shows which physical pin each one is.

7. Wire it. Connect a push button to each input, with the pull-up or pull-down resistor your board's input needs, and an LED with a series resistor on the output. Keep the board unpowered while you wire.

8. Upload and test. Connect the board by USB, upload from the Editor, and press the buttons. The LED should latch on with START and go out with STOP, exactly as it did in the simulator.

Moving to a Raspberry Pi

On a Pi, the program does not run as Arduino firmware. It runs on OpenPLC Runtime v4, a service on the Pi's Linux. The runtime's documentation says you install it with a script, then connect to it from the OpenPLC Editor by entering the Pi's IP address and credentials. Unlike version 3, Runtime v4 has no web page on port 8443, so older tutorials that open a browser there will not match. Once it is running, the Pi can act as a Modbus server for an HMI, which is where the course's communication module picks up.

Common problems

  • The LED stays on with nothing pressed. The input is floating. Add the pull-down (or pull-up) resistor, and check which state your logic expects.
  • It worked in the simulator but not on the board. Check the pin mapping. A variable on the wrong address is the usual cause.
  • The Editor looks different from the video. You may be on Editor v4. The ladder logic is the same; menus and the upload steps differ.

Continue with the free OpenPLC course

The OpenPLC course is free in full: installing the Editor and Runtime, contacts and coils, set/reset and edges, timers, counters, arithmetic, two sets of worked examples, Arduino, ESP32 and Raspberry Pi hardware, Modbus, MQTT and HMIs, and Factory I/O projects with SFC. Video lessons are by independent YouTube creators, including Eric Romine, credited on the course page. EDWartens writes the notes, practice tasks and the final assessment: 15 questions, 60% to pass. When you want the same ideas in a professional tool, follow the IEC 61131 and software PLCs path, starting with CODESYS.

The only paid item is an optional EDWartens Certificate of Completion after you pass. For this beginner course it costs from US$2.99, and checkout shows your price. Anyone can check it at edwartens.com/verification. It is not accredited, and not a university or vendor qualification.

Take the free course

Questions

Is OpenPLC free?

Yes. OpenPLC is open source: the Editor is published under GPL-3.0 and Runtime v4 under the MIT licence. Its maintainers describe it as free to use, modify and distribute.

Can a Raspberry Pi be a PLC?

For learning and small projects, yes. OpenPLC Runtime v4 has prebuilt binaries for 64-bit and 32-bit ARM and installs with a script, and the Editor uploads programs to it. It is not a certified industrial controller, so do not use it on anything safety-related.

Which Arduino boards work with OpenPLC?

The OpenPLC Editor's board list includes the Arduino Uno, Mega, Nano and Due among others, plus ESP32 boards and a built-in simulator. Check the board list in your version of the Editor before you buy.

Can I use OpenPLC without any hardware?

Yes. The Editor includes an OpenPLC Simulator target that emulates a board, so you can write and test ladder logic before you own anything.

Why does my Editor look different from the video?

OpenPLC Editor v4 is a newer desktop application, and Runtime v4 no longer has the web page on port 8443 that v3 had. The ladder logic is the same; the menus and connection steps differ.

Sources

Written by the EDWartens engineering team for general education. Product names are trademarks of their owners; mentioning them does not imply endorsement. Prices and terms of other providers were checked on the date shown and can change.