Activity › Forums › Questions & Troubleshooting › Modbus RTU Rs485 with a sensor
-
Modbus RTU Rs485 with a sensor
-
Hello everyone. I am new to all these kind of stuff. So, here’s a silly question. How can i program the controllino Maxi to communicate with a sensor through the RS 485 and Modbus RTU?
-
Hello Ryan,
There are several Modbus libraries available on the internet.
Some of them work others do not work so good.
For my US customer I have modified it as such that it runs Modbus on a Controllino where the Modbus is the master and the device is the slave on RS485 RTU. The library has a limited support as the device is rather basic. The control of the bus runs from the interrupt handers. If interested, you can PM me and see if I can help you.
Best regards,
Johi.
- This reply was modified 3 years, 4 months ago by Johi.
-
Hello Ryan,
simple Modbus Master example sketch is provided with our CONTROLLINO library for Arduino IDE.
But at first I would recommend you to use PC+USB-RS485 converter and try to communicate with your sensor from some Modbus Master PC app.
Good luck!
Lukas
-
Hello Lukas,
I did have the sensor connected to the PC through a RS485 To USB. I think it success. At least i got some data that seems valid to me. The problem is that when i tried to connect it to an arduino or Contollino Maxi. It failed. So, it would be great if someone could share some example that successfully connect a sensor to arduino or Controllino Maxi.
-
Hello Ryan, but our examples provided with the library work fine when you have proper cabling, slave address and registry ID. Please share with us your sketch which does not work.
Thanks,
Lukas
-
Thank for you response. So, I use the example given by you guy. I have changed the
#define SlaveModbusAdd 247
ControllinoModbusMaster.begin( 9600 ); // baud-rate at 19200
ModbusQuery[0].u16RegAdd = 0x19; // start address in slave
ModbusQuery[0].u16CoilsNo = 2; // number of elements (coils or registers) to read.
These are all the things i have changed. However , the output message doesn’t change at all.
For ModbusRtu.h , I just copy the ModbusRtu.h from the github link you guys said on the website.\
For cabling, I just connect the wire according to the function of them.(VCC to 5V GND to GND A to + B to -)
-
Hello Ryan,
thanks. May I ask you also for the type of the sensor you are trying to communicate with?
Thanks,
Lukas
-
It is a temperature and humidity sensor that use Modbus RTU with Data+ and data- wire for communication with PLC. FYI, it is called EE071. Here’s the datasheet for it https://downloads.epluse.com/fileadmin/data/product/ee071/datasheet_EE071.pdf
-
Hello Ryan, thanks for the link. So, you have checked with PC Modbus Master, that the slave address, register address, baudrate/parity/stop bits is correct?
Please try to disconnect the 5V and supply the sensor from 12/24 V.
What is the behaviour, please? No Modbus response from the sensor, or invalid response … we need more details to support you.
Thanks,
Lukas
-
-
-
-
-
Log in to reply.