กลับไปหน้ารวมไฟล์
soil-moisture-sensor-comple-guide-b9c82b.md

I recently posted a tutorial on YouTube explaining everything you can read in this article. If you are interesting at watching it, here is the video.

THEORY

A soil moisture sensor is a tiny device that measures the water level in soil. They can work alone or in automated systems for real-time monitoring, making them crucial for several applications in agriculture, gardening, environmental monitoring, and more.

There are different types of sensors, but we can divide them in two groups: resistance-based and capacitance-based.

The resistance-based devices have two electrodes. When inserted into the soil, these sensors measure the electrical resistance between the electrodes. As the soil moisture increases, its conductivity also increases, so the resistance between the electrodes go down. Then, this change in resistance is converted into a moisture reading.

On the other hand, the capacitance-based sensors measure the dielectric permittivity of the soil. The presence of water in the soil changes its dielectric permittivity, which in turn affects the capacitance of the sensor. Later, this change is measured to determine the soil moisture.

Now that you understood the principles behind these sensors, it's time to see them working on real projects.

PROJECTS

First, we’ll build a simple soil moisture monitor with Arduino, according to this schematics .

Soil moisture monitoring schematics available on Tinkercad.

Here’s what you need:

  1. Arduino board
  2. Breadboard
  3. Jumper wires
  4. Resistance-based soil moisture sensor
  5. Three LEDs (red, yellow, green)
  6. Three 220 ohm resistors
  7. Glass of water

Connect the 5V and GND ports of the Arduino to the breadboard. Attach the sensor power supply pins to the 5V and GND rows and the signal pin to A5. Set up the LEDs with resistors on the breadboard, connecting them to GND and ports 2, 3, and 4.

Then, access the GitHub repository of this project or go to the end of this article and download the soil-moisture-monitoring.ino file and upload it to Arduino.

Let's see our project working. After diving the sensor legs completely into the glass of water, we have an extremely wet situation. Diving only a small part of the sensor, gives us the wet scenario and the system responds accordingly. Now if we remove the sensor from the water, the reading value is so low that the red LED is turned on, indicating a extremely dry scenario.

While resistance-based sensors are cheaper, they suffer from corrosion and, therefore, have a short lifespan. That’s why you should not use them in real-life applications. On the other hand, the capacitance-based sensors are usually more expensive, but they are more durable because of the way they work and are manufactured.

Now that you understood the main differences between these types of sensors, let's get our hands dirty again. We are going to create an irrigation system using a capacitance-based sensor, as you can see in this schematics .

Irrigation system schematics available on Tinkercad.

For this project, you’ll need:

  1. Arduino board
  2. Battery support
  3. Batteries
  4. Breadboard
  5. Capacitance-based soil moisture sensor
  6. 5V relay module
  7. Small pump
  8. Glass of water
  9. Plant
  10. Wires

Connect the relay module to the Arduino and power it with batteries. Attach the water pump to the relay. Connect the soil moisture sensor to the Arduino, and place the sensor in the soil and the pump in water. Upload the irrigation-system.ino file and watch your automated irrigation system in action.

As you may noticed, every time we send a signal from Arduino port 2, the relay will close the water pump circuit and, then, water will flow to irrigate the plant. When we stop this signal, the water pump will turn off. The sensor readings will inform Arduino when is the right time to start or stop the signal from port 2.

If you power the Arduino board continuously and add water to the reservoir from time to time, your irrigation system will work non-stop. That's the principle at building fully automated irrigation systems.

CONCLUSION

Thank you for reading all this tutorial. If you liked it, you will probably enjoy the article I wrote about ultrasonic sensors and how to build an alarm system with them.


🛠️ เจาะลึกเบื้องหลังการทำงาน (Deep Dive / Technical Analysis)

The Soil Moisture Sensor (Resistive type) is a simple but effective way to start with plant automation. It allows you to monitor the health of your indoor garden by measuring how easily electricity flows through the soil.

Interaction Logic

The project uses a simple probe that you insert into the soil:

  1. The Signal: Dry soil has high resistance, while wet soil conducts electricity better.
  2. The Goal: The Arduino converts this into an analog reading (0 to 1023).
  3. Thresholds: You can set an "Alert" value—for example, if the reading drops below 300, a red LED flashes to tell you the plant is thirsty.

Components List

  • Arduino Uno/Nano: The logic brain.
  • Resistive Soil Moisture Sensor Module: The primary hardware.
  • LEDs (Red/Green): To show "Thirsty" vs "Saturated" states.
  • Piezo Buzzer (Optional): For an audio reminder to water your plants.

Maintenance Tip

Note that because this sensor is "resistive," electricity flowing through the probes causes electrolysis, which leads to corrosion over time. To make your sensor last longer, only power it up when you are actually taking a measurement (once an hour) rather than leaving it on constantly.

ข้อมูล Frontmatter ดั้งเดิม

title: "Soil Moisture Sensor - Complete Guide"
description: "We are going to dive into the world of soil moisture sensors. I’ll show you how they work, the different types, and how to assemble them with Arduino. Plus, we’ll build two amazing projects together to exercise what we have been learning so far."
author: "lucasfernando"
category: "Sensors & Environment"
tags:
  - "Environmental Sensing"
  - "Monitoring"
  - "Garden"
views: 85460
likes: 11
price: 79
difficulty: "Easy"
components:
  - "1x Soil Moisture Sensor"
  - "3x Resistor 220 Ohm"
  - "1x Capacitive Soil Moisture Sensor"
  - "1x Water Pump"
  - "1x Breadboard - 830 contacts"
  - "3x 5V LED"
  - "1x Arduino Uno board"
  - "1x Jumper wires (generic)"
  - "1x 4 AA battery holder + battery"
  - "1x 1 relay module 5 Vdc 10A (assembled)"
tools: []
apps:
  - "1x Arduino IDE"
  - "1x TINKERCAD"
downloadableFiles:
  - "https://projects.arduinocontent.cc/6f39a9bf-9d38-4a1c-af27-cdd238525341.ino"
  - "https://projects.arduinocontent.cc/63fdc697-24f5-4cf9-839d-7a52648577c6.ino"
documentationLinks: []
passwordHash: "d5c7c818591ffcf5bf54d595793d1fb0ddbf7be9fdbe0f5424de6a20a112f3bd"
encryptedPayload: "U2FsdGVkX19CQhJnqBw4Us1TxdMaSsqQNDiR5YNraeaEOwPcLwOqSoyJ+j/Kl7LLAVQ4P1OV9Hh4qd6caaS3k6d+hPHM6mU1bBeCB/jFh/BxV+yW21HoJCiE8m+lUZZOICpMwFVpeWcPh/BokbuDp4Accm5Ywgm1HstQHjRJubiL0M5ipoxT6Q8QsPgxNM+b/yOEJiCO+5z3ujk4dbE/5YnLyzkTUqU3u+cAV5I3t32I4SHfYRWRzAxPuXTi3+FYN+yhWuhU8DCM5To72EBv0Q=="
seoDescription: "Master Soil Moisture Sensor with Arduino: learn how they work, explore different types, and build two practical projects in this complete guide."
videoLinks:
  - "https://www.youtube.com/watch?v=C_OxBOmjZ-k"
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/soil-moisture-sensor-comple-guide-b9c82b_cover.jpg"
lang: "en"