Kraang Finds
More ▾
Products About
Electronics

Build A Smart Plant Monitor And Auto‑Waterer (ESP32)

A capacitive soil sensor, a tiny pump and a battery-powered ESP32 that waters your plant when the soil dries out and pings your phone when it does.

Published November 21, 2026 · 7 picks

DIY ESP32 plant waterer on a windowsill: soil sensor in a pothos pot, tube from a water bottle and a small project box

Plant-parent communities are full of self-watering tricks, from an upside-down water bottle in the pot to wick systems, and the next step up is a small gadget that actually measures the soil before it waters. This one fits behind a pot: a sensor in the soil, a tiny pump in a water bottle and an ESP32 board on a small battery. It checks the soil every half hour, waters only when it’s dry, and sends a notification to your phone when it does, or when the bottle runs empty. Here’s the whole build, step by step, with the parts for each step below.

Step 1: Plan how it works

The waterer has four parts: a soil moisture sensor in the pot, a reservoir (any clean bottle or jar with a lid), a pump in the reservoir with a tube to the pot, and an ESP32 board with a battery that reads the sensor and switches the pump.

  • The logic. Wake up → read the soil → if it’s drier than your limit and the plant hasn’t been watered in the last six hours, run the pump for a few seconds → go back to sleep.
  • Safety limits first. Each watering is a fixed, short burst. If the soil is still dry half an hour after a watering, the bottle is empty or the tube has slipped out, so the waterer stops and tells you instead of trying again.
  • One sensor per watering zone. One pump can feed two or three pots through tees, but only if they’re similar plants in similar pots. Put the sensor in the one that dries out fastest.
  • Not for every plant. Succulents and cacti want to dry out fully and are better watered by hand. Ferns, herbs, pothos and peace lilies, the ones that sulk when you forget them for a week, benefit most.

Step 2: Seal and place the sensor

The sensor’s probe is coated, but the electronics at the top and the cut edges of the board are not.

  1. Seal it. Brush clear nail polish or conformal coating over the board’s edges and the components at the top. When it’s dry, slide a piece of heat-shrink over the top part and shrink it.
  2. Place it. Push the probe into the soil up to the marked line, halfway between the stem and the pot’s edge, at root depth. Never bury the electronics.
  3. Keep it still. Readings change if the probe wobbles or gets moved, so route the cable so it doesn’t pull on the sensor, and leave it in the same spot.

You’ll calibrate it in Step 5 once the board is wired.

Step 3: Set up the reservoir, pump and tubing

Any clean bottle or jar with a lid works; an opaque one grows less algae than clear glass. A 1–2 liter bottle covers a typical houseplant for a week or more.

  • Pump in the bottle. Push the silicone tube over the pump’s outlet, drop the pump to the bottom and run the cable and tube out through a hole in the lid.
  • Tube to the pot. Run it in gentle curves and fix the end at the soil surface with a plant clip or a garden stake, so it waters the soil and not the leaves.
  • More than one pot. Cut the tube and add a tee for each extra pot. The split won’t be even; adjust branch lengths until each pot gets roughly the same amount.

The siphon trap. A submersible pump doesn’t block the line when it stops. If the water level in the bottle is higher than the end of the tube, the tube keeps siphoning until the bottle is empty. Keep the bottle lower than the pot’s outlet, or poke a small hole in the tube just above the bottle’s water line. The hole lets air in and breaks the siphon.

Fill the bottle and run the pump straight from the battery (Step 4) for five seconds into a measuring cup. Now you know how much water one burst gives; most small and medium pots need somewhere between a few tablespoons and half a cup per watering.

Step 4: Wire the board, battery and pump

The whole build runs on one LiPo cell. The XIAO ESP32S3 charges it over USB-C, and the pump runs directly from the battery through a logic-level MOSFET. Besides the picks below, you need one logic-level N-channel MOSFET (an IRLZ44N or AO3400 works), a 1N5819 diode, a 10 kΩ and a 100 Ω resistor.

