element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Industrial Automation
  • Technologies
  • More
Industrial Automation
Blog Try out OpenPLC on a Raspberry Pi
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Industrial Automation to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 9 Aug 2019 1:01 PM Date Created
  • Views 7848 views
  • Likes 10 likes
  • Comments 8 comments
  • openplc
  • raspberry pi
  • ladder logic
Related
Recommended

Try out OpenPLC on a Raspberry Pi

Jan Cumps
Jan Cumps
9 Aug 2019

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.

image

 

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.

image

 

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).

image

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.

image

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

 

 

image

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

image

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

image

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

image

  • Sign in to reply

Top Comments

  • jomoenginer
    jomoenginer over 6 years ago +4
    Very cool Jan. I had seen OpenPLC awhile back and was looking to give it go but have not been able to fit into to my schedule. There is Arduino support with OpenPLC which I thought would be interesting…
  • Jan Cumps
    Jan Cumps over 6 years ago in reply to jomoenginer +3
    The Arduino can be used as a slave device (an I/O expander). I haven't seen it listed as an embedded platform that can run OpenPLC itself. You'd still need a Pi, one of the other embedded platforms or…
  • jomoenginer
    jomoenginer over 6 years ago in reply to Jan Cumps +3
    Understood. It would still be interesting to test it out.
Parents
  • bernhardtjosef
    bernhardtjosef over 5 years ago

    Here an Example with Raspberry PI 4

    image

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • bernhardtjosef
    bernhardtjosef over 5 years ago

    Here an Example with Raspberry PI 4

    image

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube