Use a Moisture Sensor with Arduino
This sensor allows you to read the moister in soil
Written By: Cherie Tan
![](https://files.littlebird.com.au/guides/70_poster.png)
![Dash icon](https://fast.littlebird.com.au/static/guides/dash.webp)
Difficulty
Easy
![Steps icon](https://fast.littlebird.com.au/static/guides/steps.webp)
Steps
7
In this guide, you will learn how you can use a moisture sensor with an Arduino, to determine the amount of moisture in a substance.
After completing this guide, you could create an Arduino plant watering system or a simple moisture detector for your beloved garden plants.
![](https://files.littlebird.com.au/guides/550_img1.png)
Connect the Probe to the Breakout Module.
The order of the wires doesn't matter.
![](https://files.littlebird.com.au/guides/551_img1.png)
Connect the 5V line from the Arduino to the Module.
![](https://files.littlebird.com.au/guides/552_img1.png)
Connect the Ground line from the Arduino to the Module.
int ledPin = 13; // Wet Indicator at Digital Pin D13 int sensor = 0; // Soil Sensor input at Analog Pin A0 int value = 0; void setup() { Serial.begin(9600); pinMode(ledPin, OUTPUT); Serial.println("SOIL MOISTURE SENSOR"); Serial.println("-----------------------------"); } void loop() { value = analogRead(sensor); value = value / 10; Serial.println(value); if (value < 50) { digitalWrite(ledPin, HIGH); } else { digitalWrite(ledPin, LOW); } delay(1000); }
Copy this code and load it into the Arduino IDE and Upload it
Open the Serial Monitor
Out of moist soil you should get a reading around 100
Once in moist soil or a glass of water you should get <40