FromTo
Battery + (red)XIAO BAT+ pad (underside) and pump +
Battery − (black)XIAO BAT− pad and MOSFET source
Pump −MOSFET drain
MOSFET gateXIAO D2 through the 100 Ω resistor
MOSFET gateGND through the 10 kΩ resistor
Sensor VCC (red)XIAO D1
Sensor GND (black)XIAO GND
Sensor AOUT (yellow)XIAO D0 (A0)

Put a 2-pin PH plug on the battery, the pump and the sensor leads, so each one unplugs on its own. Three details make it reliable:

  • Diode across the pump. The 1N5819 goes across the pump’s two wires, striped end on +. It absorbs the spike when the motor switches off.
  • Pull-down on the gate. The 10 kΩ resistor holds the MOSFET off while the board sleeps or reboots, so the pump can’t start on its own.
  • Sensor powered from a pin. D1 switches the sensor on only while it’s being read. Left on all the time, it would drain the battery faster than the sleeping board does.

Check the battery polarity with a multimeter before you solder anything to the BAT pads. LiPo plugs from different makers are not always wired the same way, and a reversed cell can destroy the board instantly.

Step 5: Upload the code and calibrate

Install the Arduino IDE, add the ESP32 board package and select XIAO_ESP32S3. First, calibrate the sensor: upload a two-line sketch that prints analogRead(A0) (with D1 set HIGH) and note the number with the probe in dry air, then standing in a glass of water up to the line. Put those into RAW_DRY and RAW_WET below.

The sketch wakes every 30 minutes, reads the soil, waters if it’s below WATER_BELOW percent and the last watering was at least six hours ago, and then sleeps. Wi-Fi only switches on when there’s something to report, which saves a lot of battery. Notifications go to ntfy, a free push-notification app: install it on your phone and subscribe to a long, random topic name only you know.

#include <WiFi.h>
#include <HTTPClient.h>
#include <WiFiClientSecure.h>

const char* WIFI_SSID = "your-wifi";
const char* WIFI_PASS = "your-password";
const char* NTFY_URL  = "https://ntfy.sh/your-long-random-topic";

const int SENSOR_PIN = A0;              // sensor AOUT
const int SENSOR_PWR = D1;              // sensor VCC, on only while reading
const int PUMP_PIN   = D2;              // MOSFET gate

const int RAW_DRY     = 3000;           // reading in dry air      (calibrate)
const int RAW_WET     = 1300;           // reading in water        (calibrate)
const int WATER_BELOW = 35;             // % moisture that triggers watering

const int PUMP_MS       = 5000;         // one watering burst
const int MIN_GAP_WAKES = 12;           // 12 × 30 min = 6 h between waterings
const uint64_t SLEEP_US = 30ULL * 60 * 1000000;

RTC_DATA_ATTR int  wakes = 0, lastWater = -1000;
RTC_DATA_ATTR bool fault = false, checkAfterWater = false;

int readMoisture() {
  digitalWrite(SENSOR_PWR, HIGH);
  delay(300);                           // let the sensor settle
  long sum = 0;
  for (int i = 0; i < 10; i++) { sum += analogRead(SENSOR_PIN); delay(20); }
  digitalWrite(SENSOR_PWR, LOW);
  return constrain(map(sum / 10, RAW_DRY, RAW_WET, 0, 100), 0, 100);
}

void notify(const String& msg) {
  WiFi.begin(WIFI_SSID, WIFI_PASS);
  for (int i = 0; i < 40 && WiFi.status() != WL_CONNECTED; i++) delay(250);
  if (WiFi.status() == WL_CONNECTED) {
    WiFiClientSecure client;
    client.setInsecure();               // fine for a notification, skips the certificate check
    HTTPClient http;
    http.begin(client, NTFY_URL);
    http.POST(msg);
    http.end();
  }
  WiFi.disconnect(true);
}

