Hello, I would really appreciate your help with this problem i am facing.
I have a problem to communicate between arduino and micro motion coriolis flow meter R045S series through modbus RTU protocol with RS485. I am using modbusmaster.h library. But the connection modbus always failed. I have tried to change baudrate, parity, and ID slave to solve it. But it still failed to connect the modbus.
No idea man, but you are registering the callback and intializing the node everytime you make a measurement, put those in setup.
TX1 and RX1 shown in the figure correspond to Serial1, not Serial2.
I can not see the header of the table but I seems they are decimal so it was right (they could also be HEX).
I could not download the manual, the link is broken, just make sure what kind of register is (register, holding register or coil).
Oh yah, I just changed the ID address to 1, and tried to chage the baudrate based on the manual book. I changed to 1200, then 2400, 4800, 9600, 19200, 38400. But it still failed.
I tried to change the register code in arduino to 1100, it still failed. I've also change the register to other address, but it still failed. Is the code I've made wrong?
At the bottom of the Features section it says "ProLink III Basic Software is included with each meter" and provides a link to the basic software.
My suggestion would be to get the basic software and a USB-RS485 serial adapter and try to use the software to talk to the sensor. If you get that working, then you can use your Arduino as an RS485 serial monitor. A bit of trial and error should get you the baud rate. Once you know that, you should easily be able to see the modbus address. Once you have that, you can either try your code again, or use the basic software to read the information you want and see which register(s) are being read using your Arduino as the 485 monitor again.
Thank you for your suggestion. Ya, I have to get for the software first, and try to use software to talk to the sensor. Because if I code with arduino, before check from the software, I don't know the baudrate, parity, and ID Slave setting. Thank you for your helping
Hi markd833. I had tried to connect the sensor and Prolink3 software. It's work. I got:
baud rate: 38400
parity: none
stop bit: 1
Id address: 4
Then I want to monitor the temperature sensor with arduino, it still failed. The temperature register is 0251. When I check from serial monitor, the address is change to 169. I think, I can not write the register with prefix "0". Here is my code:
That's great news that you have been able to talk to the sensor via the manufacturers software. Even better news that you now know for sure that the baud rate is 38400 and the address is 4.
Next observation - back in post #1 your wiring diagram showed you had used TX1 & RX1. Your latest code should therefore be using Serial1.
And, you probably don't need to include SoftwareSerial as you are using a hardware serial port for your modbus.