The Monarco HAT is a robust industrial graded HAT, perfectly suited for IOT projects, small home-automation or industrial projects and much more ...
It also protects your Raspberry Pi from overvoltage or short-circuiting and simultaneously provides you with enough IO channels and channel configuration versatility.
It features analog and digital inputs and outputs, RS-485, 1-Wire bus and a Realtime Clock.
Implemented as an IO device-driver, so no function block calls to the HAT in your software necessary.
The HAT is exposed as a hardware device with IO channels and parameters. Just write code, attach variable to a I/O channel in the hardware tree, ready!
CODESYS Raspberry Pi SL Demo or License (The Demo is unrestricted in technical capabilities but will only run for two hours straight, after which it stops and you have to set it in run again yourself by logging in)
Double-click the package or via CODESYS IDE Package Manager,
Install the loose components via the Library / Device Repository, found under Tools menu option in CODESYS IDE.
Monarco UART configuration
Enable CODESYS to use the RS485 UART on the Monarco Hat.
Switch to etc direcory and edit the CODESYSControl.cfg;
sudo nano CODESYSControl.cfg
Add the following lines;
Now save and Quit nano.
Now, do a forced NTP sync
This will force to sync time with some time server and returns something like, depending on date/time and your time-zone;
Local time: zo 2018-09-23 14:46:17 CEST
Universal time: zo 2018-09-23 12:46:17 UTC
RTC time: zo 2018-09-23 12:46:18
Time zone: Europe/Amsterdam (CEST, +0200)
Network time on: yes
NTP synchronized: yes
RTC in local TZ: no
Now you can use the HAT, RS-485 and the Real-Time Clock from within a CODESYS IEC application.
Access the RS485 UART via a comlib of you own flavour in CODESYS (like CAA SerialCOM library).
Running the CODESYS project
Open the provided example project file.
Check/Set SPI master parameters:
SPI bits 8,
Speed(Hz) 1000000 (=1MHz) => can be set up to 4 MHz, slower speeds avoid chance on crc errors
Compile, download and run and enjoy!
Limitations / Bugs
All functionality of the HAT is allready implemented into the core of the driver but some functionality still needs to be routed as parameters.
If you experience any bugs, please leave a Ticket
Special thanks goes out to Ingo Hornberger for helping out with difficulties and for his patience.