OpenPLC - a fully open source controller


Thread Starter


Dear friends,

I'm a Ph.D. student at the University of Alabama in Huntsville, and my research topic is SCADA cyber security. My goal is to find vulnerabilities in PLCs and try to fix them. However, its really hard to study something deep when you don't have the source code. Therefore, due to the lack of open source tools available in this field, I decided to create my own open source PLC. Then I realized that this could be useful for other researchers and professionals in the field, so I'm here sharing it with everyone.

The OpenPLC is a complete package with an editor and a compiler. The editor runs in Windows, Linux and MacOS and supports all the 5 IEC 61131-3 languages: ST, IL, LADDER, FBD and SFC. The compiler is responsible for getting the program written by the user and compile it to the platform in which the OpenPLC is running.

The OpenPLC currently runs on Raspberry Pi, Arduino, UniPi and also as a soft-PLC on Windows or Linux. If you guys have any of the mentioned boards laying down somewhere, it might be interesting to give the OpenPLC a try. More information can be found in my website:

Let me know if you have any comments.

Thiago Alves


> Is it hard realtime, deterministic? What kind of scan times can you
> get with a raspberry pi?

Currently it is soft realtime because it runs on top of Linux. I'm making experiments with the RT patch for the Linux kernel to see if I can improve anything. My plans are to actually modify the kernel to achieve better results.

The default scan time for the OpenPLC is 50ms. I defined a large number just because it was made to run in all sort of devices, even a simple arduino. But I'm also planning to reduce the scan time to something close to 10ms. RaspberryPi can easily deal with 10ms with no problems.

James Ingraham

"...I decided to create my own open source PLC."

Wow. That sounds like an enormous amount of work. I hope to be able to check it out.

-James Ingraham
Sage Automation, Inc.



I have never heard about this Puffin PLC project. This news seems to be 16 years old! At least now I know that the idea of creating an open source PLC is not new :)

But I think that at some point I got benefited from it. When I started reading about the Puffin PLC project I saw this: It seems that this project later evolved to be the MATiec compiler. OpenPLC code is heavily dependent on that. So that's how the open source community works, one building on top of another's work. That's what I love about it!

Curt Wuollet

The extremely powerful, cheap, SBCs make things a lot easier. And for the record, I am still crafting custom automation projects with non-automation gear where appropriate. PLCs are still extremely poor at integration with the rest of the computing world. They have many ways to communicate, unfortunately nearly all are unreasonably difficult or expensive to integrate with enterprise (and other) systems. It's far easier (and _much_ less expensive) for me to run TCP/IP messaging and services on a Raspberry pi and manage a few I/O than it is to get a PLC to do any flexible integration with the rest of the world. And the gadget count goes way down and more of it is OTS. Of course, I could be wrong, and this whole connectivity thing and the IoT could be a fad and Profibus and Data Highway, etc. could become ubiquitous instead. But, I doubt it. With a big toolbox, doing things the hard, expensive way makes a lot less sense.

I'll still implement with a PLC where that makes sense, but if I need a display, Ethernet, serial comms, and a few IO, todays SBCs do that better, cheaper, and faster. And you don't have to choose only two of those.

There is a well supported project called Linux CNC - nice mailing list etc. (sometimes the mailing list is better than paid company support.)

While capable of doing advanced motion control, it also supports PLC functions. Lots of people run it on things like Beagle-bone etc.

Open hardware is the future of automation control. Someday soon vendor lock-in will be a thing of the past. (Already in the third-world there are lots of machine shops running LinuxCNC (cost is more important) - I saw a aircraft parts shop in Wichita with all their mills retrofitted with LinuxCNC - they are making serious money).
Dear Thiago,

the job You are doing is very important. After banks recognized smartphones as payment tools the demand for good and cheap PLC increased. The home automation is the new developing market for them.

The idea of free PLC is not new. But, because the lack of investment it was not implemented properly. On the (website for Eagle PCB design software)it is possible to download free PLC project (microsps

The Arduino boards made in Eagle as well.
What software was used to design Your board?
Another question, what communication protocol is used (of should be used) for communication between PLC units (boards)?


>What software was used to design Your board?
Kicad. It's free and it's open source.

>Another question, what communication protocol is used (of
>should be used) for communication between PLC units

The concept project has a custom protocol that I created to communicate between boards. It works over the RS-485 link on the BUS Board, is very simple and cheap (low overhead). I don't plan to grow it to be more complex. The concept hardware is just an idea if you want the electric details to build your own controller.

I'm now focusing much more in having the OpenPLC to be compatible with popular open source platforms such as arduino and raspberry pi. This way you don't need to buy/build an expensive controller to try out the OpenPLC. In the future, I'll probably convert the design of the concept project to create shields for arduinos and RPis, so that you may have the same electrical protection a PLC would offer, working out on a cheap board.
Where is description of the protocol You used?

Which protocols are You planning to use for communication with remote devices (Arduino boards, other PLC ...)?


>Where is description of the protocol You used?

I didn't plan to use this protocol with anything else besides the hardware boards I posted in the "Concept Hardware" section. Therefore, the only documentation I wrote about it is in the firmware code for the CPU card.

>Which protocols are You planning to use for communication
>with remote devices (Arduino boards, other PLC ...)?

OpenPLC already supports Modbus/TCP to communicate with an HMI. I'm planning to write a Modbus Master driver to enable it to communicate with other Modbus Slave devices as well.


> Will it be Modbus RTU RS485?

I'm not planning to support Modbus RTU for now. Currently it supports only Modbus/TCP.