Back to Projects
IntermediateESP32 DevKit V1
30 minutes build
ESP32 plant monitor
Watch soil moisture on a 3.3 V board and warn when the plant needs water.
Interactive Simulation
ESP32 plant monitoresp32-devkit-v1
Required Components Checklist
Assembly Steps
1
Power at 3.3 V
Sensor VCC to 3V3 (not VIN), GND to GND, signal to GPIO34 (ADC1, input-only).
2
Calibrate
Note the reading in dry air and in a glass of water, then set DRY_BELOW between them.
3
Alert
Light the LED on GPIO18 when it's dry. (In the simulator a potentiometer stands in for the sensor.)
Arduino Sketch
const int SOIL = 34; // analog sensor on an ADC1 pin
const int ALERT = 18;
const int DRY_BELOW = 1500; // calibrate with your own sensor
void setup() {
Serial.begin(115200);
pinMode(ALERT, OUTPUT);
}
void loop() {
int moisture = analogRead(SOIL); // 0 (dry) – 4095 (wet) in this demo
int percent = map(moisture, 0, 4095, 0, 100);
bool dry = moisture < DRY_BELOW;
digitalWrite(ALERT, dry ? HIGH : LOW);
Serial.printf("moisture %d%% %s\n", percent, dry ? "- water me!" : "- ok");
delay(1000);
}
Challenges & Extensions
Ready to take this project further? Try these challenges:
- •Average 10 readings for a steadier value.
- •Drive a relay for a small pump (with its own supply).
- •Send the value over Wi-Fi on a real board.