Initial design: ESP32-S3 presence sensor with camera, mmWave, PIR, temp/humidity, light

- KiCad schematic and PCB layout (45x35mm board)
- Full BOM with JLCPCB part numbers
- ESPHome firmware configuration
- 3D-printable wall-mount enclosure (OpenSCAD + STL)
- Pin mapping and power budget documentation
This commit is contained in:
root
2026-03-29 12:53:54 -05:00
commit 0240020cd2
12 changed files with 15072 additions and 0 deletions

113
README.md Normal file
View File

@@ -0,0 +1,113 @@
# ESP32-S3 Presence Sensor
Compact wall-mount presence sensor with camera, mmWave radar, PIR, temperature/humidity, and ambient light sensing. Designed for Home Assistant via ESPHome.
## Features
- **5MP Camera** (OV5640, 120° wide-angle) - video stream to HA
- **24GHz mmWave Radar** (LD2410C) - presence detection even when still
- **PIR Sensor** (AM312) - instant motion trigger
- **Temp/Humidity** (SHT41) - ±0.2°C accuracy
- **Light Sensor** (BH1750) - 1-65535 lux
- **USB-C powered** - any 1A+ charger
- **~45x35mm PCB** - wall mountable
## How Detection Works
```
Motion event:
PIR (AM312) ──→ instant trigger (ms response)
mmWave (LD2410C) ──→ sustained presence tracking
│ (detects breathing/typing)
Combined "Occupancy" ──→ true if either sensor active
30s delay before "unoccupied"
```
PIR catches fast motion immediately. mmWave confirms someone is still in the room even when sitting perfectly still. The combined sensor gives zero false-offs.
## Project Files
| File | Description |
|------|-------------|
| `presence-sensor.kicad_pro` | KiCad project file |
| `presence-sensor.kicad_sch` | Schematic |
| `PIN_MAPPING.md` | GPIO assignments and power budget |
| `BOM.csv` | Bill of materials with JLCPCB part numbers |
| `esphome-presence-sensor.yaml` | ESPHome firmware config |
## Build Instructions
### 1. Order PCBs
- Open project in KiCad 8+
- Complete PCB layout (place components, route traces)
- Generate Gerbers: File → Plot → Gerber
- Upload to [JLCPCB](https://jlcpcb.com)
- Enable SMD assembly, upload BOM.csv
### 2. Order Modules (plug-in, not soldered by JLCPCB)
- OV5640 camera module (24-pin 0.5mm FPC, wide-angle 120°)
- HLK-LD2410C mmWave radar module
- AM312 mini PIR sensor
### 3. Assembly
- Solder LD2410C to 1.27mm header
- Solder AM312 to 2.54mm header
- Connect OV5640 via FPC cable
### 4. Flash Firmware
```bash
# Install ESPHome
pip install esphome
# Create secrets.yaml
cat > secrets.yaml << EOF
wifi_ssid: "your-wifi"
wifi_password: "your-password"
api_key: "generate-a-key"
ota_password: "your-ota-password"
fallback_password: "your-fallback"
EOF
# Flash via USB-C (hold BOOT, press RESET, release BOOT)
esphome run esphome-presence-sensor.yaml
```
### 5. Add to Home Assistant
- ESPHome auto-discovers the device
- Settings → Devices & Services → ESPHome → Configure
## Cost Per Board
| Item | Cost |
|------|------|
| PCB fabrication (5pcs) | ~$8 total |
| SMD assembly | ~$12/board |
| Components on PCB | ~$5.50/board |
| OV5640 camera module | ~$3.50 |
| LD2410C radar | ~$2.50 |
| AM312 PIR | ~$0.50 |
| **Total per board** | **~$32** |
## Design Notes
### Antenna Clearance
- ESP32-S3 antenna extends past board edge
- No copper pour under antenna area (top or bottom)
- Keep antenna away from LD2410C radar module
### Thermal
- SHT41 placed on board edge, away from ESP32 heat
- -1.5°C offset in ESPHome config (calibrate after testing)
- Enclosure should have ventilation slots near SHT41
### mmWave Orientation
- LD2410C mounted perpendicular to wall for widest room coverage
- Detection cone is ~60° in each direction
- Optimal height: 1.2-1.5m from floor
### Camera
- OV5640 connects via 24-pin FPC flex cable
- Camera module sits at top of enclosure, angled slightly down
- 120° wide-angle lens covers most of a room from wall mount