Automatic Door Opener using PIR Sensor

16
MOVEMENT SENSED AUTOMATIC DOOR OPENING SYSTEM REPORT MFD14I013 MPD14I007 MPD14I008 MPD14I012 Introduction: The project is designed for automatic door opening system using PIR sensor. Opening and closing of doors is always a tedious job, especially in places like shopping malls, hotels and theatres where a person is always required to open the door for visitors. This project proposes a system of automatic opening and closing of door by sensing any body movement near the door. This is achieved with help of a PIR (Passive Infrared) sensor. A live body generally emits infrared energy which is sensed by the PIR sensor from a considerable distance. This sensing signal is fed to a microcontroller to operate a door motor through motor driver IC. When a body approaches within the operating range of the sensor, it sends a logical command to open the door. The door automatically closes with a fixed time delay. If there is no further movement within the PIR operating range. Interrupt signals are used through limit switches to avoid locked rotor condition of the motor. HARDWARE REQUIREMENTS: 1. Arduino UNO 2. LCD 3. PIR Sensor 4. Connecting wires 5. Bread board 6. 1 k resistor 7. Power supply 8. Motor driver L293D SOFTWARE REQUIREMENTS Language: Arduino software

Transcript of Automatic Door Opener using PIR Sensor

Page 1: Automatic Door Opener using PIR Sensor

MOVEMENT SENSED AUTOMATIC DOOR OPENING

SYSTEM REPORT MFD14I013

MPD14I007

MPD14I008

MPD14I012

Introduction:

The project is designed for automatic door opening system using PIR

sensor. Opening and closing of doors is always a tedious job, especially in places

like shopping malls, hotels and theatres where a person is always required to open

the door for visitors.

This project proposes a system of automatic opening and closing of door by

sensing any body movement near the door. This is achieved with help of a PIR

(Passive Infrared) sensor. A live body generally emits infrared energy which is

sensed by the PIR sensor from a considerable distance. This sensing signal is fed

to a microcontroller to operate a door motor through motor driver IC. When a

body approaches within the operating range of the sensor, it sends a logical

command to open the door. The door automatically closes with a fixed time delay.

If there is no further movement within the PIR operating range. Interrupt signals

are used through limit switches to avoid locked rotor condition of the motor.

HARDWARE REQUIREMENTS:

1. Arduino UNO

2. LCD

3. PIR Sensor

4. Connecting wires

5. Bread board

6. 1 k resistor

7. Power supply

8. Motor driver L293D

SOFTWARE REQUIREMENTS

Language: Arduino software

Page 2: Automatic Door Opener using PIR Sensor

BLOCK DIAGRAM

PIR MOTION SENSOR:

Page 3: Automatic Door Opener using PIR Sensor

Overview:

PIR sensors allow you to sense motion, almost always used to detect whether a human has moved in or out of the sensors range. They are small, inexpensive, low-power, easy to use and don't wear out. They are often referred to as PIR, "Passive Infrared", "Pyroelectric", or "IR motion" sensors. PIRs are basically made of pyro electric sensor which can detect levels of infrared radiation. Everything emits some low-level radiation, and the hotter something is, the more radiation is emitted. The sensor in a motion detector is actually split in two halves. The reason for that is that we are looking to detect motion (change) not average IR levels. The two halves are wired up so that they cancel each other out. If one half sees more or less IR radiation than the other, the output will swing high or low. Along with the pyroelectric sensor is a bunch of supporting circuitry, resistors and capacitors. Some PIR Sensors use the BISS0001 (Micro power PIR Motion detector IC) which is very inexpensive chip. This chip takes the output of the sensor and does some minor processing on it to emit a digital output pulse from the analog sensor. PIR sensors are cheap, consumes low power, have a wide lens range, and are easy to interface.

Details:

Size: Rectangular;

Price: $10;

Output: Digital pulse high (3V) when triggered (motion detected) and digital low when idle.

