PIR Sensor

Description

     Guys, In this project, we will learn about PIR Sensor and how can it be used as a Motion Sensor. By going through this project, you can understand how PIR Sensor works. Every object, with its surface temperature greater than absolute zero i.e. -273 degree celsius emits heat in the form of infrared radiation. Humans cannot see this radiation as the radiations are in the infrared wavelength. But PIR Sensors detect these radiations and change them into appropriate electrical signals. We are doing this project on the basis of this phenomenon. Okay, let's make it.
      
Components Required

 1. Arduino UNO                                  * 1
 2. PIR Sensor                                       * 1
 3. Buzzer(5V)                                       * 1
 4. Jumper Wires                                    * 1

Circuit Diagram


Program
 
int buzzer = 3;
int sensor = 2;
int led = 4;
void setup() 
{
  pinMode(buzzer, OUTPUT);
  pinMode(sensor, INPUT);
  pinMode(led, OUTPUT);
  
  digitalWrite(buzzer,LOW);
  digitalWrite(sensor,LOW);
  
  digitalWrite(led,LOW);

  while(millis()<13000)
  {
    digitalWrite(led,HIGH);
    delay(50);
    digitalWrite(led,LOW);
    delay(50);
  }
  digitalWrite(led,HIGH);
  
}

void loop() 
{
  if(digitalRead(sensor)==HIGH)
  {
   digitalWrite(buzzer,HIGH);
   delay(3000);
   digitalWrite(buzzer,LOW); 
   while(digitalRead(sensor)==HIGH);
  }

}