void setup() {
  pinMode(PUMP_PIN, OUTPUT);
  digitalWrite(PUMP_PIN, LOW);          // pump off first, before anything else
  pinMode(SENSOR_PWR, OUTPUT);
  analogReadResolution(12);
  wakes++;

  int pct = readMoisture();

  if (checkAfterWater) {                // first wake after a watering
    checkAfterWater = false;
    if (pct < WATER_BELOW) {
      fault = true;
      notify("Watered, but the soil is still dry. Refill the bottle or check the tube. Pump paused.");
    }
  }

  if (!fault && pct < WATER_BELOW && wakes - lastWater >= MIN_GAP_WAKES) {
    digitalWrite(PUMP_PIN, HIGH);
    delay(PUMP_MS);
    digitalWrite(PUMP_PIN, LOW);
    lastWater = wakes;
    checkAfterWater = true;
    notify("Plant watered. Soil was at " + String(pct) + "%.");
  }

  esp_sleep_enable_timer_wakeup(SLEEP_US);
  esp_deep_sleep_start();
}

void loop() {}

Set PUMP_MS from your measuring-cup test: one burst should be enough to lift the reading clearly above WATER_BELOW, otherwise the after-watering check will report a fault. To clear a fault after refilling, unplug the battery and USB for a few seconds; the counters start fresh.

Start with WATER_BELOW around 30–40 % and adjust after a week of watching the plant. Note that map() handles the reversed range on its own: a capacitive sensor reads lower when the soil is wetter.

Prefer Home Assistant? The same wiring works with ESPHome: an ADC sensor with a calibrate filter for the soil, a GPIO switch for the pump, and deep sleep. Keep the burst length and the minimum gap on the board itself, so they still apply when Wi-Fi or the server is down.

Step 6: Box it and place it

Print or buy a small box for the board, battery and MOSFET, with a slot for the USB-C port so you can charge without opening it.

  • Electronics above the water. The box sits higher than the bottle and away from where the watering can or the pump tube could drip on it. Leave a drip loop in every cable below the box.
  • Battery safe. Keep the LiPo inside the box, not squeezed against anything sharp, and out of direct sun on a hot windowsill.
  • Out of reach. Cats like to chew tubes and dig at pots; run the tube behind the pot and keep the box on the shelf, not on the floor.

Expect to recharge every few weeks with a 1000 mAh cell; the exact time depends on how often Wi-Fi switches on. If you want a battery gauge, add two equal resistors (for example 220 kΩ each) as a divider from BAT+ to GND and read the midpoint on a spare analog pin.

Step 7: Test before you trust it

  1. Run it over a towel for a few days. Check every tube joint for drips.
  2. Let the bottle run dry on purpose and confirm the fault notification arrives.
  3. Watch the plant, not just the number. If leaves droop before it waters, raise WATER_BELOW; if the soil stays soggy, lower it or shorten PUMP_MS.
  4. Clean it monthly. Rinse the bottle, flush the tube and check the sensor’s sealing. Use the same water you’d use for the plant anyway; for most houseplants, room-temperature tap water is fine.

An auto-waterer keeps a plant going while you’re busy or away for a week; it doesn’t replace checking for pests, light and drainage. A pot without drainage holes and an automatic pump are a bad mix, so use a pot that drains.

What it costs in time: an evening for wiring and code, an hour for the reservoir and tubing, and a week of watching and fine-tuning. The parts for each step are below.

At a glance

7 picks
  1. 1
    Gikfun Capacitive Soil Moisture Sensor (2-Pack)
    Amazon
  2. 2
    ALAMSCN Micro Submersible Water Pump 3–5 V (4-Pack)
    Amazon
  3. 3
    Hooshing Food Grade Silicone Tubing (6 mm ID × 8 mm OD, 10 ft)
    Amazon
  4. 4
    ANPTGHT 1/4 in Equal Barb Tee Fitting (5-Pack)
    Amazon
  5. 5
    Seeed Studio XIAO ESP32S3
    Amazon
  6. 6
    MakerHawk 3.7 V 1000 mAh LiPo Battery (102050)
    Amazon
  7. 7
    Elechawk JST-PH 2.0 Pre-Crimped Connector Kit
    Amazon

