Automatic Door Opener using Arduino

Published  July 12, 2015   96
S Saddam
Author
PIR Sensor based Automatic Door Opener Project using PIR Sensor

You must have seen automatic door openers in shopping malls and other commercial buildings. They open the door when someone comes near the entrance and close it after sometime. A number of technologies are available to make such kinds of systems like PIR sensors, Radar sensors,  Laser sensors, Infrared sensors, etc. In this arduino based project, we have tried to replicate the same system by using a PIR sensor. 

 

It uses a motion-detecting sensor (PIR sensor) to open or close the door which detects the infrared energy omitted from human's body. When someone comes in front of the door, the infrared energy detected by the sensor changes and it triggers the sensor to open the door whenever someone approaches the door. The signal is further sent to arduino uno that controls the door. 

 

Circuit Components

  1. Arduino UNO
  2. 16x2 LCD
  3. PIR Sensor
  4. Connecting wires
  5. Bread board
  6. 1 k resistor
  7. Power supply
  8. Motor driver
  9. CD case (DVD Troly)

 

PIR Sensor

PIR sensor detects any change in heat, and whenever it detects any change, its output PIN becomes HIGH. They are also referred as Pyroelectric or IR motion sensors.

Here we should note that every object emits some amount of infrared when heated. Human also emits infrared because of body heat. PIR sensors can detect small amount of variation in infrared. Whenever an object passes through the sensor range, it produces infrared because of the friction between air and object, and get caught by PIR.

 

The main component of PIR sensor is Pyroelectric sensor shown in figure (rectangular crystal behind the plastic cap). Along with BISS0001 ("Micro Power PIR Motion Detector IC"), some resistors, capacitors and other components used to build PIR sensor. BISS0001 IC take the input from sensor and does processing to make the output pin HIGH or LOW accordingly.

PIR Sensor

Pyroelectric sensor divide in two halves, when there is no motion, both halves remain in same state, means both senses the same level of infrared. As soon as somebody enters in first half, the infrared level of one half becomes greater than other, and this causes PIRs to react and makes the output pin high.

 

Pyroelectric sensor is covered by a plastic cap, which has array of many Fresnel Lens inside. These lenses are curved in such a manner so that sensor can cover a wide range.

 

Circuit Diagram and Explanation

Automatic Door Opener Circuit Diagram

Connections for arduino based door opener circuit are shown in the above diagram. Here a PIR sensor is used for sensing human motion which has three terminals Vcc, GND and Dout. Dout is directly connected to pin number 14 (A0) of arduino uno. A 16x2 LCD is used for displaying the status. RS, EN pins of LCD connected to 13 and 12 of arduino and data pins D0-D7 are connected to arduino digital pin numbers 11, 10, 9, 8. RW is directly connected to ground. L293D motor driver is connected to arduino pin 0 and 1 for opening and closing the gate. Here in circuit we have used a motor for gate.

 

Programming Explanation

The concept used here for programming is very simple.  In program we have only used digital input output.  

DigitalRead is used for reading output of PIR sensor.

DigitalRead

After that, if PIR sensor senses any motion then program sends an command to open gate, stop gate, closing gate and stop gate.

commands to open the gate

See below the complete code for arduino based automatic door opener.

Code

#include <LiquidCrystal.h>
LiquidCrystal lcd(13, 12, 11, 10, 9, 8);

#define PIR_sensor 14
#define m11 0
#define m12 1

void setup() 
{
  lcd.begin(16, 2);
  pinMode(m11, OUTPUT);
  pinMode(m12, OUTPUT);
  pinMode(PIR_sensor, INPUT);
  lcd.print("    Automatic    ");
  lcd.setCursor(0,1); 
  lcd.print("   Door Opener   ");
  delay(3000);
  lcd.clear();
  lcd.print("CIRCUIT DEGEST ");
  delay(2000);
}

void loop() 
{
  if(digitalRead(PIR_sensor))
  {
    lcd.setCursor(0,0);
    lcd.print("Movement Detected");
    lcd.setCursor(0, 1);
    lcd.print("    Gate Opened    ");
    digitalWrite(m11, HIGH);         // gate opening
    digitalWrite(m12, LOW);
    delay(1000);
    digitalWrite(m11, LOW);          // gate stop for a while
    digitalWrite(m12, LOW);
    delay(1000);
    lcd.clear();
    lcd.print("   Gate Closed    ");
    digitalWrite(m11, LOW);           // gate closing
    digitalWrite(m12, HIGH);
    delay(1000);
    digitalWrite(m11, LOW);            // gate closed
    digitalWrite(m12, LOW);
    delay(1000);
  }
  
  else 
  {
    lcd.setCursor(0,0);
    lcd.print("   No Movement   ");
    lcd.setCursor(0,1);
    lcd.print("   Gate Closed   ");
    digitalWrite(m11, LOW);
    digitalWrite(m12, LOW);
  }
}

Video

Have any question realated to this Article?

Ask Our Community Members

Comments

Submitted by Sumeya Obaid on Sat, 04/14/2018 - 18:42

Permalink

how can i store the updated password to eeprom? so that the system stores the updated password for next power up

Submitted by Gopal on Sat, 04/21/2018 - 05:12

Permalink

Is anyone getting that the door just loops and loops opening and closing but without detecting motion? After unplugging the sensor, the door continues to move? I checked the whole circuit they're all connected in the correct positions. The code is the same too. What could be wrong?

Submitted by Kene on Thu, 08/30/2018 - 23:17

Permalink

Looking at this your code, implementing it I n a real life door will be problematic ,because according to code even when the sensor is sensing high that is, someone is standing close to door and maybe delays for more than 1second before entering, the next line of code after delay which is to close door will run and therefore shut the door even though the sensor is still sensing high