#121IntermediatePremium

Automatic Lighting with the ESP32 PIR Motion Sensor

In this project, we will use the HC-SR501 PIR motion sensor to detect when someone enters the room and automatically turn on the LED. We will track how long the LED stays on using `millis()`; each HIGH reading from the sensor will update the last motion time, and the LED will turn off at least 10 seconds after the last HIGH reading. The current code also waits 50 ms in each loop with `delay(50)`, so the application loop is not fully non-blocking. In real-life applications, it can be used for sta

4.4(24)
38 completed
Automatic Lighting with the ESP32 PIR Motion Sensor

Source Code

This project also comes with blocks. Like the code, they unlock with Premium. What is block coding?

Premium Content

Become Premium to view the source code

Unlock Everything with Premium

All project code, FAQ sections, and troubleshooting guides for Premium members. Buy in the mobile app.

FAQ

Premium Content

Become Premium to see FAQs

Unlock Everything with Premium

All project code, FAQ sections, and troubleshooting guides for Premium members. Buy in the mobile app.

Automatic Lighting with the ESP32 PIR Motion Sensor | BlueGrays