You are on page 1of 6

PIR-sensor-based Electronic Device

Control with Ultra-low


Standby Power Consumption

PIR Sensor used:


A passive infrared sensor (PIR sensor) is an electronic sensor that
measure infrared (IR) light radiating from objects in its field of view. All objects with a
temperature above absolute zero emit heat energy in the form of radiation. Usually this
radiation isn't visible to the human eye because it radiates at infrared wavelengths, but it can
be detected by electronic devices designed for such a purpose.
The term passive in this instance refers to the fact that PIR devices do not generate or
radiate energy for detection purposes. They work entirely by detecting infrared radiation
emitted by or reflected from objects.
Specs:
Power supply: 5V-12V input voltage for most modules (they have a 3.3V regulator),
but 5V is ideal in case the regulator has different specs
Output: Digital pulse high when triggered (motion detected) digital low when idle
(no motion detected). Pulse lengths are determined by resistors and capacitors on the
PCB and differ from sensor to sensor.
Sensitivity range: up to 20 feet (6 meters) 110 x 70 detection range
Delay Time and Sensitivity adjustable.

LDR Sensor used:


LDR is known as Light Dependent Resistor. It varies it resistance based on the
intensity of the light that falls on its surface.

Specs:
Resistance : 20K to 100K

Dark Resistance : 1M

Operating Temperature Range: -60C to 75 C

Voltage rating used : 5V

Power dissipation : 50mW

Sensors Tested and implemented:


PIR sensor was tested and checked for motion of objects. The PIR sensor produced
HIGH value when it sensed motion and LOW when no motion was detected.
LDR sensor was tested to detect the intensity of the light in a room. The LDR gave
different Analog output values for different intensities of light.
The overall circuit was build in which,
PIR was used to detect motion.
LDR was used to detec intensity of ambient light.
The AC light was turned on/off depending on the values from above
sensors.
Codes:
PIR Sensor Code:
if (state == LOW) {
int led = 13; // the pin that the
LED is atteched to Serial.println("Motion detected!");

int sensor = 2; // the pin that the state = HIGH; // update variable
sensor is atteched to state to HIGH

int state = LOW; // by default, no }


motion detected
}
int val = 0; // variable to store
the sensor status (value) else {

digitalWrite(led, LOW); // turn LED


OFF
void setup() {
delay(200); // delay 200
pinMode(led, OUTPUT); // initalize milliseconds
LED as an output

pinMode(sensor, INPUT); // initialize


sensor as an input if (state == HIGH){

Serial.begin(9600); // initialize serial Serial.println("Motion stopped!");

} state = LOW; // update variable


state to LOW

}
void loop(){
}
val = digitalRead(sensor); // read sensor
value }

if (val == HIGH) { // check if the


sensor is HIGH

digitalWrite(led, HIGH); // turn LED


ON

delay(100); // delay 100


milliseconds
PIR code working:
PIR is attached to Digital Pin 2 and initialized as INPUT Pin. An LED is connected to
Pin 13 and initialized as OUTPUT Pin.

When Motion is detected : LED turns on. STATE of circuit is HIGH.


When Motion is not detected : LED turns off. STATE of circuit is LOW.

LDR Code:
int sensorPin = A0; // select the input pin for LDR

int sensorValue = 0; // variable to store the value coming from the sensor

void setup() {

Serial.begin(9600); //sets serial port for communication

void loop() {

sensorValue = analogRead(sensorPin); // read the value from the sensor

Serial.println(sensorValue); //prints the values coming from the sensor on


the screen

delay(100);

LDR code working:


LDR is connected to the Analog Pin A0 and gives value to the Arduino. LDR is
connected with a 100k resistor and output is taken along the junction of these two resistors.
Thus when light falls on LDR, the resistance value varies and thereby the output voltage
varies.

LDR was checked

In a room with very low light.


In a room with light turned on.
Using a torch emitting light over the LDR.
Overall working:
int sensorPin = A0; // select the input pin void loop() {
for ldr
// read the value from the sensor:
int sensorValue = 0; // variable to store the
val = digitalRead(sensor);
value coming from the sensor
sensorValue = analogRead(sensorPin);
int led = 13; // the pin that the
LED is atteched to Serial.print("LDR Value:");

int sensor = 2; // the pin that the Serial.println(sensorValue);


sensor is atteched to
//prints the values coming from the sensor
int state = LOW; // by default, no on the screen
motion detected
if( val == HIGH && sensorValue < 200)
int relay = 7; //setting a threshold value

int val = 0; // variable to store {


the sensor status (value)
digitalWrite(led, HIGH); // turn LED
ON

void setup() { digitalWrite(relay, LOW);

pinMode(led, OUTPUT); // initalize Serial.println("Motion detected!");


LED as an output
Serial.println("Light On!");
pinMode(relay, OUTPUT);
delay(1000);
pinMode(sensor, INPUT); // initialize
sensor as an input }

pinMode(sensorPin, INPUT); else if( val == HIGH && sensorValue >=


200) {
Serial.begin(9600); //sets serial port for
communication digitalWrite(led, LOW); // turn LED
OFF
}
digitalWrite(relay, HIGH);

Serial.println("Motion detected!");

Serial.println("Light Off!");

delay(1000); // delay 200


millisecond

}
else {

digitalWrite(led, LOW); // turn LED OFF

digitalWrite(relay, HIGH);

Serial.println("Motion stopped!");

Serial.println("Light Off!");

delay(1000); // delay 200 milliseconds

Working:
PIR sensor is connected to Digital Pin and initialized as INPUT.
LDR is connected to Analog Pin and initialized as INPUT.
An LED is connected to Pin 13 and initialized as OUTPUT.
A Relay is connected to Pin 7 and is used to switch the AC Lamp.

The circuit is tested as:

CASE 1 : When no motion is detected => PIR is OFF => AC Lamp and LED are
in OFF state.
CASE 2 : When motion is detected => PIR is on
Ambient light not suffice => AC Lamp and LED are in ON state.
CASE 3 : When motion is detected => PIR is on
Ambient light suffice => AC Lamp and LED are in OFF state.

You might also like