Capacitive soil moisture sensor interfaced via Modbus over RS485. Additionaly provides temperature readings. Open Source Hardware.Designed by Catnip electronics, Ships from Lithuania
Each order contains 1 device. This is a contact-less capacitive soil moisture sensor, a continuation of my I2C soil moisture sensor. This particular version of the sensor is suited for more profess...Read More…
Each order contains 1 device.
This is a contact-less capacitive soil moisture sensor, a continuation of my I2C soil moisture sensor. This particular version of the sensor is suited for more professional installations where long cable runs is a requirement. It adds a local voltage regulator to mitigate the voltage drop and RS485 transceiver to accommodate long wires, also reverse polarity and an additional ESD protection level is added.
This is the easiest and the most robust way to read soil moisture and temperature values into Raspberry Pi. I have written a tutorial how to do it.
The main features:
A python library is available via pip. Type
pip install chirp_modbus to install it. Check the source code for documentation. Usage example:
from chirp_modbus import SoilMoistureSensor
s = SoilMoistureSensor(1, '/dev/ttyUSB5')
Also check out this tutorial.
This is an example sketch that I use to communicate to the sensor from Arduino. This is an actual script I use to test every sensor and record their data to SD card: Arduino rs485 example
Sensor makes periodic measurements (by default, once every 500ms), delays between measurements can be updated by writing to one of the Modbus registers. The results of the measurements are kept in specific Modbus registers and can be read by master at any time unless the sensor is in deep sleep.
Deep sleep is entered by writing a number of seconds to sleep into a special sleep register. The sensor will put the transceiver and all the periphery into the lowest possible power consumption mode and sleep for the specified amount of time. Sensor will not respond when in deep sleep. After the sleep period is over the sensor will wake up, start taking measurements and will be available on the bus.
Serial communication parameters as baud rate, parity and address can be updated by writing to related registers. The sensor will reset and boot with the new parameters if any of those registers are written.
|Register number||Size (bytes)||Description|
|0||2||Soil moisture. Unsigned|
|1||2||Temperature. Signed. In tenths of degrees Celsius. I.e. 220 means 22.0C|
|Register number||Size (bytes)||Valid values||Default value||Description|
|0||2||[1 - 247]||1||Modbus address|
|1||2||[0 - 7]||4||Baud rate|
|2||2||[0 - 2]||0||Parity Note: most cheap ebay USB to RS485 dongles don't support parity properly!|
|3||2||[1 - 65535]||500||Measurement interval in milliseconds|
|4||2||[1 - 65535]||0||Time to sleep in seconds. Write to this register to put the sensor to sleep.|
Note: most of the cheap ebay USB to RS485 dongles and/or their drivers do not support parity setting properly! You will have to use a proper parity supporting adapter to unbrick the sensor if you set this to something that your dongle does not support! Luckily Adruino with ATmega 16u2 can be used as USB to Serial adapter to solve this.
Moisture values are relative. Meaning, more moisture will give you higher reading, less moisture - lower reading. It's up to you to calibrate it to amount of water in the soil as readings will be different for different types of soils.
Moisture is somewhat linear. I test all sensors before shipping and they give about 211 in free air. Variation of this baseline figure between sensors is within range of 10 LSB, with a standard deviation of 2.
Temperature is measured by the thermistor on the body of the sensor. Calculated absolute measurement accuracy is better than 2%. The returned value is in tenths of degrees Celsius. I.e. value 252 would mean 25.2°C.
The sensor will work fine with any controller supporting serial communication provided you have an RS485 transceiver. There are a lot of Modbus libraries readily available for a variety of micro-processor families. Thea easiest way to try the sensor is to use one of the abundant and cheap USB to RS485 dongles and connect it to a Raspberry pi or even directly to your computer.
I have written some basic test code in python that is available on github page.
The sensor comes coated with PRF202 - a moisture resistant varnish for electronics. It's ok for play around in a flower pot but not enough for outdoor use. You must add an additional protection to the whole sensor after soldering cable to it! Some suggestions on making the sensor more robust after attaching the cable:
Be sure to coat the whole thing - the sensor part, the electronics and the cable connection itself so no bare copper or solder is accessible to the water.
Pre-coated version is available. The sensor is coated in epoxy resin, cured and additionally protected by adhesive-lined heat shrink. The 1m (3 feet) long cable is pre-soldered.
The pinout of the rugged version (with the white cable):
The dongle I sell is sourced form Taobao. It is pretty decently designed in a sense that there is some effort put into adding input protection, also it has case, provides power on the connector and does not cost an arm and a leg. It works out of the box under Linux with kernel 4.9 or newer.
My Raspberry worked fine after I applied all the updates. Run
uname -a to test what your kernel version is, run
sudo apt-get update && sudo apt-get upgrade to update your system.
I did not have a chance to test it under Mac. Let me know if you can do that, I will throw one in for you for free with your order.
Windows drivers can be downloaded here: http://www.sah.co.rs/lx08h.html
|Shipping Rate||First item||Additional items|
AB Lietuvos paštas: Nonregistered
DHL: DHL Express
Henry | March 11, 2019
Dominik | Nov. 24, 2018
Ryan | June 25, 2018
Daniel | May 31, 2018
Simon | April 12, 2018
Guttorm | March 26, 2018
Mike | Sept. 22, 2017
We recognize our top users by making them a Tindarian. Tindarians have access to secret & unreleased features.
We look for the most active & best members of the Tindie community, and invite them to join. There isn't a selection process or form to fill out. The only way to become a Tindarian is by being a nice & active member of the Tindie community!