Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

No Answer from smt100 over MODBUS communication


Mirko UMTEC Apr 25, 2024 11:12 AM

I'm having a problem communicating with a MODBUS Sensor. I'm trying to read the temperature of a a soil moisture sensor (SMT100, https://www.truebner.de/assets/download/AN002.pdf), but I can't get an answer from the Sensor.

I'm using a CR350 and connected the Sensor to the COM2.

Here are the specs from the sensor according to the manual:

Baudrate: 9600
Number of data bits 8
Parity: Even
Number of stop bits 1
Broadcast address: 253
Slave address: 1-247 (configurable)
Recommended minimum timeout:  500 ms (read holding register command starts measurement,
measurement value is returned)
Holding register 0: 16-Bit unsigned temperature value <-- What I want to read
Holding register 1: 16-Bit unsigned soil moisture value (volumetric water content)
Holding register 2: 16-Bit unsigned permittivity value (dielectric coefficient)
Holding register 3: 16-Bit unsigned count value (raw measurement data)

I tested the sensor on my computer and set the slave adress to "10", which worked successfully.

Here is my CR Basic Code:

---------

'CR350
'Created by Short Cut (4.4)

'Declare Variables and Units
Public BattV
Public PTemp_C
Public Temp_C

Public ModBus(2), ModBusResult

Units BattV=Volts
Units PTemp_C=Deg C
Units Temp_C=Deg C

'Define Data Tables
DataTable(Table2,True,-1)
DataInterval(0,1440,Min,10)
Minimum(1,BattV,FP2,False,False)
EndTable

'Main Program
BeginProg

'Open serial connection and set parity to even
SerialOpen (COM2,9600,2,0,50)

'Main Scan
Scan(10,Sec,1,0)
'Default CR350 Datalogger Battery Voltage measurement 'BattV'
Battery(BattV)
'Default CR350 Datalogger Wiring Panel Temperature measurement 'PTemp_C'
PanelTemp(PTemp_C,60)
'Type T Thermocouple measurements 'Temp_C'
TCDiff(Temp_C,1,mv34,1,TypeT,PTemp_C,True,0,60,1,0)
'Call Data Tables and Store Data

'MODBUS Connection
ModbusMaster(ModBusResult,COM2,9600,10,3,ModBus(),1,1,3,600,3)

CallTable Table2
NextScan
EndProg

------

When running the program, I don't get any values from the sensor. The "ModBusResult" only increments 1 as the "Record No" variable in Public table, according to the manual means it failed communication.

When I read the COM2 Port in the Terminal (from Device Config Utility), I get only the Transmit message, but no Receive:

12:46:16.17 T 0A 03 00 00 00 02 C5 70 .......p
12:46:22.18 T 0A 03 00 00 00 02 C5 70 .......p
12:46:30.16 T 0A 03 00 00 00 02 C5 70 .......p
12:46:36.17 T 0A 03 00 00 00 02 C5 70 .......p

Any help to solve this issue would be appreciated.


Thanks


JDavis Apr 25, 2024 04:15 PM

The sensor manual says it is RS-485. Use the Comms mode parameter of SerialOpen() to set COM2 to RS-485 half-duplex transparent.


Mirko UMTEC Apr 29, 2024 11:47 AM

Setting COM Mode to RS-485 half-duplex transparent solved the problem, thanks a lot!

 SerialOpen (COM2,9600,2,0,50,4)

 

Log in or register to post/reply in the forum.