How to use the Soil Moisture Sensor with Arduino
How to use the Soil Moisture Sensor with Arduino
INTRODUCTION
Soil moisture sensors measure the volumetric water content in the soil. The relation between the measured property and soil moisture can be calibrated and vary depending on environmental factors such as soil type, temperature, etc.
APPLICATIONS
The soil moisture sensor can be used in Agriculture – To find the fertility of soil, Construction – To estimate the quantity and quality of building materials and also planning and maintaining landscape irrigation.
WIRING DIAGRAM
GND – GND
VCC – 5V
A0 – Analog Pin A0
D0 – Digital Pin 5
CODE
int sensor_pin = A0; int output_value ; void setup() { Serial.begin(9600); Serial.println("Reading From the Sensor ..."); delay(2000); } void loop() { output_value= analogRead(sensor_pin); output_value = map(output_value,550,0,0,100); Serial.print("Mositure : "); Serial.print(output_value); Serial.println("%"); delay(1000); }
END RESULT
Open the serial terminal. Dip the nobs of the sensor in soil to find its moisture.
ADDITIONAL RESOURCES
https://www.instructables.com/id/Arduino-Soil-Moisture-Sensor/