Objective:

To learn PIR Sensor and Programming for Automatic LED ON/OFF using Motion sensor.

Introduction:

1.PIR Sensor:

A Passive infrared sensor (PIR Sensor) is an electronic sensor that can also detect movement of objects that radiate infrared light .therefore, using these sensor to detect human movement or occupancy in security systems is very common. The detection range is between 5m to 12 m. PIR are fundamentally made of a pyro electric sensor ,which can detect levels of infrared radiation.

PIR sensor having a 3-pin connection at the side or bottom .One pin will be ground , another will be signal and the last pin will be power. power is usually up to 5V.

Pin Description For PIR Sensor

Task 02 : Automatic LED ON/OFF using PIR sensor

Task To On/Off LED using Motion detector sensor

Equipment’s :

  • Arduino UNO(1)
  • PIR Sensor(1)
  • Bread Board(1)
  • LED (1)
  • Resistor 220 ohm (1)
  • Jumping Wires

Software Used:

  1. Arduino UNO
  2. Tinker CAD

Connections:

Connection Diagram using Tinker CAD

Sketch:

int led = 13;
int sensor = 2;

void setup() {
pinMode(led, OUTPUT);
pinMode(sensor, INPUT);
Serial.begin(9600);
}

void loop()

{
int sensorval = digitalRead(sensor);
Serial.println(sensorval);

if (sensorval == HIGH)

{
digitalWrite(led, HIGH);
}
else {
digitalWrite(led, LOW);
}
}


Algorithm:

  1. Sensor detect a motion ,then value of input pin is HIGH; this will turn LED On.
  2. sensor not detect a motion, then value of pin is LOW; this will turn LED Off.
  3. when sensor detect a motion, this process will repeated.

Applications:

PIR Sensors can be used to:

  • Automate opening and closing of door.
  • Automate lift lobby.
  • Automate light of basements.