8.ARDUINO BASED MOTION DETECTOR
PIR sensors are those which scans its environment and fixes its reference value.When there is any movement in the scanned region it sends out a analog signal.The analog signal is converted to a digital signal for convenience using a comparator and the digital signal is analysed using an Arduino.
DIAGRAM
PIR motion sensor connectivity with Arudino |
Sketch
// THE FOLLOWING SKETCH BLINKS AN LED IF THERE IS A MOTION IN THE RANGE OF THE SENSOR
void setup()
{
pinMode(2,INPUT); //sensor input
pinMode(13,OUTPUT); // on board LED
}
void loop()
{
int sensorinput=digitalRead(2);
if(sensorinput==HIGH)
{
digitalWrite(13,HIGH);
}
else
{
digitalWrite(13,LOW);
}
}
PIR CALLIBRATION
You will notice two potentiometer on the PIR sensors one would be to adjust the sensitivity of the sensor and other would be for the delay time of the sensor.
1st potentiometer is used for sensitivity ie it controles the scan ranging ratio for fixing the referance value.
2nd potentiometer is used for the time adjustment ie when the PIR is triggered with a motion it sends out an analog output ( digital output if the analog value is sent to an comparator) and waits for a particulat time for rescanning for the referance value again. Adjusting this would be to increase or decrease the delay time of the sensor.