Soil Moisture and Temperature Sensor Interface

by FutureElectronicsStore in Outside > Backyard

174 Views, 0 Favorites, 0 Comments

Soil Moisture and Temperature Sensor Interface

cover.png

The sensor is a combination of soil moisture and soil temperature sensors. It has the advantages of convenient carrying, sealing and high precision. It is an ideal choice for soil moisture and soil temperature measurement.

The soil moisture part is a high-precision, high-sensitivity sensor manufactured by high-frequency electronic technology based on the principle of frequency domain reflection. By measuring the dielectric constant of soil, it can directly and stably reflect the true moisture content (volume water content) of various soils. It is the most popular soil moisture measurement method in the world.

The soil temperature is partly composed of the German-class imported Class A ST-1-PT1000 precision platinum resistance and high-precision transmitter. The transmitter part is composed of a power module, a temperature sensing module, a transmission module, a temperature compensation module, and a data processing module, and has high applicability to the use environment.

Supplies

sensor.png
barrel_jack_female.png
DC_adapter_12v_2A.png
uart_ttl_to_rs485_two-way_converter_2.png
UNO_6712d673-f620-4599-ada9-c80f5c80ee65.png
usb-rs485-converter_large.png

Hardware Assembly

pc test.png

First Of All, you need to download on your pc Docklight serial interface to make sure that the sensor is working well.

then Please pay attention the wire connect order:

1.Sensor Red (Brown) wire connect the power positive 5-12VDC

2.Sensor black wire connect the power negative

3.Sensor yellow wire connect the RS485-USB converter RS485A (it shows “A” or “D+” in the converter)

4.Sensor Green(blue) wire connect the RS485-USB converter RS485B (it shows” B” or “D-” in the converter)

Docklight Settings

device port.png
docklight screen.png
settings.png

Ensure that the USB to RS485 driver is installed. If it doesn't appear as shown in the above photo, please install the driver from the following link.

in my situation the USB reserved COMPORT number "COM27" and I will change settings from Docklight settings bar as shown setting.

Send/Receive on Comm: COM27

Baud rate: 9600.

Party Bit: None.

Stop Bit: one.

Data Bits: eight.

then click Ok the save the settings that we had chosen.


Test Sensor on PC

docklight settings.png
data_quary.png
response description.png

using Docklight we are going to test the sensor using the following command

0X01 0X03 0X00 0X00 0X00 0X02 0XC4 0X0B

  • Address to the sensor: 0X01
  • Function code for reading from the register: 0X03
  • Reserved start addresses bytes: 0X00 0X00
  • Reserved number of registers bytes: 0X00 0X02
  • CRC/Modbus 16-bit: 0XC4 0X0B

This command structure is utilized for testing the "soil moisture and temperature" sensor.


and then the sensor response like this.

  • Address: 0X01
  • Function code: 0X03
  • Data length: 0X04
  • Register 0 data high: 0X00Soil Temperature: 15.1 ℃ (Converted from hexadecimal to decimal, divided by 10, using the complement algorithm for negative numbers)
  • Register 0 data low: 0X97
  • Register 1 data high: 0X01Soil Moisture: 35.6% (Converted from hexadecimal to decimal, divided by 10)
  • Register 1 data low: 0X64
  • Low CRC16: 0X4B
  • High CRC16: 0XA4


Arduino Time

Scheme-it-export-Soil-Moisture-and-Temp-2-in-1-2023-11-10-13-26.png
arduino code.png

connect Arduino to pc, then connect RS485 <=> TTL to Arduino as following

RS485 Arduino

VCC 5V

GND GND

TXD 4

RXD 5


and connect RS485 side as following

Sensor RS485

Yellow A+

Green B-

then power up the sensor using adapter 12 V


Sensor Adaptor

Red +12V (core Barrel Socket)

Black GND (shield Barrel Socket)