Sensitivity Range: up to 20 feet (6 meters) 110° x 70° detection range

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

Page 4: Automatic Door Opener using PIR Sensor

BISS0001: Micro Power PIR Motion Detector IC

Features:

Low power CMOS technology (ideal for battery operated PIR devices)

CMOS high input impedance operational amplifiers

Bi-directional level detector / Excellent noise immunity

Built-in Power up disable & output pulse control logic

Dual mode: retriggerable & non-retriggerable

HOW PIRs WORK

The PIR sensor itself has two slots in it, each slot is made of a special material that is sensitive to IR. When the sensor is idle, both slots detect the same amount of IR, the ambient amount radiated from the room or walls or outdoors. When a warm body like a human or animal passes by, it first intercepts one half of the PIR sensor, which causes a positive differential change between the two halves. When the warm body leaves the sensing area, the reverse happens, whereby the sensor generates a negative differential change. These change pulses are what is detected.

Page 5: Automatic Door Opener using PIR Sensor

The IR sensor itself is housed in a hermetically sealed metal can to improve

noise/temperature/humidity immunity. There is a window made of IR-

transmissive material (typically coated silicon since that is very easy to come by)

that protects the sensing element.

Lenses:

PIR sensors are almost same but they vary in price and sensitivity. The PIR sensor and circuitry is fixed and costs a few dollars and the lens costs very less and can change the breadth, range, sensing pattern, very easily. the lens is just a piece of plastic, but that means that the detection area is just two rectangles. Usually we'd like to have a detection area that is much larger. To do that, we use a simple lens such as those found in a camera, they condense a large area (such as a landscape) into a small one (on film or a CCD sensor). we would like to make the PIR lenses small and thin and moldable from cheap plastic, even though it may add distortion. For this reason, the sensors are actually Fresnel lens

Page 6: Automatic Door Opener using PIR Sensor

The Fresnel lens condenses light, providing a larger range of IR to the sensor. we don’t want two really big sensing-area rectangles, but rather a scattering of multiple small areas. So, what we do is split up the lens into multiple section, each section of which is a Fresnel lens. The different faceting and sub-lenses create a range of detection areas, interleaved with each other. That’s why the lens centers in the facets above are 'inconsistent' - every other one points to a different half of the PIR sensing element.

Page 7: Automatic Door Opener using PIR Sensor

The macro shot shows the different Fresnel lenses in each facet

Connecting to PIR :

Page 8: Automatic Door Opener using PIR Sensor

Most PIR modules have a 3-pin connection at the side or bottom. One pin will be

ground, another will be signal and the final one will be power. Power is usually 3-

5 V DC input but may be as high as 12v.

The PIR has two knobs on the back for adjusting sensitivity and for changing the

pulse time.

ARDUINO UNO

The Arduino Uno is a microcontroller board based on the ATmega328 It has 14

digital input/output pins (of which 6 can be used as PWM outputs), 6 analog

inputs, a 16 MHz ceramic resonator, a USB connection, a power jack, an ICSP

header, and a reset button. It contains everything needed to support the

microcontroller; simply connect it to a computer with a USB cable or power it

with a AC-to-DC adapter or battery to get started.

Page 9: Automatic Door Opener using PIR Sensor

Programming code Explanation:

#include <LiquidCrystal.h> //to use liquid crystal library.

LiquidCrystal lcd(13, 12, 11, 10, 9, 8); //Defines which pins of Arduino are to be connected to

which pins of LCD display.

#define PIR_sensor 14 //variable declaration

#define m11 0 //variable declaration

#define m12 1 //variable declaration

void setup() //Structure

{

lcd.begin(20, 4); //Indicates no of columns and rows.

pinMode(m11, OUTPUT); //set pin to output

Page 10: Automatic Door Opener using PIR Sensor

pinMode(m12, OUTPUT); //set pin to output

pinMode(PIR_sensor, INPUT); //set pin to input

lcd.print(" Automatic "); //display message

lcd.setCursor(0,1); //set the cursor to column 0 and row 1

lcd.print(" Door Opener "); //display message

delay(3000); //pause the program

lcd.clear(); //clears the lcd screen

}

