Files
presence-sensor/esphome-presence-sensor.yaml
root 0240020cd2 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
2026-03-29 12:53:54 -05:00

203 lines
4.1 KiB
YAML

substitutions:
name: presence-sensor
friendly_name: Presence Sensor
esphome:
name: ${name}
friendly_name: ${friendly_name}
platformio_options:
board_build.flash_mode: dio
board_build.arduino.memory_type: qio_opi
esp32:
board: esp32-s3-devkitc-1
framework:
type: esp-idf
flash_size: 16MB
psram:
mode: octal
speed: 80MHz
# Enable logging
logger:
level: INFO
# Enable Home Assistant API
api:
encryption:
key: !secret api_key
ota:
- platform: esphome
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
ssid: "${name}-fallback"
password: !secret fallback_password
# ==========================================
# I2C Bus - SHT41 + BH1750
# ==========================================
i2c:
sda: GPIO3
scl: GPIO4
scan: true
frequency: 400kHz
# ==========================================
# UART - LD2410C mmWave Radar
# ==========================================
uart:
id: uart_ld2410
tx_pin: GPIO17
rx_pin: GPIO18
baud_rate: 256000
parity: NONE
stop_bits: 1
# ==========================================
# Camera - OV5640 5MP
# ==========================================
esp32_camera:
name: Camera
external_clock:
pin: GPIO11
frequency: 20MHz
i2c_pins:
sda: GPIO15
scl: GPIO16
data_pins: [GPIO1, GPIO2, GPIO5, GPIO6, GPIO7, GPIO8, GPIO9, GPIO10]
vsync_pin: GPIO13
href_pin: GPIO14
pixel_clock_pin: GPIO12
power_down_pin: GPIO21
reset_pin: GPIO41
resolution: 800x600
max_framerate: 15fps
idle_framerate: 0.2fps
jpeg_quality: 12
vertical_flip: false
horizontal_mirror: false
esp32_camera_web_server:
- port: 8080
mode: stream
# ==========================================
# LD2410C mmWave Presence Radar
# ==========================================
ld2410:
uart_id: uart_ld2410
id: ld2410_radar
binary_sensor:
# mmWave presence (stays on while someone is in room, even if still)
- platform: ld2410
has_target:
name: Presence
has_moving_target:
name: Moving Target
has_still_target:
name: Still Target
# PIR motion (fast initial trigger)
- platform: gpio
pin:
number: GPIO38
mode: INPUT
name: Motion
device_class: motion
filters:
- delayed_off: 10s
# Combined: PIR for instant trigger, mmWave for sustained presence
- platform: template
name: Occupancy
device_class: occupancy
lambda: |-
if (id(pir_motion).state || id(ld2410_presence).state) {
return true;
}
return false;
filters:
- delayed_off: 30s
sensor:
# mmWave detection distance
- platform: ld2410
moving_distance:
name: Moving Distance
still_distance:
name: Still Distance
moving_energy:
name: Moving Energy
still_energy:
name: Still Energy
detection_distance:
name: Detection Distance
# Temperature & Humidity - SHT41
- platform: sht4x
temperature:
name: Temperature
accuracy_decimals: 1
filters:
- offset: -1.5 # Compensate for ESP32 heat, adjust after testing
humidity:
name: Humidity
accuracy_decimals: 1
address: 0x44
update_interval: 30s
heater_max_duty: 0.0
# Ambient Light - BH1750
- platform: bh1750
name: Illuminance
address: 0x23
measurement_duration: 69
update_interval: 10s
# WiFi signal
- platform: wifi_signal
name: WiFi Signal
update_interval: 60s
# Uptime
- platform: uptime
name: Uptime
# ==========================================
# Status LED
# ==========================================
light:
- platform: status_led
name: Status LED
pin: GPIO40
# ==========================================
# Buttons
# ==========================================
button:
- platform: restart
name: Restart
- platform: factory_reset
name: Factory Reset
disabled_by_default: true
# ==========================================
# Diagnostic
# ==========================================
text_sensor:
- platform: wifi_info
ip_address:
name: IP Address
ssid:
name: Connected SSID
- platform: version
name: ESPHome Version