Introduction
A Passive Infrared (PIR) motion sensor is a device commonly used in security systems, lighting control, and other applications to detect the presence of a moving object or person by measuring changes in infrared radiation. It’s called “passive” because it doesn’t emit any energy itself; it only detects the infrared radiation emitted by objects in its field of view.
- Detection Principle: PIR sensors work based on the fact that all objects with a temperature above absolute zero (-273.15°C or -459.67°F) emit infrared radiation. PIR sensors are designed to detect changes in the amount of infrared radiation in their surroundings.
- Sensor Construction: A PIR sensor typically consists of two pyroelectric sensors, which are sensitive to changes in temperature, and a special Fresnel lens that focuses the infrared radiation onto these sensors.
Circuit
connection
IR_VCC – 5v
IR_GND – GND
IR_OUTPUT – D7
LED+ to D9
LED- to GND
Resistance -270
Code
Create a circuit as per the above circuit diagram
- From control drag if -else block.
- From the Arduino sensor palette, add a “read digital sensor () at ()” block. Choose “PIR” as the sensor type and select pin 7.
- The sensor’s detection of an object will alter the status of pin 7 from LOW to HIGH. In response to object detection, add the “set digital pin () output as ()” block from the Arduino palette within the “if” block.
- For the “else” part, ensure the LED turns off when no object is in front of the sensor.
- Drag a “forever” block from the controls palette and place the above set of blocks inside it.
- finally, add when flag clicked block from events palette
Script
Output
OUTPUT will be updated soon