
Know it
The soil humidity sensor will help you to know who much water is in the soil so you can know when is the best time to water the plants.
Imagine if you also used a water pump with this sensor, then each time the plant is thirsty, the pump will automatically water the plant. while you relax and drink your karak!
Wire it
The soil sensor needs only three wire connections, two for power and one for moisture level.
You will need:
Jumper Wires
Soil moisture sensor
Arduino board and USB connector

Connections:
Arduino pin GND â Soil moisture sensor GND pin
Arduino pin 5V â Soil moisture sensor VCC pin
Arduino pin A0 â Soil moisture sensor A0 pin
Code it
This is a simple sketch to read humidity/moisture level of the soil and display is on a the serial monitor on Arduino IDE.
Learn from this code how to read from the soil sensor and then use it in your gardening project!
/*
Knowing how much water is in the soil of a plant
Tutorial link: https://www.learn.voltaat.com/post/soil-sensor
sketch was written by Voltaat Store
This is a simple sketch to read humidity/moisture level of the soil and display is on a the serial monitor on Arduino IDE
Components Needed: 1. Soil moisture...x1
Connections:
- Arduino pin GND â Soil moisture sensor GND pin
- Arduino pin 5V â Soil moisture sensor VCC pin
- Arduino pin A0 â Soil moisture sensor A0 pin
*/
int soilMoisturePin = A0;// The pin that DHT11 is connected to: Pin A0
int moistureLevel ;// To store the moisture level of the soil
// This routine run once
void setup()
{
Serial.begin(9600); //opening the serial monitor
}
// This routine loops forever
void loop()
{
moistureLevel = analogRead(soilMoisturePin); //read from the sensor and store in the moistureLevel variable
Serial.print("Moisture Sensor Value: ");
Serial.println(moistureLevel); //display on the serial monitor the moisture level
delay(200); // delay for 200 mili sec and then read again
}