PIR Sensor

PIR Sensor

May 27, 2025

Control Lights Based on Room Occupancy Using PIR and ESP32

Ever walked into a room, arms full of groceries, only to fumble for the light switch? Or worse—left the lights on all day in an empty room? With a PIR motion sensor and an ESP32, you can automate your lights to turn on when someone enters and off when the room is vacant. It’s a simple yet powerful way to save energy and add convenience to your smart home. In this tutorial, I’ll walk you through setting up this system step-by-step, including wiring, ESPHome configuration, and troubleshooting tips.