Difference between revisions of "PIR Sensor Brick"
(→Electrical Characteristics) |
(→Demo) |
||
Line 48: | Line 48: | ||
==Demo== | ==Demo== | ||
+ | Connect S port of electronic brick of PIR sensor to D2 port of Arduino board, and we will use the following program to read its digital value. If the digital value read is high level, LED lamp will be ON; when the digital value read is low level, LED lamp will be OFF. | ||
+ | |||
+ | int PIR=2; //connect tilt to D2 | ||
+ | int LED=13; | ||
+ | void setup() | ||
+ | { | ||
+ | pinMode(LED, OUTPUT); | ||
+ | pinMode(PIR, INPUT); | ||
+ | } | ||
+ | void loop() | ||
+ | { | ||
+ | if(digitalRead(PIR)==HIGH) //when the digital output value of PIR is high, turn on the LED. | ||
+ | { | ||
+ | digitalWrite(LED, HIGH); | ||
+ | } | ||
+ | if(digitalRead(PIR)==LOW) //when the digital output value of PIR is low, turn off the LED. | ||
+ | { | ||
+ | digitalWrite(LED, LOW); | ||
+ | } | ||
+ | } | ||
==Download== | ==Download== | ||
==Useful Links== | ==Useful Links== |
Revision as of 03:10, 27 May 2014
Contents
Overview
Electronic brick of PIR sensor can be connected to digital I/O port and used in anti-theft system or to control lights in the staircase of buildings. When sensor detects the infrared signals of human body, it outputs high level; generally speaking, it outputs low level.
Features
1. Plug and play, easy to use. Compatible with the mainstream 2.54 interfaces and 4-Pin Grove interfaces in the market.
2. With use of M4 standard fixed holes, compatible with M4-standard kits such as Lego and Makeblock.
Specifications
PCB size | 24.0mm X 21.0mm X 1.6mm |
Working voltage | 5V DC |
Operating voltage | 3.3V DC |
Compatible interfaces | 2.54 3-pin interface and 4-pin Grove interface(1) |
Note 1: S for digital output port, V and G for voltage at the common collector and ground respectively
Electrical Characteristics
Parameter | Min. | Typical | Max. | Unit |
Working voltage | 4.5 | 5 | 20 | VDC |
Digital output voltage(VCC=5V) | 0 | - | 3.3 | V |
Working current(VCC=5V) | - | 50 | - | uA |
Detection angle(solid angle) | - | - | 110 | ° |
Detection range | - | - | 7 | m |
Delay time of high level | - | 2.5 | - | s |
Demo
Connect S port of electronic brick of PIR sensor to D2 port of Arduino board, and we will use the following program to read its digital value. If the digital value read is high level, LED lamp will be ON; when the digital value read is low level, LED lamp will be OFF.
int PIR=2; //connect tilt to D2 int LED=13; void setup() { pinMode(LED, OUTPUT); pinMode(PIR, INPUT); } void loop() { if(digitalRead(PIR)==HIGH) //when the digital output value of PIR is high, turn on the LED. { digitalWrite(LED, HIGH); } if(digitalRead(PIR)==LOW) //when the digital output value of PIR is low, turn off the LED. { digitalWrite(LED, LOW); } }