CODESYS - the IEC 61131-3 automation software

Raspberry Pi: List of available example applications
Page 1 of 3

Author:  Moderator3S [ Fri Jun 19, 2015 5:13 am ]
Post subject:  Raspberry Pi: List of available example applications

Raspberry Pi appliation examples and code snippets:

Applications which come with the Pi package:
'c:\Users\<youwindowsUsername>\CODESYS Control for Raspberry PI\'

    EtherCAT.project GPIO.project
    SoftMotion Servo Example.project

Important for using these examples:
1. Update device (rightclick on Pi in the device tree - this is needed for fieldbus stacks too)
2. set current compiler Version
3. set current visuprofile
then the projects are up to date.

Application shared by CODESYS Pi users:
Delta Robot wth rc servos
Show Ip and use calendar from OSACT for timer functions (starting once a day Events) , visu: rotate bitmap
Communication with Domoticz , bulding automation
How to use SoftMotionLightwith the Pi
How to use a table in the visualisation for Input values
How to implement a FTP Client by using the OSCAT Network lib
How to get the result of Shell comand to IEC code
Profinet with Raspberry Pi (using Pi2 recommended) acyclic read -Service / diagnosis
PiFace with ladder / read and Show own IP address in visu
Visu User Login see Client IP Address
CODESYS V3 RPi DATABASE .txt file on SD if RPI shut down Address
Elsner P03/3-RS485 RS485-Weatherstation with Raspberry Pi
TextEditor Example Application
Raspberry Pi 3 Modbus TCP Master and Arduino Mega Modbus TCP Slave
Raspberry Pi - GoogleMaps with Webvisu
Webbrowser Element
Imported CODESYS V2.3 Project Example
Check the Raspberry PI CODESYS License on Runtime Key and SoftLicense
Raspberry PI as Profinet Slave project example
Raspberry PI Onewire - improved Project two tasks
Communication - 2 Raspberry PI Modbus TCP
1-Wire Busmaster / USB Hostadapter DS9490R OWFS
2 Raspberry Pi communication with Ethernet IP
Using RFID USB Reader with Raspberry PI
Communication with SONOS speaker
sending notifications by pushover
Using a python opcua client to access symbold in the CODESYS project
add python scripts in CODESYS as external file and execute them on PI
Unicorn HAT example
Using I2C Port-Expander PCF8574 without I2C library
Visu UserManagement Switch logged in User by IECcode
Enocean example
IO-Link example based on Control RTE
Play sound on Raspberry PI
How to use/enable serial communication on Raspberry Pi
How to use targetvisu on Raspberry Pi for example with PI Touch LCD
CmpCharDevice example
Play sound on Webvisu connected device
How to connect mutible serial USB devices
CSV Writes a file on the raspberry storage Card
Using CoDeSys on Raspberry Pi to poll ModbusTCP slave data, and uplink by using LoRaWAN ATIM ACW-XB

Author:  Moderator3S [ Sat Jun 20, 2015 5:17 am ]
Post subject:  Delta Robot with rc servo

Author:  Moderator3S [ Sat Jun 20, 2015 5:42 am ]
Post subject:  Show IP Adress in Visu and use OSCAT for calendar and timer

-How to use Oscat calendar and timer2 for starting Outputs once a day or only on specific weekday
-How to Show the raspberry pi current ip address on / internal visu and webvius page
-Rotate bitmap in visu

Author:  Moderator3S [ Sat Jun 20, 2015 6:01 am ]
Post subject:  Communication with Domoticz , bulding automation

Building Automation example, comunication with Domoticsz

Author:  Moderator3S [ Sat Jun 20, 2015 6:04 am ]
Post subject:  Serial Com with Syscom

Beside CAASerialCom using Syscom.library is possible too.
Here is the example for it.
(See viewtopic.php?f=21&t=5699 for CAASerialCom example)

on Linux side you need to indentify your serial port and activate it in /etc/CODESYSControl.cfg

How to do this:
1. you need to check on linux side which tty port is available.

Example a USB to serial converter:
Check under Linux with 'dmesg' which device is used for it:

in my case it reports: ttyUSB0

so you need to add in /etc/CODESYSControl.cfg
(Attention you need to remove the 0 from USB0)

portnum := COM.SysCom.SYS_COMPORT1;

this was the pi side under Linux

2. then after reboot or restart plc, you could communicate via serial com

