We are building a circuit based on ATMega328* that :
- Reads 32 current transducers, multiplexed into one Analog Input,
- Reads 12 voltage transducers, multiplexed into one Analog Input,
- Reads 6 temperature sensors, multiplexed into one Analog Input,
- Manipulates all the readings with some math (like scaling, averaging etc.),
- Calculates new variables (power, crest factor, etc.),
- Tracks trends (max/min/avg) of certain (calculated) readings,
- Stores some events (peaks/dips - max/min values) etc. with time stamps from RTC,
- 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.