মূল বিষয়বস্তুতে যান
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
Open in Lab
ESP32-WROOM-32: The metal can holds the ESP32 chip, 4 MB flash and the 40 MHz crystal. The top part is the PCB antenna — keep it clear of metal.ESP32-WROOM-32Antenna: Printed Wi-Fi/Bluetooth antenna.Micro-USB: Upload sketches, open the Serial Monitor and power the board (5 V).USB-UART: CP2102 or CH340 chip that turns USB into the ESP32's serial port.EN: Reset button (pulls EN low).BOOT: Holds GPIO0 low; press it while uploading if the upload tool can't enter boot mode.LED (GPIO2): Built-in blue LED on GPIO2 on most DevKit V1 boards.3.3 V regulator: AMS1117 regulator: 5 V → 3.3 V.35%220 Ω+

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.