Author:  Moderator3S [ Sat Jun 20, 2015 6:19 am ]
Post subject:  Using SoftMotionLight

Example how to use SoftMotionLight with Raspberry Pi.
(no realtime is needed for SoftMotionLight - drive should support DS402)
Check your drive for SoftMotionLight capability with:
"c:\Program Files (x86)\3S CODESYS\CODESYS\Projects\SoftMotion\SoftMotionLight\SML_CompatibilityCheck_DS402.project"

Author:  Moderator3S [ Thu Jun 25, 2015 9:18 am ]
Post subject:  Using a table in the visualisation for Input values

1. Numpad
2. keyboard
3. toggle a value
4. Keypad

Author:  Moderator3S [ Wed Aug 05, 2015 8:08 pm ]
Post subject:  Raspberry Pi plc as FTP Client

FTP Client example.
(OSCAT Network and OSCAT Basic is used)

Author:  Moderator3S [ Thu Aug 06, 2015 2:03 pm ]
Post subject:  Sys_Process_Execute_Command2

Read ProcessorTemperature of the Pi and Show cpuinfo in IEC -
add in /etc/CODESYSControl.cfg the [SysProcess] section
Output of the executed command will be filled into pszStdOut

Author:  Moderator3S [ Sun Aug 09, 2015 6:01 am ]
Post subject:  Profinet with Raspberry Pi 2

Profinet Example with Raspberry Pi (Pi2 recommended)

Author:  Moderator3S [ Mon Oct 26, 2015 4:41 pm ]
Post subject:  PiFace with ladder and show own ippadress

PiFace with ladder example

Author:  Moderator3S [ Sat Nov 28, 2015 9:22 pm ]
Post subject:  Visu User Login see Client IP address

Visu Userlogin

Author:  Moderator3S [ Thu Dec 31, 2015 7:24 am ]
Post subject:  CODESYS V3 RPi DATABASE .txt file on SD if RPI shut down

here I can show example of saving INT values int txt file on Raspberry Pi SD

I have used pymodbus TCP to create modbusMaster(client) on port 503, with 10 holdt_register and 10 input_registers
in Cosesys v3 create ModBusSlave TCP also with 10 holdt_register and 10 input_registers,

if raspberry pi shut down , at start you can get 10 int values from file vars.txt on SD

How to make start at boot pymodbus master(client)

using PuTTY:
#sudo nano /etc/init.d/autorun

and paste text from autorun.txt
Ctrl + x

#sudo chmod 777 /etc/init.d/autorun
#sudo update-rc.d /etc/init.d/autorun defaults

#cd /home/pi/Documents/pymodbus/examples/common

root@raspberrypi:/home/pi/Documents/pymodbus/examples/common# sudo nano

and paste text from
Ctrl + x

before ShutDown RaspberryPi Download CodesysProject and try:

#sudo /etc/init.d/autorun start


Starting autorun
wait to start ethernet , wait for Codesys Slave to start 20sec
cycle: 1
Input0: 57648
Input1: 57649
Input2: 57650
Input3: 57651
Input4: 57652
Input5: 57653
Input6: 57654
Input7: 57655
Input8: 57656
Input9: 57657
line0: 57648
line1: 57649
line2: 57650
line3: 57651
line4: 57652
line5: 57653
line6: 57654
line7: 57655
line8: 57656
line9: 57657
cycle: 2

Author:  Moderator3S [ Fri Feb 19, 2016 7:51 pm ]
Post subject:  Weatherstation Elsner P03/3-RS485 with Raspberry Pi

Example Application with RS485 connected Elsner P03/3-RS485

Prefered Interface (USB to RS482 Serial adapter) ... UTF8&psc=1
(Advantage does not use any specific kernel module - you could use latest Debian)

For Raspi Comm the following is needed:


maybe another options is:
Link: ... rs485.html
RS485 Extension: RasPi Comm

For Raspi Comm the following is needed:


wget && chmod +x ./ && sudo ./

sudo raspi-config
1. Devicetree
2. I2C
3. SPI

RS485 Port is


Author:  Moderator3S [ Mon Mar 14, 2016 8:00 pm ]
Post subject:  TextEditor Application, edit and save your textfiles...

TextEditor Application, edit and save/read your textfiles

Page 1 of 3 All times are UTC+01:00
Powered by phpBB® Forum Software © phpBB Limited