Monday 22 January 2018

PIR Sensor – How to Use it?

Introduction:

A PIR sensor is an electronic device that measures infrared radiation emitted by the objects in its field of view. PIR sensor does not emit any radiation, they truly depends and works on the infrared radiation emitted or reflected by the objects.
All objects with a temperature above absolute zero emit heat energy in the form of radiation.  Human eye is not capable of detecting those radiations. So, here specific sensors like PIR sensors are used.

Usage:

Nowadays PIR sensors are widely used but there are few places where they play a major role i.e. Automatic door opening system, Robotics, Deferential Detection, etc.

Application:

Project for Reference:

Code:

void setup()
{
  // initialize serial communication at 9600 bits per second: 
  Serial.begin(9600);
  pinMode(13,OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() 
{
  // read the input on analog pin 0:
  int sensorValue = digitalRead(2);
  // print out the value you read:
  Serial.println(sensorValue);
  if(sensorValue<500)
  {
     digitalWrite(13,HIGH);
  }
  else
  {
    digitalWrite(13,LOW);
  }
  delay(1); // delay in between reads for stability
}

No comments:

Post a Comment

SMART BLIND STICK The smart blind stick is the project made to help the blind people who is suffering when walking.It just uses to de...