As an Amazon Associate I earn from qualifying purchases. If you buy through a link on this page we may earn a small commission, at no extra cost to you. How this works.

Step 2 · Sense Gikfun

Gikfun Capacitive Soil Moisture Sensor (2-Pack)

A coated probe that reads soil moisture without corroding in the pot.

Best for Plant monitorsauto-waterersgarden and greenhouse sensor projects

The cheap two-prong soil probes that come in starter kits work by running current through the soil, and they corrode within weeks. A capacitive probe like this one measures through a coated board instead, so the part in the dirt is just a sealed circuit board. For a sensor that stays in a pot for months, that’s the difference that matters.

What you get is a number that goes down as the soil gets wetter. It isn’t a percentage until you calibrate it: read it once in dry air and once standing in a glass of water, and map your plant’s “needs water” point between the two.

Pro tip Brush clear nail polish or conformal coating over the cut edges of the board and the electronics at the top, then cover the top with heat-shrink. Push the probe in only up to the line, never over the components.

Why we like it

  • ✓Capacitive, so there are no exposed electrodes to corrode in wet soil
  • ✓Simple analog output that any ESP32 ADC pin can read
  • ✓Comes with a 3-wire cable, so no soldering on the sensor side
  • ✓Two sensors per pack — a second pot or a spare

Keep in mind

  • !The electronics at the top aren't waterproof; the edges and the top part need sealing
  • !Readings are raw numbers, not percent — every sensor needs its own dry/wet calibration
  • !Readings shift with soil type and how firmly the probe sits, so it shows a trend, not a lab value
Output
Analog
Max supply
5.5 V
Size
0.91 × 3.86 in (23 × 98 mm)
Count
2 sensors + cables
Model
EK1940
Step 3 · Pump ALAMSCN

ALAMSCN Micro Submersible Water Pump 3–5 V (4-Pack)

A tiny 3–4.5 V pump that sits in the bottle and runs off the battery.

Best for Plant auto-watererstabletop fountainssmall hydroponics experiments

For a houseplant, the pump only has to move a cup of water now and then. A tiny submersible pump does that in a few seconds, and at 3–4.5 V it runs from the same LiPo cell as the board, which keeps the whole build on one battery with no 12 V supply.

The trade-off is that these are simple, inexpensive pumps. The seller itself recommends them for experiments, not for running all day. A plant waterer that runs the pump for five seconds at a time is about as gentle a job as they get, and the pack has three spares if one gives up.

Pro tip Keep the reservoir’s water level below the pot’s outlet, or poke a small hole in the tube just above the water line. Otherwise the tube can keep siphoning after the pump stops and empty the bottle into the pot.

Why we like it

  • ✓Runs at 3–4.5 V, so a single LiPo cell can drive it through one MOSFET
  • ✓Small enough to drop into a bottle or jar reservoir
  • ✓Four pumps per pack, plus a length of tube
  • ✓Plenty of flow for watering; short bursts instead of slow dosing

Keep in mind

  • !The seller says it's for experiments, not continuous use — fine for short bursts only
  • !Must stay submerged; running it dry wears it out
  • !Unlike a peristaltic pump, it doesn't seal the line when it stops, so siphoning is possible
  • !No-name brand with mixed reviews; the extra pumps in the pack are your spares
Voltage
3–4.5 V DC (rated)
Flow
up to 100 L/h with no load
Type
Submersible, plastic
Count
4 pumps + tube
Step 3 · Tubing Hooshing

Hooshing Food Grade Silicone Tubing (6 mm ID × 8 mm OD, 10 ft)

Soft food-grade tube from the pump's outlet to the pot.

Best for Plant watering linessmall pumpsaquarium and homebrew transfers

