Course Content
IoT Engineering Course using ESP32 with 12 Real-World Projects

📘Home Security System

🎯 Objective of This Lesson

Students will learn:

  • What is motion detection

  • What is a PIR sensor

  • How PIR detects human movement

  • Internal working principle

  • Types of PIR sensors

  • Applications in real world


🔍 What is Motion Detection?

Motion detection means:

Detecting movement of a person or object in a specific area.

In home security systems, motion detection is used to:

  • Detect intruders

  • Trigger alarms

  • Turn ON lights automatically

  • Send security alerts


🌡 What is PIR Sensor?

PIR stands for:

Passive Infrared Sensor

It is called passive because:

  • It does NOT emit energy

  • It only detects infrared radiation from objects

Every human body emits infrared radiation (heat).

PIR sensor detects change in infrared levels.


🧠 Working Principle of PIR Sensor

The PIR sensor works based on:

👉 Infrared radiation detection

Step-by-step working:

1️⃣ Human body emits infrared radiation
2️⃣ PIR sensor detects heat energy
3️⃣ When a person moves, infrared level changes
4️⃣ Sensor detects this change
5️⃣ Output pin becomes HIGH
6️⃣ ESP32 reads motion detected

Important:

PIR detects motion, not presence.
If a person stands still → sometimes no detection.


🔬 Internal Structure of PIR Sensor

Inside PIR module:

  • Pyroelectric sensor element

  • Fresnel lens (white dome)

  • Amplifier circuit

  • Comparator circuit

  • Output stage


🔹 Pyroelectric Sensor

This is the core sensing element.

It detects change in infrared radiation.

When IR radiation changes → small voltage is generated.


🔹 Fresnel Lens

The white dome cover:

  • Focuses infrared signals

  • Increases detection range

  • Divides detection area into zones


📡 How PIR Detects Movement

The sensor has two sensing slots.

When a person moves:

  • First slot detects heat

  • Then second slot detects heat

  • This difference creates signal

  • Motion is detected

No movement → no change → no output.


🔌 PIR Sensor Pin Description

Most common PIR module (HC-SR501 type) has 3 pins:

Pin Function
VCC 5V power
GND Ground
OUT Digital Output

Output:

LOW → No motion
HIGH → Motion detected


⚙ Adjustable Settings on PIR

Most PIR modules have two potentiometers:

1️⃣ Sensitivity Adjustment

  • Adjust detection range

2️⃣ Time Delay Adjustment

  • Adjust how long output stays HIGH

There is also a trigger mode jumper:

  • H mode (Retriggerable)

  • L mode (Non-Retriggerable)


📏 PIR Detection Range

Typical values:

  • Range: 5 to 7 meters

  • Angle: 110° to 120°

Depends on module and adjustment.


🔋 Power Requirements

  • Operating Voltage: 5V

  • Output Signal: 3.3V – 5V compatible

  • Safe for ESP32 digital input


🏠 Real-World Applications

PIR sensors are used in:

  • Home security systems

  • Automatic lights

  • Motion cameras

  • Smart door alarms

  • Energy saving systems

  • Smart classrooms


⚠ Important Limitations

Students must understand:

  • Cannot detect through walls

  • Sensitive to temperature changes

  • Can be triggered by pets

  • Needs warm-up time (30–60 seconds)


⏳ Warm-Up Time

After power ON:

  • Wait 30–60 seconds

  • Sensor stabilizes

  • During this time output may fluctuate


🎓 Learning Outcomes

After this lesson, students understand:

  • What is infrared radiation

  • What is passive sensor

  • How PIR detects motion

  • Difference between motion & presence

  • Practical security sensor basics

Scroll to Top