ESP32-CAM as a Doorbell/Mailbox Camera with Notifications
The Build Concept
Combine PIR motion detection (or a simple magnetic reed switch for a mailbox specifically) with camera capture and push notification — genuinely useful, low-cost alternative to commercial video doorbells, with the advantage of zero subscription fees and full local control.
Doorbell Variant: PIR + Camera
Follow the motion detection guide's PIR wiring, mounted to trigger on approach to the door. Add a physical pushbutton (wired to another free GPIO) if you want an actual "ring" trigger distinct from general motion, so you can differentiate "someone's approaching" from "someone pressed the bell" in your notification logic.
Mailbox Variant: Reed Switch
A magnetic reed switch (one half on the mailbox door, one half on the frame) is more reliable than PIR for this use case — it detects the door specifically opening, not just general nearby motion (which would false-trigger constantly for a roadside mailbox from passing cars/pedestrians).
#define REED_PIN 13 void setup() { pinMode(REED_PIN, INPUT_PULLUP); // reed switch to GND when closed } void loop() { static bool wasOpen = false; bool isOpen = digitalRead(REED_PIN) == HIGH; // open circuit = mail door opened if (isOpen && !wasOpen) { captureAndNotify(); } wasOpen = isOpen; delay(500); }Sending a Real Push Notification
If you're running Home Assistant (recommended — see the setup guide), route through it rather than building notification infrastructure from scratch:
void captureAndNotify() { camera_fb_t* fb = esp_camera_fb_get(); // POST image to an HA webhook (see motion detection guide's upload pattern) uploadToCloud(fb->buf, fb->len); esp_camera_fb_return(fb); }On the Home Assistant side, an automation triggered by that webhook can send a mobile push notification (via the official HA Companion App integration) with the captured image attached — genuinely works well, arrives in seconds.
Power for a Mailbox Install
Roadside mailboxes rarely have mains power nearby — this is a battery + deep sleep scenario (see the dedicated deep sleep guide). Wake on reed switch state change via esp_sleep_enable_ext0_wakeup, capture, send, sleep again — a well-tuned deep sleep setup can run for weeks/months on a decent battery pack since the ESP32 draws almost nothing while sleeping.
Weatherproofing
Outdoor mailbox/doorbell installs need genuine weatherproofing — a project box rated IP65 or better, with the camera lens behind a clear window (not open air) and cable entry points properly sealed. This matters more than people expect; condensation inside a "weatherproof" enclosure with poor sealing is a common failure mode that kills boards within months.
Battery Life Reality Check
Actual runtime depends heavily on trigger frequency — a mailbox checked once a day very different from a doorbell in a high-foot-traffic area. Test your actual deployment's trigger rate for a week and extrapolate battery drain before assuming a specific runtime figure; deep sleep current draw estimates from datasheets rarely match real-world behavior exactly once WiFi reconnection overhead on each wake is factored in.
Related Guides
- Build a Battery-Powered ESP32 Smart Mailbox Notifier
- How to Use the ESP32-CAM: Video Streaming, Motion Detection, and Time-Lapse
- Tying It Together: Pi + ESP32 + Flipper Home Automation Hub
- Building a Sub-GHz Signal Library for Home Automation Testing
- ESP32-CAM Complete Setup Guide: Flashing, FTDI Wiring, First Boot
- ESP32-CAM Streaming Server: MJPEG, RTSP, and Home Assistant Integration
- ESP32-CAM Motion Detection & Snapshot-to-Cloud
- ESP32-CAM AI Vision: Face Detection & TensorFlow Lite on Device