Eleki Jack IoT All articles
Home Automation

Confessions of a Serial Plant Killer: How an ESP32 Finally Kept My Ferns Alive

Eleki Jack IoT
Confessions of a Serial Plant Killer: How an ESP32 Finally Kept My Ferns Alive

Let's get the confession out of the way: my kitchen windowsill is a graveyard. A fiddle-leaf fig that cost more than my first logic analyzer. Three succulents that succumbed to what I can only describe as 'enthusiastic neglect.' A fern named Gerald who never stood a chance.

The problem was never that I didn't care. It's that I care in bursts. I'll water everything diligently on a Sunday, then forget the entire plant kingdom exists until Thursday. Plants don't work on my schedule, and apparently my memory doesn't work on theirs.

So I did what any self-respecting IoT nerd would do: I automated my guilt away with about $35 in parts and an afternoon of tinkering. Now my plants tattle on me via push notification, and when I'm out of town, the system waters them without any human intervention. Here's the whole build.

Why Capacitive Sensors Beat the Cheap Resistive Ones

If you've browsed Amazon for soil moisture sensors, you've seen those $3 resistive probes with the exposed metal traces. Skip them. They corrode within weeks of touching damp soil, and once the contacts oxidize, your readings drift into fantasy territory.

Capacitive sensors (the v1.2 boards are everywhere for around $4) work differently. Instead of measuring resistance between exposed electrodes, they measure how the soil's dielectric constant changes the sensor's capacitance. The PCB is coated, so the soil never touches bare metal. Mine have been running for eight months with zero drift.

One quirk worth knowing: these sensors output an analog voltage that's inverted from what you'd expect. Dry soil reads high (around 3.0V), wet soil reads low (around 1.5V). You'll calibrate in a minute anyway, but don't panic when your 'wet' plant shows a big number.

The Parts List

Everything here is readily available from Amazon, Adafruit, or your favorite AliExpress rabbit hole:

Total damage: roughly $35 if you're starting from scratch, less if you've already got the ESP32 drawer every maker accumulates.

Wiring It Up

The wiring is genuinely beginner-friendly:

  1. Sensor to ESP32: VCC to 3.3V, GND to GND, and the analog out (AOUT) to GPIO 34. That pin is input-only and ADC-capable, which is exactly what we want.
  2. Pump to relay: The pump's positive lead goes through the relay module (COM and NO terminals), and the relay's control side hooks to GPIO 26 plus 5V and GND.
  3. Common ground: Everything shares a ground rail. Skip this and you'll chase phantom readings for hours.

One hardware tip the tutorials gloss over: run the sensor at reduced voltage or add a small transistor to power it only during readings. A capacitive sensor energized 24/7 in damp soil will slowly electrolyze even with the coating. Powering it for 50 milliseconds per reading extends its life dramatically.

The Firmware: ESPHome Makes This Almost Too Easy

You could hand-roll Arduino code, but ESPHome turns this whole project into a YAML file — and since we're wiring into Home Assistant anyway, it's the obvious path.

The config has three moving parts: the ADC sensor with a multiplier to convert raw readings into a percentage, a deep-ish sleep isn't needed here since it's mains powered, and an output to drive the relay.

Calibration is the only fiddly part. Dunk the sensor in a glass of water and note the raw value (that's your 100% point), then let it sit in open air and note that value (your 0%). Plug both into the YAML and the sensor reports clean percentages from then on.

Making It Tattle: The Home Assistant Side

Here's where the magic happens. Once ESPHome flashes and the device joins your network, Home Assistant picks it up automatically.

The tattling automation: trigger a push notification when soil moisture drops below 30% for more than an hour. The hour-long delay matters — it prevents your phone from buzzing every time a sensor wobbles. The notification is simple: 'Gerald the fern is at 24% moisture. Do something.'

The vacation mode: this is the part that earns its keep. An automation that, when moisture drops below 35%, fires the pump for exactly four seconds, then waits 30 minutes and re-checks. Four seconds of pump time moves about a shot glass of water, which sounds pathetic but is genuinely the right amount for a 6-inch pot. It's much easier to add water than to remove it, and overwatering is how most houseplants actually die.

A physical fail-safe is worth adding too: a cheap float switch in the reservoir that disables the pump and alerts you if the tank runs dry. There's no automation quite like coming home from a week away to find the pump ran dry and your plants are exactly as thirsty as when you left.

What I'd Do Differently

Three lessons from running this for two growing seasons:

Gerald the fern — the replacement Gerald, technically — has now survived eleven months, a week-long trip to Denver, and one incident involving a curious cat. That's a better survival record than any plant I've owned.

If you already run Home Assistant, this is a weekend project with a Sunday afternoon ceiling. And if you keep killing succulents? Honestly, the sensors don't judge. They just report the facts — usually before it's too late.

All Articles

Related Articles

The Doorbell That Never Phones Home: A Local-Only Build for Paranoid Homeowners

The Doorbell That Never Phones Home: A Local-Only Build for Paranoid Homeowners

Free Outlets Everywhere: Sipping 5V From the Devices Already Plugged Into Your Walls

Free Outlets Everywhere: Sipping 5V From the Devices Already Plugged Into Your Walls

Your Whole Smart Home, One Little Box: Building a Self-Hosted Brain on a Mini PC

Your Whole Smart Home, One Little Box: Building a Self-Hosted Brain on a Mini PC