MODBUS-RTU on Raspberry Pi

Hi all,

I’m looking at connecting something like this Industrial-grade Soil Moisture & Temperature Sensor MODBUS-RTU RS485 - Seeed Studio to a RPi 3 B+. It comes in two variants, one with an ‘aviation connection’ and one with 4 wires.

How would I best go about getting this working on the RPi?

I found an RS485 HAT listed. Would I need something like that to connect it and am I then able to write Python code to retrieve the readings?



Hi Kirk,

The soil sensor you’ve linked uses Modbus RTU via RS485 communications protocol which will be converted from RS485 to the Pis SPI interface.

I haven’t got much experience with Modbus RTU so I’m not sure exactly how tricky it will be to get the sensor reading you need. My understanding is you will need the modbus register mapping from page 11 of the user manual to tell you what commands to send and the format you should expect to receive in reply.


I appreciate the feedback @Trent. Thank you.

So to even be able to connect this to the RPi and to communicate with it, I would still need something like the RS485 HAT right?

1 Like

Hi Kirk,

The Pi cannot natively communicate via RS485 so a HAT like the one you are looking at or some sort of converter will be needed. is a lifesaver when it comes to Pi communications. I haven’t used Modbus RTU very much myself but my understanding is that you will be trying to use the SPI interface to send Modbus RTU commands which will be converted by the HAT. This is getting pretty tricky as there are already several layers of conversion that will happen so I don’t know how you would need to structure your messages so they aren’t mangled by the converters.


Oh my gosh @Trent. I think it’s time that I try and find a different waterproof soil temperature / moisture sensor. Thanks so much for your help.