IOT Plant of Capacitive Soil sensor with ESP32.

As a hardware developer,i have tested bunch of soil sensors,most of them not to my satisfactory when it be put in a real-life senario.problem occures,such as oxidizing of sensor.no water-proof protection.etc.so when the water-proof one appeared in my eyes,i immediately decided to take one.This project used ESP32 as control board,a big RGB LED bar to reflect the moisture level,and the real-time value will be send to Adafruit.io Cloud platform for further analytical job,the demo video is below:

Shanno Gada
3 min readOct 15, 2020

https://www.bilibili.com/video/BV1WK411P7QR/

Step 1:Results will be achieved

once you put the sensor’s tip into the water,the RGB led turn into YELLOW.once the sensor being pullout of water.the RGB turns to BLUE。the feedback value will be send to Adafruit IOT through MQTT.

Step 3:hardware list

(1)ESP32

(2)DFRobot’s water-proof soil sensor

(3)some wires

(4)5v lipo battery

(5);USB cable

(6);DFRobot’s RGB led

Step 4:initial test

soil sensor’s sensitivity is good,no delays in sampling.

Step 5:actual photos of my work

Step 6:Summary

The RGB led is a media to reflect the soil sensor’s feedback value.in my case , i just dipped the 1/3 part of sensor into water.so my reference value is 350.that means i’ll take 350 as reference line.below it the RGB shows BLUE,above it shows YELLOW.the IOT part is a record of incoming data‘s activity.

Step 7:Wiring Diagram

The ESP32 i am using is DEVKIT v1-DOIT.you must take reference of your own ESP32.different ESP32 boards pinout may different.

soil sensor’s data=ESP32's A0

RGB LED pins connection is below:

uint8_t LedR = A4; // GPIO32
uint8_t LedG = A5; // GPIO33
uint8_t LedB = A18; // GPIO25

For coding ,use the below code to testout the sensor’s AIR and Moisture reference value.mine AIR ref value=600,Moisture ref value=400.more refer to below product WIKI.https://wiki.dfrobot.com/

https://wiki.dfrobot.com/Waterproof_Capacitive_Soil_Moisture_Sensor_SKU_SEN0308

Serial.begin(9600); // open serial port, set the baud rate to 9600 bps
}
void loop() {
Serial.println(analogRead(A0)); //connect sensor and print the value to serial
delay(100);
}

The complete code is below:

As the WIKI indicated.you have to record the AIR analog value from Serial COM,say 550.it depends on your sensor.how deep you plan to dip your sensor into the water.you shall dip it between”Recommend Depth”and ”Warning Line”from the scale on the sensor.when the feedback is 0,which represents 100%humidity reading.

As for Adafruit IOT part.first go to site:io.adafruit.com regester your free account,the complete procedure is recorded in the demo video.

--

--

Shanno Gada

Enterpreneure,Arduino,Raspberry pi hacker.love IOT,AR,AI and making small gadgets.