Circuit
Connecting PIR Sensor with ESP32
We will connect the HC-SR501 PIR sensor to the ESP32-C5 as shown below. The sensor is powered from the 5V pin, while its OUT signal is connected to GPIO 10. Whenever motion is detected, the sensor outputs a HIGH signal on GPIO 10.
| ESP32-C5 Pin | Wire | PIR Sensor Pin |
|---|---|---|
| GPIO 10 |
|
OUT (middle pin) |
| 5V |
|
VCC |
| GND |
|
GND |
Buzzer Pin Connection:
We will connect the positive pin of the buzzer to GPIO 24, while the negative pin connects to GND. This allows us to control the buzzer and produce a sound when motion is detected.
| ESP32-C5 Pin | Wire | Buzzer Pin |
|---|---|---|
| GPIO 24 |
|
Positive Pin |
| GND |
|
Negative Pin |