The pack that comes with most mini pumps includes a short length of stiff vinyl tube. It works, but silicone is softer, easier to bend around a pot and stays flexible for longer. In 6 mm ID it pushes over a typical mini pump’s outlet snugly, and fits the 1/4 in tee fittings used to split the line to more than one pot.

Clear tubing also makes troubleshooting easy: you can watch the water travel and see straight away if it stops short or leaks back toward the bottle.

Pro tip Cut the tube with a sharp knife or flush cutters, square across. A clean, straight end seals better on a barb than a ragged one.

Why we like it

  • ✓6 mm ID fits common mini submersible pump outlets and 1/4 in barbs
  • ✓Food-grade silicone, BPA free, Hooshing says
  • ✓Clear, so you can see air bubbles or algae in the line
  • ✓UV resistant, per the listing — good for a sunny windowsill
  • ✓10 ft (3.05 m) is enough for several pots

Keep in mind

  • !Soft silicone kinks on tight bends; route it in gentle curves
  • !Thicker than drip-irrigation tubing, so it's more visible on a shelf
Size
6 mm ID × 8 mm OD (1 mm wall)
Length
10 ft (3.05 m)
Material
Food-grade silicone
Color
Clear
Step 3 · Split ANPTGHT

ANPTGHT 1/4 in Equal Barb Tee Fitting (5-Pack)

Tees that let one pump water two or three similar pots.

Best for Splitting watering linesaquarium and small pump plumbinglab tubing

One pump can water more than one pot, as long as the pots are similar plants that dry out at a similar pace. A tee in the line splits the flow, and the moisture sensor sits in the pot that dries fastest, so the others never go thirsty.

Expect the split to be uneven. Water takes the easiest path, so a pot that’s lower or closer to the pump gets more. Shorten or lengthen the branches, or add a pinch clip on one side, until both pots drain about the same amount.

Pro tip Test every joint over a towel with the pump running before the pots go back on the shelf. A barb that drips once per watering adds up to a wet windowsill.

Why we like it

  • ✓Fits 1/4 in (about 6 mm) ID tubing on all three ends
  • ✓Polypropylene, so it doesn't rust or corrode in water
  • ✓Rated -9°F to 175°F, per the listing — no problem indoors
  • ✓Five per pack, enough to feed several pots from one pump

Keep in mind

  • !Splitting doesn't divide water evenly; the lower or closer pot gets more
  • !A tight fit on 6 mm tube — warming the tube end in hot water helps it go on
Size
1/4 in barb, 3-way equal tee
Material
Polypropylene
Count
5 tees
Model
LAT1B
Step 4 · Brain Seeed Studio

Seeed Studio XIAO ESP32S3

A thumb-sized Wi-Fi board that sleeps between readings and charges the LiPo itself.

Best for Battery-powered sensorsdeep-sleep Wi-Fi projectssmall ESPHome and Arduino builds

A plant monitor spends almost all of its life doing nothing: it wakes up, reads the soil, maybe runs a pump for a few seconds, and goes back to sleep. That’s exactly what the XIAO ESP32S3 is good at. Its low deep-sleep current and the charger built into the board mean one small LiPo and a USB-C cable cover the whole power side of the project.

This is the plain S3 version without soldered headers. For a build that lives in a box beside a plant pot, that’s fine: solder short wires straight to the pads you use, and the battery leads to the pads on the back.

Pro tip Check the battery polarity before you solder. LiPo plugs aren’t wired the same by every maker, and a reversed battery on the BAT pads can destroy the board in a second.

Why we like it

  • ✓Built-in charge management for a single-cell LiPo, so no separate charger board
  • ✓Deep sleep down to about 14 µA, Seeed says — the key number for a battery build
  • ✓Dual-core ESP32-S3 at up to 240 MHz with 2.4 GHz Wi-Fi and Bluetooth LE 5.0
  • ✓Tiny, 21 × 17.5 mm, fits inside a small printed box next to the pot
  • ✓Programs over USB-C from the Arduino IDE or MicroPython; a common ESPHome target too

