Using a chinese ModBus temperature sensor

I’m testing this modbus SHT20 temperature and humidity sensor: https://www.aliexpress.com/item/SHT20-Temperature-Humidity-Sensor-Industrial-Grade-High-Precision-Temperature-Humidity-Transmitter-Monitoring-Sensor-Modbus-RS48/32923628973.html

There is not much information about this device at Aliexpress. Fortunately searching for the string XY-MD01 that was in the board returned this Russian web site: http://www.bizkit.ru/2018/11/14/5789/

It give a little more detail about the device. Also I found other website that used a different temperature sensor, but the modbus address and protocol is almost the same: https://techsparx.com/energy-system/modbus/linux-modbus-usb-rs485.html

The sample application worked correctly. All I did was to change the modbus_get_response_timeout() to include “&old_response_to_sec, &old_response_to_usec” as it was in the comments and changed the temperature division to: “(tab_rp_bits[0] / 10.0)”.

After some tests I got mbpoll working to read data as well:

$ sudo mbpoll -a 1 -b 9600 -r 2 -t 3 -P none /dev/ttyUSB0

It is nice as the Internet save our soul! I hope this post eventually help other people as well.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s