Smart Video Doorbell Controller (Master)
Hardware: ESP32-S3-N16R8 (16MB Flash / 8MB PSRAM) Role: Master Controller & Network Bridge.
System Architecture
This device acts as the brain of the DIY Doorbell. It manages power states, handles peripherals, retrieves images from the Slave Camera via UART, and dispatches data to the Local Home Lab.
Logic & State Machine
The device utilizes Deep Sleep to conserve battery, waking only on triggers:
| Trigger | Visual State | Action Sequence |
|---|---|---|
| Motion (PIR) | RED LED | Wake \to Snap Photo \to Upload to N8N \to Send MQTT (Motion) \to Sleep (60s) |
| Button Press | BLUE LED | Wake \to Snap Photo \to Upload to N8N \to Send MQTT (Ring) \to Sleep (120s) |
Note: Button press has priority. If PIR wakes the device but the button is pressed, it switches immediately to Blue/Ring mode.
Integrations
1. Home Assistant (MQTT)
State updates are sent to `front-door-cam/events`.
- PIR Event: Sets Home Assistant lights to RED (Visual Warning).
- Button Event: Sets Home Assistant lights to BLUE (Doorbell Ring).
2. N8N Automation Pipeline
The ESP32 posts raw JPEG data to an N8N Webhook. The workflow executes:
- AI Vision: Passes image to Gemini Flash to generate a text description of the visitor.
- Database: Pushes the image and description to NocoDB for historical logging.
- TTS Announcement: Sends the text description to Home Assistant.
- Audio Playback: HA forwards text to a Piper (Docker) container for generation, which broadcasts via Snapcast speakers.
Hardware Wiring
- UART to Camera: GPIO 17 (TX) / 18 (RX)
\toSlave Board. - PIR Sensor: GPIO 13.
- Button: GPIO 14 (Active Low).
- Status LED: GPIO 12 (WS2812B).
Todo / Roadmap
- Add I2S Microphone and Speaker for 2-way audio.
- Add Email notification with image attachment via N8N.
Description
Languages
C++
100%