fixstuff555 - 2016-02-23


I have a project that uses Codesys on the Pi that I would like to share. I have a Github repo of the files and code. I am still adding to the repo, but the board design files and Gerbers are there for the PLC base board that the Pi plugs into.

The repo also has a link to my blog, where I have detailed the build from the beginning.

Of main interest is the library I created which makes interfacing to I2C devices a bit easier (for me anyway). The project uses this for many devices, of which the code is included. This includes the I2C interface to a Teensy 3.1, an 10 DOF IMU from Adafruit which has on-board the IMU a BMP185 barometric pressure sensor, an LSM303 compass/accelerometer,, and a L3GD20H gyroscope. On the PLC base board is also an I2C 4ch DAC, which is a LTC2619.

To date, I have tested almost the whole Grove line of sensors, including the main board (plugged into top), several additional microprocessors, such as the Parallax Propeller, and Cypress PSOC5 LP. All have used the same I2C library. Code for this is not in the repo, but can be added if there is any interest.

The project demonstrates the Modbus client and server usages, embedded Pi camera video in the visualization, external calls to a Python script from Codesys for GPS, and includes several useful code snippets such as state machine sequencing, and lots of helpful library example usage, such as the OSCAT libraries.

It''s an ongoing project for me, hopefully, this could be of use to someone.