OpenPLC on Linux

These instructions are targeted for Debian-based distributions (like Ubuntu, Mint, Kali, etc).

The best way to get OpenPLC files into your system is by using git. Usually, git comes preinstalled on most Linux distributions. If for some reason you don’t have git installed on your system, you can install it by typing:

sudo apt-get install git

To install OpenPLC type these lines on the terminal:

git clone https://github.com/thiagoralves/OpenPLC_v3.git
cd OpenPLC_v3
./install.sh linux

The installation process will take a while (up to 1 hour depending on your system). Meanwhile, grab a [insert your favorite beverage here] and relax! Once OpenPLC is installed, just reboot your device and it will start automatically after boot.

Tip

To use in-development capabilities, checkout the development branch (git checkout development) prior to running install.sh.

The OpenPLC runtime has a built-in webserver that you can access. While OpenPLC runtime is running, open your browser and type:

localhost:8080

​ Once you access OpenPLC web interface, you should see in your browser window a login page like this:

The default username and password is openplc (login) and openplc (password). This means that the first thing you must do after logging in for the first time is change the default username and password! It is very easy to do that. Just go to the Users menu, click on the OpenPLC User and change the information as you like.

Once you save the changes you will be prompted to login again. Just login with your new credentials and you will be good to go!

Setup Slave I/O

A great way to use OpenPLC on your Linux machine is with slave I/Os. Therefore, your Linux machine can run OpenPLC Runtime and act as a Soft-PLC controlling real boards configured as Slave I/O devices. Go to the Getting Started page and follow the instructions to setup one of the supported platforms as slave devices. Then, through the web interface, add your slave devices on the “Slave Devices” menu. Keep in mind that slave devices are attached to address 100 onward (i.e. %IX100.0, %IW100, %QX100.0, and %QW100).

My First Project

The Reference menu on this website has a nice tutorial that teaches you how to create your first project. However, if you’re in a hurry, you can download the official Hello World project, which is basically one rung, a button, a timer and a coil, all connected together. The button is attached to %IX0.0 and the coil is attached to %QX0.0. When the button is pressed and released, the coil is energized and remains on for 2 seconds, and then turns off.

Download the project below and open it on OpenPLC Editor. Click on Generate program for OpenPLC Runtime in order to compile the diagram into a ST file. Then upload the ST file to the OpenPLC using the web interface.