ESP32 Motion Detection System Using PIR Sensor, LCD & LED

by mansiramteke139 in Circuits > Sensors

223 Views, 1 Favorites, 0 Comments

ESP32 Motion Detection System Using PIR Sensor, LCD & LED

20260314_170414[1].jpg

In this Project, I build a Motion Detection System using ESP32 and PIR Motion Sensor. The PIR sensor detects movement by sensing changes in infrared radiation from the human body.

When motion is detected, the ESP32 displays a warning message on the 16*2 LCD display and turns on an LED indication.

When no motion is detected, the LCD shows that the area is safe.

This project is useful for learning about motion sensors, microcontrollers and security system basics.

Supplies

Screenshot 2026-03-14 171637.png
Screenshot 2026-03-14 171656.png
Screenshot 2026-03-14 171711.png
20260314_170451[1].jpg
20260314_170444[1].jpg

Components list:

  1. ESP32 DEV MODULE
  2. PIR Motion Sensor (HC-SR501)
  3. 16*2 LCD Display
  4. I2C Module
  5. Breadboard
  6. Jumper wires

About PIR Sensor

Screenshot 2026-03-14 152313.png
Screenshot 2026-03-14 153143.png
Screenshot 2026-03-14 152345.png

PIR Sensor:

PIR Sensor (Passive Infrared) sensor is used to detect motion of humans or animals by sensor changes in infrared radiation emitted by warm bodies. When a person moves in front of the sensor, the PIR module detects the change in infrared energy and send the signals to the microcontroller.

PIR sensor are widely used in security system, automatic lighting, motion detectors, and smart home automation because they are low power and easy to use.

Important

There are difference between PIR Sensor and Ultrasonic Sensor:

  1. PIR SENSOR detects infrared radiation from body heat whereas ULTRASONIC SENSOR works on sound waves.
  2. PIR SENSOR detects the human and animal whereas ULTRASONIC SENSOR detects distance of object.
  3. The output of PIR SENSOR is in HIGH or LOW depends on the Motion Detection and in ULTRASONIC SENSOR output can be seen in cm depends on the Distance Measurement.

Connections

PIR SENSOR - ESP32

GND - GND

OUT - GPIO 27

VCC - VIN (5V)


LCD (I2C) - ESP32

GND - GND

VCC - VIN (5V)

SDA - GPIO 13

SCL - GPIO 14


LED - ESP32

LED + - GPIO 2

LED - - GND


  1. Before Uploading the code, install the library LiquidCrystal_I2C Library from the Arduino Library Manager

CODE

OUTPUT

20260314_170504[1].jpg
20260314_165410[1].jpg

WOKRING

  1. The PIR Sensor continuously monitor infrared radiation in its surrounding.
  2. When a human moves in front of the sensor.
  3. The PIR Sensor send a High Signals to the ESP32, Indicating motion detection.
  4. The lcd displays MOTION DETECTED and turn on the LED.
  5. If no movements is detected, the sensor sends LOW signals.
  6. Then LCD will show No MOTION, AREA SAFE and turn off LED.

CONCLUSION

Such systems are commonly used in security alarm, automatic lighting systems, and smart automations.