What is a PIR Sensor?
PIR sensors are small electronic devices that detect motion. PIR stands for “Passive Infrared.” These sensors detect changes in temperature in their surroundings.
How Do PIR Sensors Work?
Inside PIR sensors, there is a special material that detects infrared light. Humans and animals emit body heat. The PIR sensor detects changes in this heat. If a person or animal passes in front of the sensor, it senses this and sends a signal. This signal can trigger an alarm or turn on a light.
Uses of PIR Sensors:
- Security Systems: Used in homes and businesses as burglar alarms. If someone enters, the sensor detects the motion and sounds the alarm.
- Automatic Lights: Used in rooms or outdoor areas to turn lights on automatically when someone passes by.
- Robotic Projects: Robots can detect movement around them and respond accordingly.
Benefits of PIR Sensors:
- Energy Savings: Save energy by turning lights on only when someone is present.
- Security: Can detect intruders and unwanted visitors.
- Easy Installation: Small and lightweight, making them easy to install.
PIR sensors generally have 3 pins. These are VCC (power +), GND (power -), and OUT (signal). When making our connections, we apply +5V DC to the VCC pin, 0V DC to the GND pin, and connect the OUT pin to the Arduino pin where we will measure the signal. The circuit diagram below will help you.
Now let’s move on to the program. In the program below, we first check the pin to which the PIR sensor is connected. If information is coming from the PIR sensor, we set digital pin 2 to high to turn on the LED. If not, we set it to low to turn off the LED.