← Back to blog
Build write-up · ~9 min

I gave my plant a microcontroller it didn't ask for

Soil moisture, pump control, an ESP32, and a tiny PCB. The plant is fine. The project is overkill. The write-up is here.

I was going to write a short post and instead I wrote this. Sorry in advance. The short version: the original idea was a soil-moisture-sensing setup that pings me when the plant looks sad. The actual finished thing measures soil moisture, ambient humidity, ambient temperature, soil temperature, runs a small pump, talks MQTT, and refuses to shut up.

The bill of materials

A short list, in order of how much I regret each item. The ESP32 was an obvious choice — Wi-Fi, plenty of GPIO, MQTT libraries that mostly work on the first try. The capacitive moisture sensor was a less obvious choice; the resistive ones corrode in days. The pump is a 5V peristaltic, driven by a logic-level MOSFET that I selected by panicking and grabbing whatever was nearest on the bench.

// snippets/main.cpp
void setup() {
  Serial.begin(115200);
  sensor.begin();
  pump.attach(PUMP_PIN);
}

Where it went wrong

On rev1 the 3V3 rail sagged every time the pump kicked on. This is, in retrospect, the most predictable thing that has ever happened to anyone. I had a single 100µF cap on the rail and no isolation between the logic and motor sides of the board. Rev2 adds a dedicated buck for the pump and proper decoupling. Rev2 also works.


What’s next

Rev3 will add a deep-sleep mode so the thing isn’t online drawing 80mA forever. After that, a custom enclosure that doesn’t involve electrical tape. Subscribe at the bottom of the homepage if you want the next post when it goes up.