How to Use Soil Moisture Sensore Using Arduino
by MrSottong in Circuits > Arduino
484 Views, 4 Favorites, 0 Comments
How to Use Soil Moisture Sensore Using Arduino
Soil Moisture sensor is a sensor that can be used to measure moisture in the soil. Suitable for making prototypes of Smart farming projects, Irrigation controllers projects , or IoT Agriculture projects.
This sensor has 2 probes. Which is used to measure soil resistance.
When the soil is moist or wet the resistance will be different than when the soil is dry. The sensor will read the resistance in each circumstance and convert it into humidity data.
Required Components
The following components are required:
- Soil Moisture Sensor
- Arduino Nano
- Wire Jumper
- USB mini
- A bottle of water
Assemble All Components
Connect the Arduino board to Soil Moisture Sensore. See the picture or instruction that I wrote below:
Soil Moisture to Arduino
VCC ==> +5V
GND ==> GND
AO ==> A0
Make a Sketch
Soil moisture sensors can be directly read without using an additional library. You can use analog input to read the sensor value.
This is the Sketch that I made to read the sensor value:
int sensorPin = A0; // select the input pin for the potentiometer
int sensorValue = 0; // variable to store the value coming from the sensorvoid setup() {
Serial.begin(9600); }
void loop() { // read the value from the sensor: sensorValue = analogRead(sensorPin); Serial.println(sensorValue); delay(1000); }
or download the file I include below
Downloads
Results
When I put the sensor outside the bottle, the displayed value is around 700 to 1023.
When I put the sensor in a water bottle, the displayed value is around 250 to 700.
can be concluded that:
- a value of 250 to 700 means moist
- value 700 to 1023 means dry
You can calibrate it, when you try it