Average rainfall 2001-2016, global tropics

Map: Average rainfall 2001-2016, global tropics

sensor: RS485 steel-pin soil moisture probe

Introduction

SEEED-studio offers an industrial-grade RS485 MODBUS-RTU Soil Moisture and Temperature Sensor - S-Soil MT-02A. It is a field ready probe with 3 stainless steel pins, an IP68 grade resin sealed and watertight body with integrated electronics. The more advanced version, S-Soil MTEC-02A also senses electrical conductivity.

These kind of steel-pinned field sensors have only recently become available for 5 volt systems. Probes with the same basin design are now available also for sensing soil Nitrogen (N), Phosphorus (P) and Potassium (K), and pH. Further, sensors for almost any combination (temp-sm-ec, NPK, pH) are now available. Note that these kind of sensors are available for using different communication standards and protocols. xSpectre’s spectrometer+ are built for using the RS485 MODBUS-RTU protocol and standard.

Versions and vendors

As noted above SEEED-studio offers two versions, one for soil moisture and temperature (temp-sm) and one for soil moisture, temperature and electric conductivity (temp-sm-ec). In August 2021, both versions were available from elfa. The costs are approximately 100 USD for the more advanced including ec and 80 USD for the temp-sm.

Sensors with identical design, down to the label, are also available on AliExpress. The Aliexpress prices for these probes varies. But the temp-sm-ec sensor that I got from the seller ComWinTop operates exactly like the SEEED studio version, but at only 33 USD (1/3 of the SEEED studio price).

RS485 MODBUS-RTU steel-pin field sensor for temperature, soil moisture and electric conductivity.

GitHub code

https://github.com/Miceuz/rs485-moist-sensor

Project

Arduino project setup for soil moisture and temperature. The project is modelled after DIY Soil EC Salinity Meter using Arduino & Soil EC Sensor.

Youtube tutorial

TUTORIAL: How To Use RS-485 TTL MODBUS - Arduino Controller Module (Part 1/2 - Wire Up)

TUTORIAL: How To Use RS-485 TTL MODBUS - Arduino Controller Module (Part 2/2 - Wire Up) Solar

Setup of SEEED/SENSECAP Soil Moisture & Temperature & EC Sensor

The communication between Arduino and the temp-sm/temp-sm-ec probes uses the RS485 hardware protocol. The data transfer uses the MODBUS-RTU standard with the Arduino microcontroller acting as the master and the sensor as the slave.

Wiring (RS485)

The RS485 has 4 ports that connect to pins on the Arduino board (the master in this project):

port id port function typical connection pin
DI Driver (Transmitter) In TX
DE Driver (Transmitter) Enable D3
RE Receiver Enable D2
RO Receiver Out RX

When RE = DE = 0 Receive signal mode When RE = DE = 1 transmit signal mode

The RS485 also has 4 ports for connecting to the slave:

port id port function
Vin Power
B data pin
A data pin
GND Ground

Vin is usually 5v. The data pins A and B are usually given in the documentation of the slave. the connections are given related to the colors of the sensor cables. As the colors can vary you need to consult the documentation for the particular model you have.

Register

To access the sensor readings the user must know the how the MODBUS Register is defined in the particular device that is connected. The complete MODBUS register for the SEEED/SENSECAP sensor is given on page 8 in the manual. Note that for some, but not all, probes of this kind the registry contains a dozen read/write parameters that can be changed and read - (see section below on Default communication settings). The tables below refer to the default settings of the temp-sm-ec sensor for SEEED studios. Summary of the read only (sensor) registers:

Abbr Parameter Reg adress (HEX/DEC) Parameter type unit accuracy
Temp Temperature 0x0000 /0 INT16 Celsius 0.5
VWC Volumetric Water Content 0x0001 /1 UINT16 vol/vol 3
EC Electrical Conductivity 0x0002 /2 UINT16 μS/cm 3%
Salinity Salinity 0x0003 /3 UINT16 mg/L 3%
TDS Total Dissolved Solids 0x0004 /4 UINT16 TDS 3%
Epsilon Dielectric Constant 0x0005 /5 UINT16 DiConst 3%

As the retrieved data is in integer format, some of the parameters are multiplied with a factor before sent to to receiver:

Abbr Min Max Factor
Temp -40 80 100
VWC 0 100 100
EC 0 20000 1
Salinity 0 20000 1
TDS 0 20000 1
Epsilon 0 8200 100

Default communication settings

The default MODBUS dialect set in the SEEED/SENSECAP sensor is MODBUS RTU (Remote Terminal Unit). It can be changed to MODBUS ASCII, but that should not be needed.

The SEEED/SENSECAP sensor comes with default communication setting (see the manual page 5 under the heading Wiring, the communication default settings are given under the green cable); or on page 7 under the heading 5 Modbus Communication Protocol:

parameter setting
BPS 9600
start bit 1
parity no parity
stop bit 1

The default address of the SEEED/SENSECAP sensor is 1 (see manual page 12 SLAVE ADDR).

These settings are stored in the EEPROM (Electrically Erasable Programmable Read Only Memory), and can be changed.

Resources

Datasheet for for the latter.

https://www.faranux.com/product/soil-npk-sensor/

https://forum.arduino.cc/t/modbus-npk-sensor-does-not-respond-at-all/898377

https://lastminuteengineers.com/soil-npk-sensor-arduino-tutorial/