TransWikia.com

Arduino Modbus Slave Library Needed

Arduino Asked by A.H. Shukry on September 25, 2021

We are building a circuit based on ATMega328* that :

  1. Reads 32 current transducers, multiplexed into one Analog Input,
  2. Reads 12 voltage transducers, multiplexed into one Analog Input,
  3. Reads 6 temperature sensors, multiplexed into one Analog Input,
  4. Manipulates all the readings with some math (like scaling, averaging etc.),
  5. Calculates new variables (power, crest factor, etc.),
  6. Tracks trends (max/min/avg) of certain (calculated) readings,
  7. Stores some events (peaks/dips – max/min values) etc. with time stamps from RTC,
  8. Generates Alarm Flags (by comparing readings to software-set thresholds),

The circuit should be connected as a ModBus Device (Slave) to an existing
Modbus network with several other devices on an RS485 interface.

The circuit should communicate all these calculated values and alarms
as well as some other info, like peak/max values with date and
time stamps that were recorded at their time of occurrence, to the
Modbus Master. We have the freedom of allocating the register numbers
and their formats etc. (Modbus Map) to the controller’s vendor (SAUTER).
For example we tell them Register 30001 is the current sensor x,
30002 is voltage sensor y, etc.

We think that sending time stamps (of certain events) will be based on
"agreed-upon" coding of register values (MM, DD, YYYY, etc.) and the
same for alarms (to be sent as hex codes).

We have searched for libraries and got really confused from the
multitude of libraries out there, as well as the lack of documentation -:)

Can you please kindly help us :
select the proper Arduino Modbus Slave Library that :

  1. Has MAX485 support,
  2. Assigns Modbus registers to any arbitrary variables,
  3. Issues Exception Responses to Modbus requests (e.g. non-existing registers
    or un-supported Function Codes.
  4. Complies to Modbus Standards
  5. Has a manual !!

We found the "yaacov" library on Github but it assigns registers directly to "Pins".
Also we looked at its "issues" and one of them was very serious : in which frames
coming from the Master with corrupted CRC gets responded to and causes collision
with other slaves. We dont like that ! as it indicates that the library was not tested
in true industrial environment.

We also found that the Library at :

https://electronhacks.com/2014/04/arduino-modbus-plc-rtu/

somewhat fits to our requirements, however it lacks the RS485 support, and more
important, it has no documentation.

We really appreciate any kind support.

  • The ATmega328 will be probably replaced with a larger CPU, but we are still
    in development phase.

Thank you.

One Answer

With my post approaching one month without a single reply :smiley-confuse: ! (for whichever reason) I would like to post for those who may need this library :


https://drive.google.com/file/d/0Bx5wWRfN_z7oMDlZMDhWbXM2VFU/view

The library is based on the original one written by Jason Vreeland [CodeRage] Released 3/7/2010 under GNU license

and was used (and possibly modified) by "jhottell" on electronhacks.com :

https://electronhacks.com/2014/04/arduino-modbus-plc-rtu/

The major difference is the use of RS485.

I have written code and tested it on an "UNO" which worked perfectly with more than one ModBus Slave Simulator under windows, including DAQ Factory which is a professional package used in actual industry.

Answered by A.H. Shukry on September 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP