DIY Soil Moisture Sensor Project Using Arduino for Kids - Smart Gardening Meets STEM
This article titled "DIY Soil Moisture Sensor Project Using Arduino for Kids - Smart Gardening Meets STEM" is part of the "Learn Robotics with CYFI" knowledge series by NESTA TOYS.
Article summary: What if your Arduino could tell you exactly when a plant needs water? The CYFI Soil Moisture Sensor project reads live moisture levels from soil and prints Soil is DRY or Soil is WET on your screen every single second. No guessing, no overwatering, just real science that connects directly to smart farming technology used across India today.
This educational content focuses on coding, robotics, computational thinking, STEM learning, and technology education for students, parents, educators, and schools.
CYFI by NESTA TOYS is a structured learning platform that combines block-based programming, robotics simulations, hands-on activities, and a gradual transition to text-based coding using Python and C++.
What if Your Arduino Could Tell You When a Plant Needs Water?
Think about the last time someone forgot to water a plant and it wilted. Or overwatered one and drowned it. What if a small sensor stuck in the soil could monitor moisture levels and tell you exactly when to water? That is what this CYFI project does, and it is one of the most practical things a child can build with an Arduino.
The soil moisture sensor reads how wet or dry the soil is and sends that information to the Arduino as a number between 0 and 1023. The Arduino then checks that number against a threshold you set in the code. Above the threshold? It prints Soil is DRY on your laptop screen. Below it? Soil is WET. Every single second, automatically.
This is not just a school project. Smart irrigation systems that water crops only when the soil actually needs it are already being used by farmers across India to save water and improve crop yields. Your child is building the core technology behind that at home, on a kitchen table, with three wires and ten lines of code.
Get your CYFI soil moisture sensor kit at cyfi.nestatoys.com and follow along with this guide step by step.
For parents: India loses billions of litres of water every year to over-irrigation in agriculture. Smart moisture sensing is one of the key technologies being used to fix this. Your child is not just doing a STEM project. They are learning about a real environmental solution.
What STEM Skills Does Your Child Learn by Building a Soil Moisture Sensor Project?
This project teaches something the other sensor projects do not. The difference between analog and digital sensing. Every previous project in this series used digitalRead, which gives only two answers, HIGH or LOW, on or off. This project uses analogRead, which reads a continuous range of values from 0 to 1023. That is a much more powerful and realistic way to measure the world.
Here is what your child walks away understanding after building this:
- How a soil moisture sensor measures electrical conductivity in soil and water
- What analogRead means and why it gives more useful information than digitalRead
- How to set a threshold in code and write conditions based on it
- How the Serial Monitor can be used to monitor live data over time
- How to interpret sensor readings and adjust them for different conditions
- How real-world smart farming and irrigation systems use exactly this technology
Parent note: When your child changes the dryThreshold value in the code from 600 to something else and sees the output change, they are doing exactly what a data scientist or agricultural engineer does. They are calibrating a sensor to match real-world conditions. That is genuine scientific thinking.
What Components Do You Need to Build a Soil Moisture Sensor With Arduino?
This is one of the simplest builds in the entire CYFI series. There is no breadboard, no LED, no buzzer. Just a sensor, three wires, and an Arduino. Everything is available in the
Everything is available in the CYFI kit from cyfi.nestatoys.com. Each component is beginner safe, low voltage, and suitable for kids age 8 and above.
- The soil moisture sensor probe: This is the long forked metal probe you see in the circuit image, inserted into the glass of water. It has two metal prongs that measure how well electricity flows through the soil or water between them. Wet soil conducts electricity better than dry soil, and the sensor uses this difference to produce a reading.
- An Arduino Uno: The brain of the project. It reads the analog value from the sensor on pin A0, checks it against the threshold in the code, and sends the result to your laptop via the Serial Monitor. Everything happens once per second thanks to the delay(1000) at the bottom of the loop.
- Jumper wires (3 wires): One red wire for power, one green wire for ground, and one wire for the analog signal back to pin A0. That is the entire wiring for this project. Three wires total.
- A laptop and USB cable: Powers the Arduino and runs the Serial Monitor where all the moisture readings and soil status messages appear in real time. This is the only output in this project, so keeping the Serial Monitor open during testing is important.
Fun fact - Pure water actually conducts electricity very poorly. It is the minerals and salts dissolved in water and soil that make them conductive. When you stick the soil moisture sensor into dry sandy soil versus rich dark garden soil, you will get very different readings because of the different mineral content. Try it and see.
How Do You Connect a Soil Moisture Sensor to Arduino? Full Wiring Guide
This is the easiest wiring in the whole CYFI series. Three connections. No breadboard required. Connect directly from the sensor module to the Arduino pins as shown in the table below. Use the circuit diagram image from your CYFI kit as a visual reference alongside this table.