void loop() //loop function continuously executes the codes (i.e. reading inputs and triggering

outputs)

{

if(digitalRead(PIR_sensor)) //reads the value from specified digital pin with result either LOW

or HIGH

{

lcd.setCursor(0,0); //set the cursor to top left corner

lcd.print("Movement Detected"); //display message

lcd.setCursor(0, 1); //set the cursor to bottom left corner

lcd.print(" Gate Opened "); //display message

digitalWrite(m11, HIGH);

digitalWrite(m12, LOW); // gate opening

delay(1000); //pause the program for 1 sec

digitalWrite(m11, LOW);

digitalWrite(m12, LOW); // gate stop for a while(no movement)

delay(1000); //pause the program for 1 sec

lcd.clear(); //clears the LCD screen

lcd.print(" Gate Closed "); //display message

digitalWrite(m11, LOW);

digitalWrite(m12, HIGH); // gate closing

delay(1000); //pause the program for 1 sec

digitalWrite(m11, LOW);

digitalWrite(m12, LOW); // gate closed

delay(1000); //pause the program for 1 sec

}

else

{

lcd.setCursor(0,0); //set the cursor to top left corner

lcd.print(" No Movement "); //display message

lcd.setCursor(0,1); //set the cursor to bottom left corner

Page 11: Automatic Door Opener using PIR Sensor

lcd.print(" Gate Closed "); //display message

digitalWrite(m11, LOW);

digitalWrite(m12, LOW); //no movement of gate

}

}

L293D Motor Driver IC

What Is Motor Driver IC?

A motor driver IC is an integrated circuit chip which is usually used to control

motors in autonomous robots. Motor driver ICs act as an interface between

microprocessors in robots and the motors in the robot. The most commonly used

motor driver IC’s are from the L293 series such as L293D, L293NE, etc. These

ICs are designed to control 2 DC motors simultaneously. L293D consist of two H-

bridge. H-bridge is the simplest circuit for controlling a low current rated motor.

L293D has 16 pins, they are comprised as follows: Ground Pins – 4 Input Pins – 4

Output Pins – 4 Enable pins - 2 Voltage Pins - 2

Why We Need Motor Driver IC?

Motor Driver ICs are primarily used in autonomous robotics only. Also, most

microprocessors operate at low voltages and require a small amount of current to

operate while the motors require a relatively higher voltage and current. Thus,

current cannot be supplied to the motors from the microprocessor. This is the

primary need for the motor driver IC.

How Motor Driver Operates?

The L293D IC receives signals from the microprocessor and transmits the relative

signal to the motors. It has two voltage pins, one of which is used to draw current

for the working of the L293D and the other is used to apply voltage to the motors.

The L293D switches it output signal according to the input received from the

microprocessor.

Page 12: Automatic Door Opener using PIR Sensor

For Example: If the microprocessor sends a 1(digital high) to the Input Pin of

L293D, then the L293D transmits a 1(digital high) to the motor from its Output

Pin. An important thing to note is that the L293D simply transmits the signal it

receives. It does not change the signal in any case.

L293D And Its Working

The L293D is a 16 pin IC, with eight pins, on each side, dedicated to the

controlling of a motor. There are 2 INPUT pins, 2 OUTPUT pins and 1 ENABLE

pin for each motor. L293D consist of two H-bridge. H-bridge is the simplest

circuit for controlling a low current rated motor.

The Theory for working of a H-bridge is given below.

Working of A H-bridge

H-bridge is given this name because it can be modelled as four switches on the

corners of ‘H’. The basic diagram of H-bridge is given below:

In the given diagram, the arrow on the left points to the higher potential side of the

input voltage of the circuit. Now if the switches S1 & S4 are kept in

