Connecting the HW-416-B to your microcontroller is straightforward.
int motionPin = 2; int ledPin = 13;
The HW-416-B is a pyroelectric infrared motion sensor module. It detects infrared radiation (heat) emitted by humans, animals, or objects moving within its field of view.
The HW-416-B is more than just a motion detector; it is an energy-efficient trigger. While newer, more expensive "radar" sensors (like the RCWL-0516) can detect motion through walls, the HW-416-B remains the reliable workhorse for line-of-sight detection. It is cheap, tunable, and consumes so little power that it might just be the longest-lasting component in your next battery-operated build.
Turning the Sx potentiometer clockwise increases the detection distance (up to ~7m). Turning it counter-clockwise reduces it (down to ~3m). hw-416-b pir sensor datasheet
The HW-416-B (often referred to interchangeably as HW-416, HW-416B, or HC-SR501) is a passive infrared (PIR) motion sensor module widely adopted in Arduino, ESP32, and Raspberry Pi projects worldwide. This comprehensive datasheet and reference guide provides engineers, makers, and electronics enthusiasts with all the essential information needed to successfully integrate and deploy this versatile human body detection sensor in security systems, smart lighting, home automation, and industrial monitoring applications.
Increases the output high duration (up to ~200 seconds).
Ensure the supply is stable. While rated up to 20V, 5V is generally optimal for hobby projects. If you are interested, I can: Explain how to increase the range beyond 7 meters.
Note: Always let the PIR sensor warm up for 30–60 seconds after powering on. During this time the output may be erratic or stay HIGH, but it will stabilise once the sensor has calibrated to the ambient conditions. The HW-416-B is more than just a motion
The fresnel lens in front of the sensor focuses IR radiation; sensitivity adjusts how much signal change is required to trigger the output. Higher sensitivity extends range but may increase susceptibility to false triggers from small animals or environmental fluctuations.
Always verify the specific variant’s features (e.g., presence of photoresistor/thermistor headers, voltage regulator type) before purchasing for specialized applications.
Decreases sensitivity (reduces range, reduces false alarms). B. Time Delay Adjustment (TIME)
The sensor requires 30 to 60 seconds to calibrate its baseline environment upon powering up. Random triggers during this period are normal. 4. Hardware Adjustments (Potentiometers & Jumpers)
void setup() Serial.begin(9600); pinMode(pirPin, INPUT); pinMode(ledPin, OUTPUT);
| Pin | Name | Description | |-----|--------|------------------------------------| | 1 | VCC | 4.5V – 20V DC power input | | 2 | GND | Ground | | 3 | OUT | Digital output (HIGH = motion) |
| Pin Number | Pin Name | Description | | :--- | :--- | :--- | | 1 | | Power input (5V – 20V DC) | | 2 | OUT | Digital output: HIGH when motion detected, LOW when idle | | 3 | GND | Ground (0V) |
Note: The sensor is usually powered via VCC and GND, and the OUT pin sends a signal to a microcontroller (like Arduino, Raspberry Pi) or a transistor to trigger a relay. 4. Hardware Adjustments (Potentiometers & Jumpers)