Arduino ModBus Slave Library Needed


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 :confused: from
the multitude of libraries out there, as well as the lack of documentation :o

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 :

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.

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

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 :

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.

Topic reopened at the request of @rockg

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.