HC-SR501 PIR Motion Sensor Tutorial
Introduction
The HC-SR501 is a passive infrared (PIR) motion sensor commonly used in smart home and security applications. It detects infrared radiation emitted by human bodies.
Working Principle
The HC-SR501 works by detecting changes in ambient temperature. When a human enters the sensor's detection range, the infrared radiation emitted by the human body causes a temperature change, triggering the sensor to output a high signal.
Key Features
- High sensitivity: Can detect weak infrared radiation changes.
- Low power consumption: Very low static current, suitable for battery-powered applications.
- Adjustable parameters: Detection distance and delay time can be adjusted.
- Digital output: Outputs a digital signal that can be directly connected to a microcontroller.
Pin Description
- VCC: Power supply positive, typically 5V.
- GND: Power supply negative.
- OUT: Digital output signal, high level indicates human detection.
Parameter Settings
- Detection distance: The detection distance can be adjusted by adjusting the potentiometer on the module.
- Delay time: The duration of the high output level can also be adjusted by the potentiometer.
Applications
- Smart home: Automatic lights, automatic curtains, etc.
- Security monitoring: Human intrusion alarm.
- Robot obstacle avoidance: Realize obstacle avoidance function.
Usage
- Hardware connection: Connect the VCC and GND pins of the HC-SR501 module to the positive and negative poles of the power supply, respectively, and connect the OUT pin to the digital input pin of the microcontroller.
- Software programming: Write a program in the microcontroller to read the state of the OUT pin and perform corresponding processing based on the state.
Precautions
- The HC-SR501 module is sensitive to temperature, and changes in ambient temperature can affect its detection performance.
- The installation position and angle of the module will affect the detection range.
- Long-term operation may cause the module's sensitivity to decrease.