a closed position while the switches S2 & S3 are kept in an open position meaning

that the circuit gets shorted across the switches S1 & S4. This creates a path for

the current to flow, starting from the V input to switch S1 to the motor, then to

switch S4 and then the exiting from the circuit. This flow of the current would

Page 13: Automatic Door Opener using PIR Sensor

make the motor turn in one direction. The direction of motion of the motor can be

clockwise or anti-clockwise, this is because the rotation of the motor depends

upon the connection of the terminals of the motor with the switches.

For simplicity, let’s assume that in this condition the motor rotates in a clockwise

direction. Now, when S3 and S2 are closed then and S1 and S4 are kept open then

the current flows from the other direction and the motor will now definitely

rotates in counter-clockwise direction When S1 and S3 are closed

and S2 and S4 are open then the ‘STALL’ condition will occur(The motor will

break).

Stall Condition:

When the motor is applied positive voltage on both sides then the voltage from

both the sides brings the motor shaft to a halt

Page 14: Automatic Door Opener using PIR Sensor

L293D Logic Table.

Let’s consider a Motor connected on left side output pins (pin 3,6). For rotating

the motor in clockwise direction, the input pins have to be provided with Logic 1

and Logic 0.

• Pin 2 = Logic 1 and Pin 7 = Logic 0 | Clockwise Direction

• Pin 2 = Logic 0 and Pin 7 = Logic 1 | Anticlockwise Direction

• Pin 2 = Logic 0 and Pin 7 = Logic 0 | Idle [No rotation] [Hi-Impedance state]

• Pin 2 = Logic 1 and Pin 7 = Logic 1 | Idle [No rotation]

In a very similar way the motor can also operate across input pin 15,10 for motor

on the right-hand side.

Voltage Specification:

VCC is the voltage that it needs for its own internal operation 5v; L293D will not

use this voltage for driving the motor. For driving the motors, it has a separate

provision to provide motor supply VSS (V supply). L293d will use this to drive

the motor. It means if you want to operate a motor at 9V then you need to provide

a Supply of 9V across VSS Motor supply. The maximum voltage for VSS motor

supply is 36V. It can supply a max current of 600mA per channel. Since it can

drive motors Up to 36v hence you can drive pretty big motors with this

l293d.VCC pin 16 is the voltage for its own internal Operation. The maximum

voltage ranges from 5v and up to 36v.

Don’t Exceed the Vmax Voltage of 36 volts or it will cause damage.

Advantages of automatic door opening system:

For people in wheelchairs and other disabled individuals, automatic doors

are an immense boon, since conventional doors can be very hard to work

with. It may be impossible to open a conventional door while seated in a

wheelchair or navigating with crutches.

In hospitals and scientific labs, automatic doors can be used to secure an

area by ensuring that the doors are shut at all times, while reducing the risk

Page 15: Automatic Door Opener using PIR Sensor

of cross-contamination since people do not need to handle the doors to pass

through them.

Automatic doors can also be useful in warehouses and other facilities where

people frequently have their hands full, contributing to safety and efficiency

by making it easier for people to get around.

Further Improvements:

There can be a Display Unit for showing number of persons entered in a

particular room.

A better sensor is recommended to achieve new functionality. For instance,

a suitable sensor such as radar sensor that could detect contraband goods in

any vehicle.

To achieve full automation, a real-time system should be employed and a

Closed-Circuit Television (CCTV) system provided for proper monitoring

and security purposes. This can be helpful in detecting the presence of

vehicles before the system is activated.

Upgrading the system using higher bit microprocessors for speed

optimization.

Along with this system we can use Face-detection through Camera for

Automated Attendance System.

References:

https://www.robotix.in/

https://learn.adafruit.com/pir-passive-infrared-proximity-motion-sensor/

http://circuitdigest.com/microcontroller-projects/automatic-door-opener-project-

using-arduino/

Page 16: Automatic Door Opener using PIR Sensor