URM15 Reading Issue
Hi,
I have a problem with my URM15 ultrasonic sensor. I tried to communicate with the sensor and a Siemens IOT2050 using pymodbus (a Python library) through the DB9 port, but the sensor didn't send any data.
Python script (read distance value) :
client= ModbusClient(method = "rtu", port="/dev/ttyUSB0", stopbits = 1, bytesize = 8, parity = 'N', baudrate=19200)
connection = client.connect()
print(connection)
result = client.read_holding_registers(adresse = 0x05, count =1 , unit= 0x00)
print (result)
Error :
Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 4 bytes (0 received)
The connection RS485 -→ DB9 :
RS485-A -> Pin 1
RS485-B -> Pin 2
GND -> Pin 5
VCC -> External 5V
You can try using a different Modbus client software or tool to communicate with the URM15 sensor. This will help determine whether the problem lies with the sensor, the IOT2050 device, or the pymodbus library.
bidrohini.bidrohiniIs this 485 sensor connected to the 485 to TTL module, first test the communication on the computer successfully?
Please check the address of the 485 module. It is recommended that you try this Python library: https://github.com/ljean/modbus-tk
For example:
master.execute(12, cst.READ_HOLDING_REGISTERS, 0, 3)
jenna