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

| 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
- Connect the probe to the soil module with its short cable.
- Wire the soil module and the buzzer module as in the diagram.
- Upload the code and open the Serial Monitor at 9600 baud.
- 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'sWET. - 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_PERCENTto 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
DRYandWETvalues 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