Back to projects
Tier 3 · Code the Real WorldmediumAge 10+45 min

Plant-Watering Reminder

Stick the probe in your plant. When it’s too dry, the buzzer beeps.

What you’ll learn

  • Reading an analog sensor with analogRead() (0-1023).
  • Setting a threshold from a real-world reading.
  • Building something genuinely useful for a person you care about.

What you need

ItemQty~CostWhere to buy
Arduino Uno (or Nano clone)1GHS 120.00
Online — official Uno is ~GHS 375; a Nano clone is ~GHS 75.
USB cable for the board1GHS 15.00
Probably already in the kit.
Soil-moisture probe (capacitive preferred)1GHS 30.00
Online.
Capacitive lasts longer than resistive.
Piezo buzzer1GHS 15.00
Online.
Half-size breadboard + jumpers1GHS 30.00
Online.
Total~GHS 210.00

Build it step by step

  1. Wire the probe

    VCC → 5V; GND → −rail; SIG → A0.

  2. Wire the buzzer

    D8 → buzzer + ; buzzer − → −rail.

  3. Calibrate

    Open Serial Monitor. Probe in dry soil — note the number. Probe in wet soil — note the number. Set the threshold halfway between.

  4. Edit the THRESHOLD constant

    Replace 500 with your half-way number, re-upload.

  5. Plant it

    Push the probe gently into the soil. Buzzer stays quiet while wet, beeps when dry. Water the plant.

How it works

analogRead(A0) returns 0 (zero volts) to 1023 (full 5 V). The moisture probe is a voltage divider that changes its output based on how conductive the soil is — wet = lower number, dry = higher. Compare against a threshold and beep accordingly.

If something’s not working

Always beeps
  • · Threshold is too low — your "dry" reading is below it.
  • · Probe isn’t actually in the soil.
Never beeps
  • · Threshold too high. Or you wired the probe’s SIG to a digital pin instead of A0.

Try this next

Add an LED that fades from green (wet) to red (dry).

Schedule the check — only beep once per hour, not constantly.

The code

Paste this into the Arduino IDE and hit Upload. Each line tells the board what to do, in order — the more lines you read, the more you understand.

// Plant-watering reminder
const int PROBE = A0;
const int BUZ   = 8;
const int THRESHOLD = 500;  // calibrate this!

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

void loop() {
  int v = analogRead(PROBE);
  Serial.println(v);
  if (v > THRESHOLD) {
    tone(BUZ, 660, 200);  // dry → beep
  } else {
    noTone(BUZ);
  }
  delay(2000);
}