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. 


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



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(){
pinMode(sensor, INPUT); // assign the pin mode type of the pin as input or output
pinMode(buzzer, OUTPUT);
void loop(){
digitalWrite(buzzer, HIGH);
DigitalWrite(buzzer, LOW);


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.