IoT Mailbox — How I Built It
Overview
This post documents the IoT mailbox I built to notify me when mail arrives. It covers the hardware selection, wiring, firmware, the backend that aggregates events, and deployment notes.
What I used
- ESP32 development board (Wi‑Fi)
- Magnetic reed switch (or a small hall effect sensor)
- Small enclosure and mounting hardware
- Lightweight backend (Node.js/Express or serverless function)
Wiring
The reed switch sits on the mailbox door and connects to a GPIO on the ESP32 with a pull‑up. When the door opens the circuit changes and the ESP32 detects the transition.
Firmware
Basic firmware logic:
- Initialize Wi‑Fi
- Connect to backend via HTTPS POST
- Read sensor state on interrupt
- Debounce and send a single event per open
- Optionally include RSSI / battery info
Backend
The backend accepts events and can either send push notifications (Pushover/Pushbullet) or store a timeline of events. For a simple self-hosted deploy I used a small Express endpoint behind a reverse proxy and stored events in a tiny JSON file or SQLite DB.
Deployment notes
Make sure the ESP32 reconnects gracefully and has an exponential backoff for Wi‑Fi. Secure the endpoint with a simple token or use mutually validated TLS if you expose it publicly.
Lessons & Next Steps
- Add OTA updates for firmware convenience.
- Include a small battery monitor to detect low power.
- Log raw events and provide a web UI for the timeline.
If you'd like, I can expand this into a full post with circuit diagrams, code snippets, and a deploy guide.