Plant watering alert

Measure how moist a plant's soil is and get a beep when it's time to water.
  • Level:Beginner
  • Duration: 40 min
  • Ages 10+
  • Platform: Arduino
Community project EEMENTOR team
Plant watering alert – EEMENTOR STEM™ project

Never forget to water your plant again. The soil moisture probe measures how wet the soil is, the UNO turns that into a percentage, and the buzzer beeps every ten seconds when the soil gets too dry. You calibrate it with your own "dry" and "wet" readings, so it works with any pot and soil.

What you need

  • UNO R3 board and USB cable
  • Soil moisture module with fork probe (45-in-1 Sensor Kit)
  • Active buzzer module (45-in-1 Sensor Kit)
  • Breadboard and jumper wires (not included in the Sensor Kit: use the ones from the UNO R3 Starter Kit or any others)
  • A plant pot and a glass of water for calibrating

Good to know

Only the metal fork goes in the soil. Keep the small control board, the wires and the UNO dry. The fork slowly corrodes when it's powered in wet soil, so this project is for learning and short-term use.

Wiring

Breadboard wiring diagram: Plant watering alert
Breadboard view. Check each connection against the wiring table below.
From To
Soil module VCC 5V (breadboard + rail)
Soil module GND GND (breadboard − rail)
Soil module AO (analog out) UNO A0
Soil module DO Not used
Fork probe The two pins on the soil module, using the short cable from the kit
Buzzer module S UNO pin 8
Buzzer module + and − 5V and GND

Pin labels differ between module versions. Always follow the labels printed on your module.

Build it step by step

  1. Connect the probe to the soil module with its short cable.
  2. Wire the soil module and the buzzer module as in the diagram.
  3. Upload the code and open the Serial Monitor at 9600 baud.
  4. Hold the fork in the air and note the reading: that's DRY. Put the fork in a glass of water and note the reading: that's WET.
  5. Enter both numbers in the code, upload again and push the fork into your plant's soil.

The code

const int SOIL_PIN = A0;
const int BUZZER_PIN = 8;

int DRY = 800;              // reading with the probe in the air
int WET = 400;              // reading with the probe in water
const int ALERT_PERCENT = 30;   // beep below this moisture level

unsigned long lastBeep = 0;

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

void beep(int times) {
  for (int i = 0; i < times; i++) {
    digitalWrite(BUZZER_PIN, HIGH);
    delay(120);
    digitalWrite(BUZZER_PIN, LOW);
    delay(120);
  }
}

void loop() {
  int raw = analogRead(SOIL_PIN);
  int percent = map(raw, DRY, WET, 0, 100);   // 0 % = dry, 100 % = in water
  percent = constrain(percent, 0, 100);

  Serial.print("Reading: ");
  Serial.print(raw);
  Serial.print("   Moisture: ");
  Serial.print(percent);
  Serial.println(" %");

  if (percent < ALERT_PERCENT && millis() - lastBeep > 10000) {
    beep(2);
    lastBeep = millis();
  }
  delay(1000);
}

How it works

Water conducts electricity, so the wetter the soil, the more current flows between the two prongs of the fork. The module turns that into a voltage on AO, which the UNO reads with analogRead(). With most modules the reading goes down as the soil gets wetter, so map() uses your own dry and wet readings to turn any value into 0–100 %, whichever direction your module counts.

Make it your own

  • Change ALERT_PERCENT to suit your plant: cacti like it dry, ferns like it moist.
  • Add the RGB LED module to show green, yellow or red for the moisture level.
  • Log the moisture every hour and see how fast your plant drinks.

Troubleshooting

  • The percentage never changes: check that AO (not DO) goes to A0.
  • It shows 100 % in dry soil: your DRY and WET values are swapped.
  • Readings jump around: press the soil firmly around the fork so it makes good contact.

Learn the basics first

New to these parts? These lessons explain them step by step: Build an automatic night light (analog sensors) and Make a tilt alarm with a buzzer.

0 comments

Leave a comment

Please note, comments need to be approved before they are published.

Build it yourself

Get the parts used in this project, tested by our engineers.

UNO R3 Starter Kit | Arduino IDE Compatible | Free Tutorials $56.00

Shop the parts

More projects

  • Pulse visualiser

    • Level:Intermediate
    • Duration: 45 min
    • Platform: Arduino

    by EEMENTOR team

  • Flame alarm

    • Level:Beginner
    • Duration: 40 min
    • Platform: Arduino

    by EEMENTOR team

Community projects

Built something awesome? Share it.

Send us your project and we'll feature it in the hub, credited to you, so other makers can learn from it.

  1. Sign in and tell us about your build
  2. Our team reviews your submission
  3. We publish it in the hub, credited to you