MODBUS error reading sensor

  • Platform information:
    • Hardware: intel i5
    • OS: _Windows
    • Java Runtime Environment: 17
    • openHAB version: 4.3
  • Issue of the topic: Error reading modbus register

The issue is simple. Openhab errors out when reading a modbus sensor

12:38:04.067 [ERROR] [ort.modbus.internal.ModbusManagerImpl] - Last try 3 failed when executing request (ModbusReadRequestBlueprint [slaveId=1, functionCode=READ_MULTIPLE_REGISTERS, start=0, length=1, maxTries=3]). Aborting. Error was I/O error, so resetting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: IOException Error reading response (EOF) [operation ID 71ba6b03-67b3-4d3a-a388-d87502ab078a]

This is on a brand new Openhab installation with only one USBtoRS485 interface and one sensor.

I know everything works on the hardware side because I can read the sensor with modbus programs, for example

The value is zero but the reading is not throwing an error

Here are the configurations of the serial slave and poller

UID: modbus:serial:fbae51e9b3
label: Modbus Serial Slave
thingTypeUID: modbus:serial
configuration:
  baud: 9600
  connectMaxTries: 1
  timeBetweenTransactionsMillis: 35
  stopBits: "1.0"
  parity: none
  receiveTimeoutMillis: 1500
  dataBits: 8
  echo: false
  encoding: rtu
  flowControlIn: none
  flowControlOut: none
  port: COM10
  connectTimeoutMillis: 10000
  afterConnectionDelayMillis: 0
  id: 1
  enableDiscovery: false
UID: modbus:poller:fbae51e9b3:627920aaf4
label: Regular Poll
thingTypeUID: modbus:poller
configuration:
  length: 1
  start: 0
  refresh: 10000
  maxTries: 3
  cacheMillis: 50
  type: holding
bridgeUID: modbus:serial:fbae51e9b3

I can see that openhab is sending the Tx as the USB to 485 has a led for TX but the sensor does not get the request (it has an led that shows when it is performing a measurement) and thus does not send a reply (Rx) to Openhab

Can anyone make sense of this?

Thanks

Are you using 2 programs to connect to serial port at the same time?

The TX light coming on the USB stick is showing openHAB is trying to do something. Which is good.

Do you have another converter that you can hook the two together to capture the data that openHAB is requesting or software to do monitor serial traffic so you can see what each program is sending.

I am using several programs to try to determine where the problem is, but not at the same time.

The two adapter approach is a good idea, I’ll give it a try.

Thanks

Can you show what you try to read, modbus table for device? Poller and Modbus Thing is online? Bridge is online?

Bridge modbus:serial:brink [ port="/dev/ttyUSB0", id=11, baud=9600, dataBits=8, parity="even", stopBits="1" ] 

Bridge poller air [ start=4008, length=1, refresh=300000, type="holding" ] 
  
Thing data holding4009 [ readStart="4008", readValueType="int16" ]

This is what you need to read one address.

I finally got it working.
There were two issues, one I thought that 01 00 meant the first register when in fact 0100 is 100 hex or 256 decimal, so in base 0 I had to start reading at 256 not 0

The second issue is that for some reason my Openhab test system in Windows still was not able to read even when the starting register was 256. When I used my Linux based production system everything worked fine.

Thank you for the suggestions