Motion Detection With IR Sensor

An infrared sensor (IR sensor) is an optoelectronic component sensitive to radiation with spectral sensitivity within the infrared wavelength range 780 nm to 50 µm. IR sensors are now widely used in motion detectors, which are used in building services to turn on lights or alarm systems to detect undesirable guests.

The applications of IR sensors are vast for example, flame monitors, gas detectors, moisture analyzer, water analysis, and many more. 

Requirements

The requirements to make the IR sensor functional are as follows

  1. Arduino UNO
  2. IR Sensor
  3. Piezo Buzzer
  4. Pin to hole Jumper wires
  5. Bread board (optional)

IR Sensor Pinout

Schematics

Code

Upload the code below to your Arduino board

				
					//note:- this code is for digital value
int sensor=7; //initializing the digital pin
int buzzer=13; // initializing buzzer pin
int value;
void setup(){
Serial.begin(9600);
pinMode(sensor, INPUT); // assign the pin mode type of the pin as input or output
pinMode(buzzer, OUTPUT);
}
void loop(){
if(digitalRead(sensor)==HIGH){
digitalWrite(buzzer, HIGH);
}
else{
DigitalWrite(buzzer, LOW);
}
}
				
			

Conclusion

Hence, when the motion shall be detected by IR sensor the buzzer shall turn on.

Leave a Reply

Your email address will not be published.