Hw416b Pir Sensor Datasheet Better ★ Essential & Recommended
Because the HW-416B can give false triggers on power-up, use this code instead of the basic "Blink" sketch:
const int PIRpin = 2; int pirState = LOW; int val = 0;void setup() Serial.begin(9600); pinMode(PIRpin, INPUT); Serial.println("HW-416B Warming up (30 sec)..."); delay(30000); // CRITICAL: Let the sensor stabilize hw416b pir sensor datasheet better
void loop() val = digitalRead(PIRpin);
if (val == HIGH && pirState == LOW) Serial.println("Motion Detected!"); pirState = HIGH; else if (val == LOW && pirState == HIGH) Serial.println("Area Clear"); pirState = LOW; delay(100); // Small debounceBecause the HW-416B can give false triggers on
| Parameter | Value | Notes | | :--- | :--- | :--- | | Operating Voltage | DC 5V – 20V | Optimal performance at 5V or 12V | | Static Current | < 50 µA | Ultra-low power for battery applications | | Output Signal | 3.3V TTL (HIGH / LOW) | Compatible with 5V microcontrollers (3.3V logic is safe for 5V pins via voltage divider) | | Detection Angle | < 120° (cone shape) | Adjustable via lens masking | | Detection Distance | 3 – 7 meters (adjustable) | Factory default: ~5 meters | | Time Delay Adjust | 0.3 sec – 5 minutes (variable) | Two potentiometers control this | | Trigger Modes | Single (non-repeatable) / Repeatable (retriggering) | Jumper-selectable | | Operating Temperature | -15°C to +70°C | Reduced sensitivity in extreme cold | | Lens Type | Fresnel lens (white/translucent) | Included on top of the pyroelectric element | void loop() val = digitalRead(PIRpin); if (val ==
The most immediate advantage of this style of sensor is the size.
