List of available drivers
MCP3008 - Is included by the standard package from the CODESYS Store
PiFace - Is included by the standard package from the CODESYS Store
PiFace as IODriver - Is included by the standard package from the CODESYS Store
PiFace Control and Display - Is included by the standard package from the CODESYS Store (3.5SP6 Release)
MCP23S17 - Is included by the standard package from the CODESYS Store (3.5SP6Patch30 Release)
LCD4x20N Character Display
MAX7219 Library MAX7219
MCP3202 Library 2 ana inputs 12bits on SPi bus: MCP3202
MCP3202 Library Monarco.io 3-IO driver for the Monarco Hat by Monarco.io
SRF02 Ultra sonic range finder - Is included by the standard package from the CODESYS Store
AK8975 Compass - Is included by the standard package from the CODESYS Store
MPU9150 Gyro- Is included by the standard package from the CODESYS Store
MPU6050 Gyro- Is included by the standard package from the CODESYS Store
AdafruitPWM - Is included by the standard package from the CODESYS Store
Arduino UNO IO Device Description and Library
Adafruit LCD Plate Device Description and Library
MCP23017 16-Bit I/O Port-Expander Device Description and Library
PCF8574 8-Bit I/O Port-Expander Device Description and Library
PCF8591 4 Channel, 8bit Analog to Digital converter Device Description and Library
PiChips 4 PWM I2C Device
SHT21 Humidity & Temperature Sensor
LSM9DS1, an Accelerometer/Gyro/Magnetometer
LSM303 accelerometer and Magnetometer
MCP4728 4-Channel 12-bit DAC
RETAIN data support library for mcp7941x on Raspberry Pi
Reading QR Code
BME28025C512 64KiB EEPROMAn 4channel dimmer (I done this for an friend)PCA9555 as 16 bit inputPCA9555 as 16 bit outputPCA9685 a 16 channel 12bit PWM output, inspired by example code of CODESYS but writes only when output value is changingPCF8575 as 16 bit inputPCF8575 as 16 bit outputSSD1306 Display DriverTCA9548 8 channel I2C Multiplexer/switchTSL2561 lux sensor, experimental
DS18B20 - Is included by the standard package from the CODESYS Store (3.5SP5Patch2 release)
PiCam - Is included by the standard package from the CODESYS Store
Date: 16.2. 2015
I´ve attached my library for the SHT21.
It has an internal statemachine inside the _iState, dont know if this was neccesary but i think the symbolic status of the device changes if it isnt "10" ?
It has a TON Timer of 50ms before Writing a measurement request ( i´ve only tested the No-Hold commands ).
The internal state machine has these states:
10: Write Temp measurement command -> Send to state 11.
11: Read/wait for respons, when respons is found -> Send to state 20.
20: Write Humidity measurement command -> Send to State 21.
21: Read/wait for respons, when respons if found -> Send to state 10.
Every read checks the statusbit of the second byte, to check if it is the correct measurement that is read(temp/humidity), and sets or resets the xTempValid and xHumidityValid booleans.
It dont use the checksum.
After a Temperature measurement request is sent, a 100ms TON is set, before doing a Read, same with Humidity Measurement, but only 40ms.
If the read isnt successfull it will try again in the next cycle.
I tried withouth these timers with 4ms cycle time. On the 17th Temperature read (68ms) I got a respons from the sensor, and the 7th Humidity read (28ms).
So to take some cycles of the Cpu and the bus, i think its the right way to go. But you could probably go down to ~65-70ms for a temperature read and ~30ms for a Humidity.
It also has a internal watchdog timer, which is needed if it doesnt get a respons at all (i made a short between the SCL/SDA lines and it got stuck in a reading state), when it runs out, it starts from _iState 0 (complete restart).
If you dont specify a I2C address, in _iState 0 it automatically sets the address 0x40 (decimal 64), which is specified in the SHT21 manual.
Its probably not the best written library but it works very well.
Hope it will be of some use to someone.
SHT21 Humidity & Temperature Sensor
I2C_SHT21.library [348.46 KiB]
SHT21.devdesc.xml [2.35 KiB]
Hello Can I have an example? a project to test? I used that for my AM2315 (address 0x5c) but codesys crash when I go online mode ...
Arduino UNO IO Library for Codesys on Raspberry Pi
Author: Gerhard Schillhuber
I2CArduinoUno.zip [908.62 KiB]
documentation.pdf [622.75 KiB]
Adafruit LCD Plate (http://www.adafruit.com/products/1110)
Date: 12.11. 2014
Raspberry I2C AdafruitLCDPlatev184.108.40.206.library [383.08 KiB]
LCD_Test_Project_v220.127.116.11.project [122.41 KiB]
AdafruitLCDPlatev18.104.22.168.devdesc.xml [2.34 KiB]
4x20 Character LCD
Author: Werner Hinterseer, Lambda GmbH & Co. KG
LCD4x20N_Demo.project [120.09 KiB]
LCD4x20N.library [336.82 KiB]
Documentation LCD4x20N Library.pdf [94.43 KiB]
LCD4x20N.devdesc.xml [2.41 KiB]
Date: 05.10. 2014
raspi_i2c.project [113.74 KiB]
MCP23017.devdesc.xml [2.48 KiB]
I2C_MCP23017.library [327.3 KiB]
PCF8574.devdesc.xml [2.48 KiB]
I2C_PCF8574.library [325.88 KiB]
PCF8591.devdesc.xml [2.47 KiB]
I2C_PCF8591.library [325.22 KiB]
Date: 21.10. 2014
PiChips 4 PWM I2C device.
Tested with 100kHz and 3,3V on a L272 as H-Bridge with default settings on the eeprom.
I2C_PiChips16.library [329.05 KiB]
PiChips016.devdesc.xml [2.48 KiB]
Author: Oleg Wagner
MAX7219 which enables to drive up to 20 casceded (daisy chained) MAX7219 devices
(7-segment displays as well as 64-LED matrices).
Following functions are included:
- Display Test
- Set number of digits
- Shutdown mode
- Set brightness/intensity
- Clear Digit or Row
- Clear all segments/LEDs of a device
- Write particular segments of digits
- Write BCD numbers
- Write characters
- Write multi-digit integer
- Write multi-digit floats
- Write particular LEDs in row
- init device
- all necessary methods to set up SPI communication and data transfer
A device description file is also part the library.
For first impression see attached screen shots.
I would like to share this library if there is interest (no engagement).
Update to 22.214.171.124 Version include:
Extension of device description file:
Extension of “Initialize”-method in library with setting of above mentioned parameters
Raspberry SPI MAX7219_1001.rar [544.94 KiB]
Raspberry SPI MAX7219.rar [447.2 KiB]
because i had some problems with the standard Adafruit PWM and made my own version.
Sometimes i need the PWMs and / or the servo control function.
Use a Array[0..15] to send values from 0 - 100 for PWM function or 101 - 200 for servo control (1.01 to 2.00 ms Pulse)
I added a accessible trim function for servo pulse finetuning.
The State shows if the device is present and accessible.
The IN shows the actual frequency register value.
PCA9685.devdesc.xml [3.2 KiB]
I2C_PCA9685.library [278.88 KiB]
Date: 12.10. 2015
A library for UPS PIco for Raspberry Pi. Includes the following functions:
- read voltage
- read temperature
- read analog inputs
- read other parameters
- control LEDs
- control of cooler (including automatic control based on temperature)
- Still Alive Timer (watchdog which will reboot the Raspberry Pi if your code will stop)
- initial configuration of the device out of your code
UPSPIco.project [177.26 KiB]
I2C_UPSPIco.library [381.52 KiB]
UPSPIco.devdesc.xml [2.42 KiB]
Date: Sun Apr 17, 2016
librarie for DS1803 i2C 2 potentiometer output
DS1803.devdesc.xml [2.31 KiB]
I2C_DS1803.compiled library [160.36 KiB]
I2C_DS1803.library [304.19 KiB]
Date: 17.06. 2016
MCP4725 digital to analog converter
Input an integer 0-4095(12-bitDAC)
MCP4725.devdesc.xml [2.37 KiB]
I2C_MCP4725.library [329.81 KiB]
Date: 16.11. 2016
MCP3202: Rpi 1:
pin1 > pin 24
pin5 > pin 19
pin6 > pin 21
pin7 > pin 23
SPI_MCP3202.library [300.62 KiB]
MCP3202.devdesc.xml [2.44 KiB]
Author: Dag H. Hanssen
Here is a library I made for the device LSM9DS1, an Accelerometer/Gyro/Magnetometer form ST life.augmented, on a break-out board from Adafruit. (I had to zip the library-file since the size was more than 500kB, which is maximum upload file-size for this forum.)
The device has actually two slaves, but I chose to integrate them both with on device-description. It doesn't matter if the user assigns a slave address in the project, the code in the library alters anyway between two different slave-addresses when writing/reading data.
Though the device has built-in FIFO-registers, for faster and less time-/power-consuming readouts, I have not used this option in this version of the library. Instead, the readout is timer-controlled, with a user-specified read-rate.
I have also uploaded a very simple test-project.
Hope someone finds the library useful,
Testing_LSM9DS1.project [120.94 KiB]
I2C_LSM9DS1 library file.zip [202.45 KiB]
LSM9DS1.devdesc.xml [2.51 KiB]
Date: 09.05. 2017
My Library for the ST LSM303 accel magnetometer board avaliable from Adafruit.
Separate device files, but combined library.
Attached is an example project too.
I2C_LSM303.library [310.79 KiB]
LSM303.project [156.54 KiB]
LSM303_Accel.devdesc.xml [2.33 KiB]
LSM303_Mag.devdesc.xml [2.33 KiB]
Date: 17.11. 2017
Here is my Library for some I2C devices for CODESYS.
You can place all devices behind a multiplexer to reduce address conflicts.
Although include the BME280 Environment sensor and an SD1306 Display Driver.
Look at google for these little funny Displays.
All fonts are working on the display, but not the biggest. There the bits have to be twisted.
If you find any problems, tell me, the Drives have not been tested all.
Don't look at the documentation, there is none ... .
In the I2C_Base FB I did write some info’s for the muxing.
With the muxing IC you can connect about 33554432 BME280 on the raspi, but then bus cycle time is no longer a problem .
You will need the OSCAT building lib to compile. i can not uplode it here like the OSCAT BASIC lib(to big), so try the lib from the store.
25C512 64KiB EEPROM
An 4channel dimmer (I done this for an friend)
PCA9555 as 16 bit input
PCA9555 as 16 bit output
PCA9685 a 16 channel 12bit PWM output, inspired by example code of CODESYS but writes only when output value is changing
PCF8575 as 16 bit input
PCF8575 as 16 bit output
SSD1306 Display Driver
TCA9548 8 channel I2C Multiplexer/switch
TSL2561 lux sensor, state I would say experimental
Raspberry I2C MUX_update.projectarchive [416.51 KiB]
Raspberry I2C MUX.projectarchive [388.84 KiB]
BASIC.projectarchive [398.68 KiB]
xml devices.zip [18.38 KiB]
Date: 25.07. 2018
Hello fellow Raspberry enthusiast!
Here is a device library for the MCP4728 4-Channel 12-bit DAC, default address = 0x60.
Input an integer 0-4095 for each channel.
MCP4728.devdesc.xml [2.38 KiB]
I2C_MCP4728.library [335.03 KiB]
I did implementing an MQTT library, test it an have fun…
Short info from short doku...:
please start here:
MQTT.projectarchive [787.6 KiB]
Date: 11.02. 2018
Codesys Application Composer "FirstSteps" Example implemented with the Monarco V126.96.36.199 Library;
https://github.com/Aliazzzz/Monarco-HAT ... FirstSteps m
Author: Reinhard Hesse
Library for I2C – PCF8574 LCD contains:
03_LCD_Basic - Example Project
04_LCD_Visu -Example Project
01_XML Device Description
I2C-LCD mit CODESYS.pdf documentation
Fertig.zip [2.35 MiB]
Link to the post(including attachements):
l viewtopic.php?f=23&t=9760 l
There is a simple example how to generate a QR-code and show it in web-visu: Example_QrCode_RPI.projectarchive
sudo apt-get install qrencode
You need to install OwenStringUtils library. It included in projectarchive or you can install it separately: download
It's nice lib with additional string functions like ASCII/Unicode conversion, formatting and parsing.
In example used SysProcess library.
So you need to add in /etc/CODESYSControl_User.cfg next lines:
Keep in mind that you need to have write access rights:
sudo chmod 0666 /etc/CODESYSControl_User.cfg
sudo chmod 0666 /var/opt/codesys/PlcLogic/visu
l viewtopic.php?f=23&t=9665 l
This library enables the usage of RETAIN data on the Raspberry Pi platform which natively does not support this.
It is based on the mcp7941x RTC chip which also contains 64 bytes Battery Buffered SRAM.
For details and package: https://forge.codesys.com/drv/mcp7941x/ m
Log in to post a comment.