I'm checking if I can use OpenPLC on small Linux devices.

The software is known to work on a Raspberry Pi. I'll try it out on that first.

I can focus on the functionality instead of installation and dependency resolution.

It 'll also give me a chance to measure how much compute resources the application needs.

 

Open PLC is a combination of 3 modules:

  • a runtime, executes PLC programs you made in  ...
  • ... the editor, where you can write programs in ladder logic and other PLC languages.
  • a monitoring application (SCADA) for shop floor data collection and dashboarding

 

Install Runtime and Editor

 

I installed the runtime on my Rasperri Pi, using these instructions. I had to use sudo to install the software. Maybe because I installed it in /usr/local.

Once installed, you get a web application where you can configure the Open PLC runtime, install and monitor programs.

 

I started the runtime in the console, changed the settings to switch autostart and persistence storage on.

In the Hardware menu, I selected Raspberry Pi and saved the setting.

After rebooting the Pi, the OpenPLC application was up and running and I could connect via http://raspberrypi:8080

 

I installed the editor on my windows laptop, using the download available here.

Unzipping it and clicking the shortcut brought up the program.

 

Hello, world!

I started with the example application, available from the Getting Started with Raspberry Pi page.

The example waits for a key to be pressed, then enables an output for 2 seconds (oddly enough 4 - 11 seconds when I tried it).

Because the input used in this example (pin 3, named %IX0.0 in OpenPLC) is pulled high on the Pi, I added an invert block (NOT) between switch and Off Timer (TOF).

I then generated a .st file that can be uploaded via the OpenPLC console.

 

I connected a push button between %IX0.0 and ground, a LED and resistor (I used 660 Ohm, good enough for modern day LEDs) between %QX0.0 and ground.

I then used the console to upload the program to the OpenPLC runtime, then pushed the start button.

 

 

When the button is pushed, the led will light for a given time. Although the example sets that time to 2000 ms, mine lit up for 4-11 seconds.

The odd thing is that the monitor shows that the output pin goes low after 2 seconds, but the led stays on 6 more seconds...

 

There's a monitoring page where you can see the state of inputs and outputs.

This OpenPLC monitor is simple and just displays the pins. In theory you should be able to click on them to get more details (and manipulate them). This doesn't work on my installation. I get a 404.

 

Below you can see the monitor during the 3 possible states:

 

  • in rest: button not pressed (inverted by the NOT operation I put in between), LED off

  • during button press: button pressed (inverted by the NOT operation I put in between), LED on

  • in rest: button released (inverted by the NOT operation I put in between), LED on for a few seconds