← Back to Basic Projects

πŸ’§ Plant Soil Moisture Alert

Arduino Soil Moisture Sensor tutorial: build an automatic plant watering alarm with a capacitive/resistive sensor and clean Arduino soil moisture code.

πŸ“‹ Overview

Soil moisture sensors measure conductivity between two probes. Wet soil conducts electricity well (low resistance), dry soil doesn't (high resistance). Arduino reads this via analogRead.

Technical Insight: This sensor measures volumetric water content by tracking soil electrical resistance or dielectric permittivity. While resistive sensors are subject to electrochemical corrosion over time, capacitive soil sensors are engineered to last up to 4.5x longer by isolating the sensing trace from direct soil contact.

In simple terms: The dry soil acts as a strong electrical insulator, producing a high analog value. Wet soil conducts easily, producing a low analog reading. The Arduino continuously samples this value and sounds a warning tone if it detects moisture levels have dropped below a custom safety threshold.

What you'll learn: Processing analog sensor inputs, calibrating raw telemetry values, sounding warning alerts with a piezo buzzer, and understanding smart agriculture automation principles.

Estimated time: 30-40 minutes. Difficulty: ⭐⭐ Easy.

🧩 Components Needed

ComponentSpecificationQtyNotes
Arduino Uno R35V1
Soil Moisture SensorCapacitive or resistive1Capacitive lasts longer
Piezo BuzzerPassive 5V1Alert when dry
Breadboard + WiresStandard1

πŸ—ΊοΈ Component Pin Mapping

Plant Soil Moisture Alert Component Pin Mapping Infographic

πŸ“– Step-by-Step Tutorial

1

Connect the Sensor

Sensor VCC β†’ 5V, GND β†’ GND, AOUT β†’ A0.
2

Connect the Buzzer

Buzzer+ β†’ pin 8, Buzzer- β†’ GND.
3

Calibrate

Open Serial Monitor. Note analog values for completely dry soil and wet soil. Set dryThreshold accordingly.
4

Plant It!

Stick the sensor in your plant pot. It will buzz when it needs watering.
πŸ’‘
Resistive sensors corrode over time due to electrolysis. Capacitive sensors are more expensive but last much longer β€” worth the upgrade.

πŸ’» Arduino Code

soil_moisture.ino
INO
// Soil Moisture Alert β€” Volt X
const int sensorPin = A0;
const int buzzerPin = 8;
const int dryThreshold = 600; // Adjust after calibration

void setup() {
  pinMode(buzzerPin, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  int moisture = analogRead(sensorPin);
  Serial.print("Moisture: ");
  Serial.println(moisture);

  if (moisture > dryThreshold) {
    // Dry β€” buzz alert
    tone(buzzerPin, 1000, 500);
    delay(1000);
  } else {
    noTone(buzzerPin);
    delay(500);
  }
}

⭐ Reviews & Ratings

β€”0 reviews
5β˜…
0
4β˜…
0
3β˜…
0
2β˜…
0
1β˜…
0
...

Loading reviews...