Automatic Door Opener using Arduino

Arduino

BySaddam 96

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

Comments

  • nikita's picture
    nikita
    Nov 08, 2015

    This project is good..

  • JP Ezhilan's picture
    JP Ezhilan
    Oct 12, 2016

    it is very simple project .pls dont use aurdino board .
    don't do ur projects only based on concept
    just try to do with compactness and simple cost ,reliabled one .

  • nikita's picture
    nikita
    Nov 08, 2015

    I want make it so I require help from it...

  • Anupam Nema's picture
    Anupam Nema
    Nov 08, 2015

    its is best project for ever.

  • arvind maurya's picture
    arvind maurya
    Dec 30, 2015

    i want to chhosse topic but i have no ppt so pls send me mail ppt

  • idris's picture
    idris
    Jan 19, 2016

    LCD is important for this project

  • saddam khan's picture
    saddam khan
    Jan 21, 2016

    No
    there is no need of LCD.
    we just add it here only for demonstration.
    you may remove it.

  • Jamiu's picture
    Jamiu
    Feb 03, 2016

    Great job. I want to do this same project, so my questions are what programming language did you used and how were you able to put the code inside the ardino uno. I would really appreciate your help and guidance. Thanks.

  • soukaina's picture
    soukaina
    Dec 15, 2017

    In order to write the code , you need to download arduino onto your computer . Go to the arduino official website and download it . then copy the code .

  • Jayant's picture
    Jayant
    Feb 06, 2016

    Arduino simply supports C/C++ language, and Arduino language itself derived from C/C++. Means it supports all the C++'s OOPS concept, operators, conditions statements etc. And there is a Arduino IDE, which is used to verify and upload the code to the Arduino, you just need to connect Arduino board to the PC using USB. Arduino IDE (Arduino Nightly) can be downloaded from here: https://www.arduino.cc/en/Main/Software

  • Rugen's picture
    Rugen
    Feb 07, 2016

    can we use ir sensor instead of pir sensor??

  • Akhil menon's picture
    Akhil menon
    Feb 10, 2016

    What is this m11 and m12 stands for??

  • Ajay's picture
    Ajay
    Feb 11, 2016

    These are just the variable name, used to define PIN 0 and 1 of Arduino, you can use any name.

  • jb's picture
    jb
    Feb 29, 2016

    what type of should i use in this project please tell me i m interested to make this project

  • santanalakshmi's picture
    santanalakshmi
    Mar 03, 2016

    how does the motor work?!!!

  • Maddy's picture
    Maddy
    Mar 11, 2016

    check the code in void_loop() function, motor rotate in one direction to Open the gate and then rotate in another direction to Close the gate.

  • jsk jyothish's picture
    jsk jyothish
    Apr 02, 2016

    Please any one help me to make a project report on this topic

  • M Asif's picture
    M Asif
    Apr 07, 2016

    what type of ic use in this project please tell me

  • Marilyn Woodman's picture
    Marilyn Woodman
    Apr 08, 2016

    Could you please enlarge a little on the type of motor you used? Geared, stepper, servo, etc., and also its specifications?

  • Vaias's picture
    Vaias
    Apr 08, 2016

    How can I connectthe L293D on the motor? My dvd troly is from an actual dvd and I cant figure out how to connect it because it has 4 pins

  • Abhishek's picture
    Abhishek
    Apr 17, 2016

    You need to find out the two wires, which are connected to rotating motor of DVD tray.

  • sefa's picture
    sefa
    Apr 14, 2016

    If I use ultrasonic sensor instead of PIR sensor,which parts should I change of the program? Also could you tell the kind of the motor used?

  • tharun's picture
    tharun
    Apr 19, 2016

    I tried all possible solutions. Nothing works :(

  • sefa's picture
    sefa
    Apr 21, 2016

    As tharun said nothing works for now. Same program,same proteus connections,same materials,but there is a mistake which I do not understand. There is power on the LCD,but the sentences are not seen. Motor rotates almost independent from the PIR sensor :/ ıf there is a extra code or something else,please uniform us

  • adil's picture
    adil
    Apr 27, 2016

    sir
    can we use pins other than 0 and 1 for motor...because i need pin 0 and 1 to connect bluetooth module.

  • saddam khan's picture
    saddam khan
    Apr 28, 2016

    yes you can use.

  • aabish's picture
    aabish
    Apr 29, 2016

    my pir sensor is getting high no matter how far i go from it...it is written somewhere in the internet that the range of a pir sensor is 15 - 20 feet..can you please tell me what to do...

  • Akhil menon's picture
    Akhil menon
    Apr 30, 2016

    hello.can u plz tell me how to connect a 12v dc motor to it using relay

  • harish's picture
    harish
    May 08, 2016

    what is the function of the ICSP pin in arduino uno

  • Sandy's picture
    Sandy
    Jun 02, 2016

    WHat type of motor have you used? And please tell me how to choose a motor to operate a door that is @kgs heavy.

  • Maddy's picture
    Maddy
    Jun 11, 2016

    We have used DVD Trolley from the computer here, but you can use simple DC motor, attached to gate. You can choose the DC Motor accordingly and need to provide the power supply accordingly.

  • IGO's picture
    IGO
    Jun 28, 2016

    how to encode those code?

  • abhishek's picture
    abhishek
    Jul 02, 2016

    can we use ultrasonic sensor?

  • deep agarwal's picture
    deep agarwal
    Jul 11, 2016

    actually i am thinking of a project where i am using barrier instead of door and when vehicle will come nearer then pir sensor will work n open up the barrier. now i want to achieve linear motion in vertical plane (as of a bollard) can u guide how i can achieve it. i would appreciate ur help....

  • Dipu's picture
    Dipu
    Jul 12, 2016

    I want to add a counter for how many people are enter /out in the door? is it possible in this project? how? plz let me know if its possible

  • Andrew's picture
    Andrew
    Jul 14, 2016

    I've done this project left out the LCD added a motor driver and servo motor but can't get it to run the TX keeps flashing for some reason any ideas

  • Andrew's picture
    Andrew
    Jul 25, 2016

    I can't get this to work at all
    I don't have the screen attached sour tried with the code the same and changed to delete it limes of code related to screen
    Doesn't work
    I changed motors I added a stepper motor
    Changed code again to include stepper code still don't work
    Changed it all back again and it runs full sequence with out the regard for timing

  • Abhishek's picture
    Abhishek
    Aug 13, 2016

    You should use simple DC motors with the given code, servo and stepper wont work with this code. Also adjust the sensitivity of PIR sensor.

  • kousar's picture
    kousar
    Jul 28, 2016

    dear brother i want to try this project simulation on proteus but i did't find some equipment like arduino uno,pir sensor u use in this simulation

  • Abhishek's picture
    Abhishek
    Aug 13, 2016

    You need to install Libraries for them in Proteus.

  • hossain Sakib's picture
    hossain Sakib
    Aug 23, 2016

    How i connect wire and motor with CD drive ?

  • Abhishek's picture
    Abhishek
    Sep 17, 2016

    CD Drive itself has the DC motor, you don't need to connect any additional motor. You need to find connections to this CD drive motor.

  • Yirvin's picture
    Yirvin
    Sep 29, 2016

    There is no display in the lcd, how do the wirings work?

  • Ahmad Irfan's picture
    Ahmad Irfan
    Oct 05, 2016

    If I connect with dc motor and battery,should I change the code?,and what's power supply use?

  • Maddy's picture
    Maddy
    Oct 07, 2016

    This project already using a 9v Battery, and you can take power supply for motor from Arduino (connected to computer) or a 9v battery should work.

  • Ahmad Irfan's picture
    Ahmad Irfan
    Oct 08, 2016

    can i replace cd case with the door(build manually) that connected with dc motor? is the code still the same?

  • Ahmad Irfan's picture
    Ahmad Irfan
    Oct 10, 2016

    can i know how to design correctly this circuit diagram by using proteus..

  • Wasif Mukaddam's picture
    Wasif Mukaddam
    Oct 26, 2016

    Can u please upload or mail me he actual circuit images from different angles ... since i am new to this and cant do it by the graphical circuit diagram ... and i have seen a few differences in the first pic and the one in the video... please help

  • raymond stelter's picture
    raymond stelter
    Nov 07, 2016

    just a quick question i'm not sure if anyone asked this but what about using 2 pir sensors

  • Chidan's picture
    Chidan
    Nov 23, 2016

    I am making an door open close system for a real gate which works on high voltage moters do arduino is capable of that much of volt at list a fans moter

  • Jyotish Upadhaya's picture
    Jyotish Upadhaya
    Nov 25, 2016

    I didn't get how you connect the cd rom with the motor driver...please let me know the connection of cd drive to motor driver

  • Abhishek's picture
    Abhishek
    Dec 02, 2016

    you need to find only two wires which leads to CD drives Motor.

  • Sufyan's picture
    Sufyan
    Jan 12, 2017

    Sir I made this project but the sensor is not working. Door automatically opens after some delay. Plz solve this issue I've tried every possible solution.

  • md yusuf's picture
    md yusuf
    Jan 15, 2017

    sir, your helping nature is fantastic and i really thank u for the project.
    i have a doubt sir... that.. which type of motors can i use instead of cd driver because i don't have it.

  • md yusuf's picture
    md yusuf
    Jan 15, 2017

    sir where should we give power supply.. like 9v battery so that i can carry to my clg

  • maj lobu's picture
    maj lobu
    Jan 19, 2017

    What can i do to the code to stop the door from opening and closing when the sensor is still detecting?

  • bunty's picture
    bunty
    Jan 21, 2017

    I am interested about this project.But i have a small doubt about this ,I can't find a perfect schematic on this project.could you guys help me out

  • Abhishek's picture
    Abhishek
    Jul 12, 2017

    Schematic is already given the in Article, please check.

  • Jesus Castro's picture
    Jesus Castro
    Jan 25, 2017

    Can I connect 2 sensors to the same pins and still perform as intended?
    This is so that the door can open from both sides.

    thanks

  • hazrat ali's picture
    hazrat ali
    May 08, 2017

    whats the name of small device in right side of lcd in breed board....

  • FAY PAIVA's picture
    FAY PAIVA
    May 28, 2017

    i wanna try this project ...may you send the circuit diagram

  • Kad greg's picture
    Kad greg
    Jun 11, 2017

    can this project configured to use from a browser?

  • harshitha's picture
    harshitha
    Jun 22, 2017

    hello,
    we are using PIR sensor, Arduino, cd disc drive for this project.will you please, help me how to connect because I tried it with LCD but couldn't complete this project.

  • jennifer's picture
    jennifer
    Sep 16, 2017

    instead of PIR sensor, we will use bluetooth sensor because we will make a face detection application and then we will have to connect it with bluetooth. any suggestions?

  • AISHA's picture
    AISHA
    Sep 17, 2017

    Wow nice idea, I think it is very much possible! But, what will you use to do face detection? If I were you i would use openCV with Arduino thorugh serial COM. How are you thinking to do it.

  • Rakesh rajbhar's picture
    Rakesh rajbhar
    Oct 08, 2017

    in my project the the pir is not getting stable, the error occurs with pir is its sensitivity,in my case i have used arduino code to run pir but the pir is continious sensing the motion even when there is no movement ahead of the pir.
    How i can remove this erro??????

  • Aswinth Raj's picture
    Aswinth Raj
    Oct 09, 2017

    The problem could either be with the module or code. So check the module separelty by using an LED to it output pin and check if it is working properly then proceed with arduino.

  • PARESH 's picture
    PARESH
    Oct 11, 2017

    i want the code of this project in c language.

  • sheng's picture
    sheng
    Oct 27, 2017

    please help me my motor keep move clockwise and anticlockwise non-stop is this code problem ?

  • noor's picture
    noor
    Nov 13, 2017

    i want to implement this on LABVIEW plz suggest me..

  • Kamran Ahmad 's picture
    Kamran Ahmad
    Dec 25, 2017

    which DC motor is connected (voltage)....???

  • AISHA's picture
    AISHA
    Dec 26, 2017

    I think its a normal motor and it operates in +5V as shown in the circuit diagram

  • Swan's picture
    Swan
    Jan 27, 2018

    Project is very efficient....can you please tell me what cd disk have u used ....can we get that piece online

  • Harshi's picture
    Harshi
    Feb 18, 2018

    If I change pir sensor to ir sensor.does code same????

  • eba janko's picture
    eba janko
    Mar 09, 2018

    how can we use if we want connect with servomotor in order to interface hydraulic sysytem

  • Hari Charan reddy's picture
    Hari Charan reddy
    Mar 31, 2018

    Sir what is the power source which We give hear if it is a battery what is the rating of battery

  • Hamdan zeid al-kilani's picture
    Hamdan zeid al-...
    Apr 09, 2018

    hello, i was wondering where did you connect your power supply ?

  • Aswinth Raj's picture
    Aswinth Raj
    Apr 10, 2018

    Just power your arduino with the programming cable and the whole project will be powered. 

    If you want to use a battery then use a 9V battery with its negative to ground and positive to Vin. 

  • Hamdan zeid al-kilani's picture
    Hamdan zeid al-...
    Apr 11, 2018

    How can i lower the speed of my dc motor, and reduce the time of the motor spinning

Pages

Log in or register to post Comment