I have a modbus RTU pH and Temperature sensor that I wish to read with Arduino Mega as add on to my existing program.
I searched through and found several relevant libraries and examples but I have difficulties making any to work and it seems as if I'l need to put in much more work.
I only need to read two holding registers with 3 words each.
I wish to use a hardware serial (Serial2) and the RS485 to TTL board (MAX485 chip) to convert RS232 to 485 modbus (I have one without external DE-RE).
I'd be thankfull If anyone could share with me a working example. It will save me much work and time.
You can use almost any example of the many libraries out there that implement Modbus, they are all working (at least for the library developer). That doesn't mean that they work for you.
But you failed to provide the necessary information. You should provide a link to the exact RS485 board you're using as well as a link to the manual of the pH device you're trying to connect to.
Unfortunately some of the many existing libs are not working as expexted. (example: the popular modbusmaster has a timming issue as I found out myself and found later on the net, especially with sensitive applications and certain bauds).
After wasting many hours I ended up writing my own hard-coded and tested prog that works as I needed (total 4 hours).
I have tested several shields with the well known Modbus Poll master program with the commercial slave I have. Some of them work' some fail.
That library doesn't handle the inter-message pause Modbus expects but leave that to the controlling sketch. But that's quite common, for example I'm not aware of a PC Modbus implementatiion that enforces the inter-message pause correctly. BTW, that's a non-trivial problem because the serial libraries on the PC as well as on the Arduino are doing the communication asynchronously.
What do you mean by "shields" in this context? Different RS485 boards?
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.