Keep in mind

  • !Pins come unsoldered on this version, so you solder headers or wires yourself
  • !The battery connects to small pads on the underside, not a plug
  • !Pins are 3.3 V only, and Wi-Fi is 2.4 GHz only
Chip
ESP32-S3, dual-core Xtensa, up to 240 MHz
Wireless
2.4 GHz Wi-Fi, Bluetooth LE 5.0
Flash
8 MB
Deep sleep
about 14 µA (manufacturer figure)
Battery
Single-cell LiPo charging on board
Board size
21 × 17.5 mm
Connector
USB-C
Step 4 · Power MakerHawk

MakerHawk 3.7 V 1000 mAh LiPo Battery (102050)

A flat protected LiPo cell that powers both the board and the pump.

Best for Battery-powered ESP32 sensorssmall handheld buildsreplacing tiny device batteries

A single LiPo cell matches the plant monitor well: the XIAO board charges it over USB-C, and the small pump runs directly from its 3.7–4.2 V. A flat 1000 mAh cell is a good starting size, small enough to tuck under the board in a printed box and big enough for weeks of half-hourly readings if the code sleeps properly.

The built-in protection board is the important part here. It cuts the cell off before it’s drained too far, which matters in a project that can quietly run the battery down while you’re away.

Pro tip Never let a LiPo sit squeezed, punctured or next to the water. Put it in the electronics box, above the reservoir, and stop using any cell that starts to puff up.

Why we like it

  • ✓3.7 V single cell, the type the XIAO ESP32S3 charges on board
  • ✓Protection circuit against overcharge, over-discharge, overcurrent and short circuit, MakerHawk says
  • ✓Flat 102050 format (about 10 × 20 × 50 mm) fits a small enclosure
  • ✓Comes with a 2.0 mm JST-style plug and short leads
  • ✓Multi-pack, so there's a charged spare when one runs low

Keep in mind

  • !1000 mAh is modest; with Wi-Fi reports it means recharging every few weeks, not once a season
  • !Plug polarity has to be checked against the board — LiPo plugs aren't standardized
  • !The listing is unclear about how many cells come in the pack
Voltage
3.7 V nominal
Capacity
1000 mAh (3.7 Wh)
Format
102050
Protection
Built-in PCM
Connector
2.0 mm JST-style, 2-pin
Step 4 · Connectors Elechawk

Elechawk JST-PH 2.0 Pre-Crimped Connector Kit

Pre-crimped plugs, so the battery, pump and sensor unplug for cleaning.

Best for LiPo battery leadssensor cablessmall removable connections in ESP32 and Arduino builds

Plugs make a small build much easier to live with. With a 2-pin PH connector on the battery, the pump and the sensor, you can unplug the pump to clean the reservoir or swap a flat battery for a charged one without touching a soldering iron.

The wires come with pins already crimped on, so making a lead is just: push the pins into a housing, solder the other end to the board and cover it with heat-shrink. The PH 2.0 size matches the plug on most small LiPo cells.

Pro tip Use the same color code everywhere, red for + and black for −, and check each plug with a multimeter before it goes near the board. A mirrored battery plug is the classic way to kill a small board.

Why we like it

  • ✓Wires come pre-crimped, so no crimping tool is needed — push the pin into the housing
  • ✓Male and female housings from 2 to 6 pins
  • ✓90 silicone wires, 13 cm (5.2 in) long, in several colors
  • ✓Heat-shrink and tweezers included

Keep in mind

  • !13 cm wires are short; longer runs need soldering and heat-shrink
  • !Thin 24 AWG wire is fine for a small pump but not for heavy loads
  • !Pins seat firmly only one way — easy to push in wrong and hard to pull out
Connector
JST-PH compatible, 2.0 mm pitch
Pins
2–6, male and female
Wire
24 AWG silicone, 13 cm (5.2 in), 90 pcs
Extras
Heat-shrink, tweezers
Model
PH2.0KIT

More Electronics