42 lines
1.9 KiB
Markdown
42 lines
1.9 KiB
Markdown
# 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:
|
|
1. **AI Vision:** Passes image to **Gemini Flash** to generate a text description of the visitor.
|
|
2. **Database:** Pushes the image and description to **NocoDB** for historical logging.
|
|
3. **TTS Announcement:** Sends the text description to Home Assistant.
|
|
4. **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) $\to$ Slave 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.
|