Starting with CODESYS on the Raspberry Pi – Update

Last May I blogged about Starting with CODESYS on the Raspberry Pi. Since then I have found it a great teaching platform to help others learn CODESYS. My getting started tutorial is now a little out of date, so I thought I would reproduce it using current versions of software. This blog walks through the steps of installing CODESYS under Windows 10, installing the CODESYS for Raspberry Pi plugin, Installing the CODESYS runtime Raspbian and establishing communications.
Thanks to 3S the process is now much easier.

Installing CODESYS on Windows 10

Download CODESYS from  (You need to register, but then the download is free). Run the installer accepting all defaults

Installing CODESYS for Raspberry Pi

Download CODESYS for Raspberry Pi from the CODESYS Store Again you have to register first, everything is contained within a single .package file
Installation is a two stage process, firstly installing the package within CODESYS, and then subsequently installing CODESYS on the Raspberry Pi.

Installing the CODESYS Package

Launch the CODESYS IDE, Tools->Package Manager… then Install…, browse to the Package previously downloaded. Accept the license and then accept the default on every menu in the installer. The package should install as shown, and CODESYS then needs to be restarted.

Preparing the Raspberry Pi

Ensure that you have the latest version of Raspbian installed on your Raspberry Pi.

New Install

3S give links on their download page and the First Steps pdf tells you how to setup the RPi for various different peripherals

Upgrade Raspbian

If you choose to upgrade, be careful of anything important, perform backups before you start. On the Raspberry Pi issue these commands to upgrade, then continue to install CODESYS as instructed below.

sudo apt-get updatesudo apt-get dist-upgradesudo rpi-update

Installing CODESYS on the Raspberry Pi

Launch CODESYS and then select Tools->Update RaspberryPi, enter the password for the Raspberry Pi, click scan.
If your RPi is found then select the IP Address from the dialog and click OK.
If your RPi is not found, it is possible to enter the IP Address manually, then click OK on the Update Raspberry Pi dialog – this will install the CODESYS runtime on your Raspberry Pi. Progress is reported in the bottom left corner of the CODESYS window.
The update only takes a few seconds, on completion check for messages

There should be a single message saying the Update has finished

Login the the Raspberry Pi and reboot it – now you are ready to test your installation.

Testing The Installation

Launch CODESYS and select New Project…
Select Standard Project and give the project a name, click OK.
Select the Device: as CODESYS Control for Raspberry Pi and the programming language to use, click OK. A project is then created with this content.
Double click on PLC_PRG (PRG) and create a simple program
Now try to login (Online->Login),
Click Yes to start a network scan. (For me this didn’t work – probably because I am running Windows in a virtual machine, if that happens manually type the IP address of your RPi into the box representing the device and hit Enter, your device should then be found).
Select Online->Login again, this time login and download should succeed, the program will be in the STOP state. Switch to the PLC_PRG tab and you should see your program and Variables at their starting values.
Select Debug->Start and the application will start running, you will ten see the variables changing.
Have fun…
Posted in CODESYS, Raspberry Pi and tagged , .


  1. Hi I am following your install instructions, however when I try to update the rpi from codesys I get error: “No connection could be made because the target machine actively refused it”


    • This isn’t an error I’ve seen before. However, the error message implies that the upgrade is having problems with ssh (port) 22 access to the rpi. I suggest that you ensure that SSH is enabled on your RPi, and that you can access it using ssh. Putty is a good windows SSH client, if you need to finds one.
      regards David

  2. I am having the same problem. I can’t connect to the RPI. I can connect with putty and can enter sudo commands. CodeSys will not connect. I have SSH enabled on the RPI and I can ping it from my computer at The RPI Ethernet is hard wired to a switch and Comcast router.
    What am I doing wrong?

    • Hi Don,
      I’m not sure in what way you mean CODESYS doesn’t connect. You say that you can use Putty to connect via SSH, what have you succeeded in doing with CODESYS and what is failing?

      Have you followed the instructions to install CODESYS for Raspberry Pi?
      Have you followed the install instructions in the datasheet for CODESYS for UniPi?
      Are there any error messages?

      regards David

  3. @David, thanks for the article, very helpful!
    @Everyone else out there experiencing the error “No connection could be made because the target machine actively refused it”, This happens when you don’t have SSH enabled on the raspberry pi! Open the “Raspberry Pi Configuration” window from the “Preferences” menu, Click on the “Interfaces” tab, select “Enable” next to the SSH row. Reboot then try the codesys install again!

Comments are closed.