|
From (Sensor) |
To (Arduino) |
Wire Colour |
In Simple Way |
|
VCC |
5V pin |
Red |
Powers the sensor |
|
GND |
GND pin |
Green |
Completes the circuit |
|
AOUT / SIG |
Pin A0 |
Blue or Yellow |
Carries the moisture reading to Arduino |
One thing to check before testing. Pin A0 is on the ANALOG IN section at the bottom right of the Arduino Uno board. Make sure you connect the signal wire here and not to a digital pin. Analog pins and digital pins look similar but are in different sections of the board.
Quick tip: Test the sensor in a glass of water first before putting it in soil. You will see a low moisture reading around 200 to 400 in water, which means wet. Then lift it out of the water and watch the number climb above 600, which means dry. This quick test confirms your wiring is correct before you touch any soil.
How Does a Soil Moisture Sensor Work? The Science Behind the Numbers
This project teaches something new compared to all the other sensor projects. Instead of getting a simple yes or no, you are getting a number. A measurement. And understanding where that number comes from is the most interesting part.
The sensor measures electrical conductivity
The two metal prongs of the soil moisture sensor act like two ends of an incomplete circuit. When you insert them into dry soil, almost no electricity can flow between them because dry soil is a poor conductor. When the soil is wet, water fills the gaps between the soil particles and allows electricity to flow more freely. The sensor measures how easily electricity flows and converts that into a number.
analogRead gives you 1024 possible values
Unlike digitalRead which gives only 0 or 1, analogRead on pin A0 gives a number anywhere between 0 and 1023. Very wet soil or water gives a low number, around 200 to 400. Completely dry soil gives a high number, close to 900 or above. Everything in between is a shade of moist. This is what makes the project genuinely useful rather than just a yes or no detector.
The threshold decides what counts as dry
In the code, dryThreshold is set to 600. If the moisture reading is above 600, the Arduino prints Soil is DRY. If it is at or below 600, it prints Soil is WET. This threshold is not fixed. Different soils, different plants, and different sensors will need different threshold values. Part of doing this project properly is finding the right threshold for your specific setup through testing.
The Serial Monitor shows you live data every second
The delay(1000) at the bottom of the loop means the Arduino takes a fresh reading every 1000 milliseconds, which is once per second. Every second the Serial Monitor prints the raw moisture number, then whether the soil is DRY or WET, then a line of dashes to separate each reading. This makes it very easy to watch the readings change in real time as you move the sensor between wet and dry conditions.
Here is the complete code. Read through the comments carefully. Each one explains exactly what that line is doing.
// Soil moisture sensor pin const int sensorPin = A0;
// Change this after checking your readings const int dryThreshold = 600;
void setup() {
Serial.begin(9600); // start serial monitor
}
void loop() {
// Read moisture value (0–1023) int moisture = analogRead(sensorPin);
// Print value
Serial.print("Moisture: ");
Serial.println(moisture);
// Check condition if (moisture > dryThreshold) {
Serial.println("Soil is DRY");
} else {
Serial.println("Soil is WET");
}
Serial.println("-------------------");
delay(1000); // wait 1 second
}
The most important line to understand is analogRead(sensorPin). This is what makes this project different from all the previous ones. It reads a continuous value rather than a simple on or off. That single function opens up a completely different category of sensor projects that your child can explore next.
Think about this - The number 600 as the dryThreshold is just a starting point. Stick the sensor into the actual soil of a plant you want to monitor, note the reading when the soil feels right, and set that as your threshold. That process of observing, measuring, and adjusting is exactly what scientists and engineers call calibration.
How Can Kids Use This Soil Moisture Sensor Project for School Science Fair or STEM Exhibition?
This is one of the most relevant and impressive projects you can bring to a school science fair. It connects directly to topics like water conservation, smart agriculture, and environmental science. Those are topics that judges and teachers genuinely care about.
Here is how to go from a working build to a standout project
Getting the code uploaded
Download Arduino IDE for free from arduino.cc. Paste in the code from Section 5. Connect the Arduino to your laptop via USB. Go to Tools then Board then Arduino Uno, select the correct COM port, and click the upload arrow. Open the Serial Monitor at 9600 baud immediately after. You will see moisture readings printing every second.
Calibrating your sensor before the exhibition
This step is what separates a good project from a great one. Dip the sensor prongs into a glass of water and note the reading. Then hold it in dry air and note that reading. Then push it into the soil of a plant when it is freshly watered and note that reading too. Use these three readings to decide what your dryThreshold should actually be for your specific sensor and soil type. Change the 600 in the code to your calibrated number and upload again.
Demonstrating it live at your stall
Bring a small pot of soil to your exhibition stall. Start with dry soil and show the reading on the Serial Monitor. Then pour a small amount of water in and show how the number drops and the message changes from Soil is DRY to Soil is WET in real time. That live transition from one state to another is what makes audiences stop and pay attention.
Writing a project report that stands out.
A strong report on this project should cover these points:
- The real-world problem you are solving, which is water waste from over-irrigation in homes and agriculture
- What each component does and how they connect together
- The difference between analogRead and digitalRead and why it matters for this project
- Your calibration results showing the moisture values for dry soil, wet soil, and water
- What you would add next time, for example an automatic pump or an alert when the soil gets too dry
5 Ways to Take This Arduino Soil Moisture Project Further
- Connect a small water pump to the Arduino so it automatically waters the plant when the soil gets too dry
- Add an LED or buzzer that triggers when the moisture reading crosses the dry threshold
- Add a second sensor in a different pot and compare the moisture levels of two different soils side by side
- Log the moisture readings over an hour and draw a graph showing how quickly the soil dries out
- Connect a small LCD screen to display the moisture level and DRY or WET status without needing a laptop
From CYFI Smart irrigation is one of the fastest growing areas of agricultural technology in India. Students who understand how soil moisture sensing works have a genuine head start in fields like agricultural engineering, environmental science, and IoT product development. This little probe in a glass of water is the beginning of something much bigger.
Frequently Asked Questions About the Soil Moisture Sensor Arduino Project
What does the number from analogRead actually mean?
A lower number means more moisture. A higher number means less moisture. In most setups, a reading of around 200 to 400 means the sensor is in water or very wet soil. A reading above 700 usually means the soil is quite dry. The exact numbers vary by sensor and soil type, which is why calibrating your own threshold is important.
Why is my moisture reading always showing a high number even in water?
Check that the signal wire is connected to pin A0 and not a digital pin. Also check that VCC is connected to 5V. If both are correct, try a different wire for the signal connection as a loose or damaged wire can cause incorrect readings.
Can I use this sensor in actual garden soil outside?
Yes. The sensor is designed for use in real soil. Just make sure the wires connecting it to the Arduino are long enough to reach. For outdoor use you will want to protect the Arduino from moisture, but the probe itself is designed to be in soil.
How do I change the threshold to match my soil?
Dip the sensor in water and note the reading. Then hold it in dry air and note that reading. Pick a number somewhere between the two as your threshold and replace 600 in the code with your number. Upload the code again and test to see if Soil is DRY and Soil is WET appear at the right moments.
Is this project good enough for a school science fair?
Absolutely. The connection to water conservation and smart agriculture makes this project relevant and impressive to judges. Bring a live demo with a pot of soil, show the readings changing as you water the plant, and explain the difference between analog and digital sensing. That combination of live demonstration and scientific explanation is what wins awards.