Files
Porch_Security_Light/README.md

2.0 KiB

Ultra-low-power ESP32 outdoor porch security light controller with LoRa communication, PIR motion waking, ambient light sensing, and battery voltage protection.

ESP32 porch light controller with SX127x LoRa module, PIR motion sensor, and VEML7700 lux meter

Status: in progress

What it does

  • Wakes from ESP32 deep sleep on PIR motion (GPIO 13) or scheduled RTC wakeups
  • Measures ambient lux via I2C VEML7700 sensor to prevent activating porch lights during daylight
  • Drives high-voltage porch security light relay (GPIO 12) upon valid night-time motion
  • Transmits motion alerts, battery voltage (GPIO 34), and status via SX127x SPI LoRa radio

Bill of Materials

Part Quantity Purpose
ESP32 Development Board 1 Main MCU utilizing RTC memory and deep sleep wake pins
SX127x LoRa Module 1 Long-range 915MHz SPI radio transceiver (CS GPIO 5, RST GPIO 14, DIO0 GPIO 26)
PIR Motion Sensor 1 Infrared motion detection connected to RTC_GPIO14 / GPIO 13
VEML7700 Lux Sensor 1 High-accuracy I2C ambient light sensor for daylight lockout
Relay Module 1 Solid-state or mechanical relay on GPIO 12 switching 12V/240V porch light
Voltage Divider Sensor 1 Resistor divider on GPIO 34 for monitoring battery pack voltage

How it works

The system remains in deep sleep drawing microamps until the PIR sensor triggers RTC_GPIO14 or the RTC timer expires. Upon waking, it reads ambient light from the VEML7700 sensor; if lux is below MAX_LUX_THRESHOLD (50 lux) and battery voltage is above minimumPower (11.0V), it energizes relay GPIO 12 for lightOnDuration (30s) and broadcasts a LoRa packet.

What broke

  • False wakeups caused by floating inputs on the PIR signal line during deep sleep were resolved by enabling internal RTC pull-down resistors on GPIO 13 before calling esp_deep_sleep_start().