We have a balcony. It has a fig tree, some tiles, and pigeons. Every time I spotted one I’d rush out and wave my arms. They came back ten minutes later. So naturally, as a tinkerer, I thought: let’s automate this.
The idea was simple — a small camera, an ESP32, detect movement, send a photo. A few evenings of work. That was a year ago.
The Battery Problem Ate Everything
The motion detection worked fine. Then night came. Battery dead by morning.
Most ESP32 dev boards look great on paper — deep sleep, LiPo charger, low power modes. What the specs don’t tell you: the camera module keeps drawing current even in deep sleep. I tried transistors to cut power. MOSFETs. A second microcontroller to switch the main board off. Each solution either drew too much standby current or added complexity that broke something else.
The fix was radical: cut power entirely between events. No deep sleep. The hero component is the TPS22918 — a tiny load switch IC. The PIR sensor triggers it, which cold-boots the ESP32-S3 from zero. First firmware instruction self-latches the power rail. Job done → board releases the latch → fully dark. Standby current: ~140 µA, mostly the PIR sensor itself. The ESP32 draws nothing, because it has no power. If there is time, I will write a more detailed article on this topic – it was a bit of a challenge to find out the right part and to get the tiny smd part soldered, but its just perfectly running after all my other failed hardware attempts. 🙂
Yes, that’s a breadboard in a cardboard box. It’s a prototype.


WiFi Shoots the PIR. Literally.
Just when power felt solved: WiFi radio interference was triggering the PIR sensor during uploads. The system went haywire — blinking, re-triggering, spiralling. Took a long time to find. The fix: disable the PIR interrupt during WiFi transmission, handle re-triggers gracefully.
AI vs. Algorithm — The Surprising Part
The balcony has plants, a railing, and a sky. At noon the sun triggers the PIR constantly — clouds moving, shadows sweeping. Most captured photos were empty.
The obvious answer in 2025: throw a neural network at it. I went the other way — a classical signal-processing filter that runs on the ESP32 in under 10ms, before WiFi even wakes up. It tiles the frame into a grid, compares each tile against a self-learned per-time-of-day background, and decides: real event or just clouds?
Tested on 147 field captures: 100% recall on real events, 61% of false triggers suppressed. No training data needed. No model file. Self-calibrates from live captures. Fits in 2 KB.
Sometimes the old tools are the right tools.
Where It Stands
The platform is solid — reliable wakeup, false-trigger filtering, photo upload. What’s still missing: the cloud-check filter needs porting from Python to C on the ESP32, and the ESP32-S3 has enough headroom for a small TFLite model — so the hardware is already ready for on-device bird detection, even if the pigeon-brain isn’t written yet.
The pigeons may well have died of old age before I finish. But I learned more about embedded hardware in this project than in anything before it. Respect for people who build systems that run outdoors, unattended, for months — that respect has gone way up.


