Projects Based On Automatic Door Sensor
Projects Based On Automatic Door Sensor
Projects Based On Automatic Door Sensor
You might have seen Automatic Door Opener Systems at shopping malls,
cinemas, hospitals etc. where, as soon as a person approaches the door
(at about 2 or 3 feet), the door automatically slides open. And after some
time (about 5 to 10 seconds), the door closes by sliding in the reverse
direction.
Such Automatic Door Opener Systems are very useful as you do not need
a person to standby the door and open it whenever a guest comes. Also,
since the doors are opened and closed only when a person approaches the
door, there is significantly less loss of air conditioning.
We have already seen in the Arduino PIR Sensor Tutorial about how a PIR
Sensor Works and how to interface a PIR Sensor to an Arduino.
Before continuing with this project, I suggest you to take a look at
the Arduino PIR Sensor Tutorial.
In order to control the 5V DC motor in the CD Tray, I’ve used the L298N
Motor Driver Module. I’ve already done a tutorial on controlling a DC Motor
using Arduino and L298N Motor Driver Module.
Component Description
Arduino UNO
In this project, Arduino UNO acts as the main controlling part. It reads the
data from the PIR Sensor and activates the L298N Motor Driver based on
the data from the PIR Sensor.
PIR Sensor
Detecting human motion is done with the help of PIR Sensor.
Coming to the Motor Driver, we have used the second channel of the
L298N Motor Driver Module. Hence, the IN3 and IN4 of the L298N Motor
Driver are connected to Digital Pins 2 and 3 of Arduino.
The Enable Pin of the Second Motor on the L298N Module us connected to
+5V. Usually, all the L298N Modules consists of a jumper to directly
connected the Enable pins to +5V. You can use this option.
Finally, the Motor of the CD Tray is connected to the OUT3 and OUT4 of
L298N Motor Driver Module.
Code
The code for the project is given below. It can be used with any Arduino
Board (Arduino UNO, Arduino Nano or Arduino Mega).
int in1 = 2;
int in2 = 3;
int sensor = 8;
int led = 13;
void setup()
{
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(sensor, INPUT);
pinMode(led, OUTPUT);
digitalWrite(in1,LOW);
digitalWrite(in2,LOW);
//digitalWrite(sensor,LOW);
digitalWrite(led,LOW);
while(millis()<13000)
{
digitalWrite(led,HIGH);
delay(50);
digitalWrite(led,LOW);
delay(50);
}
digitalWrite(led,LOW);
digitalWrite(in1,LOW);
digitalWrite(in2,HIGH);
void loop()
{
if(digitalRead(sensor)==HIGH)
{
digitalWrite(in1,HIGH);
digitalWrite(in2,LOW);
digitalWrite(led,HIGH);
delay(2000);
digitalWrite(in1,LOW);
digitalWrite(in2,LOW);
digitalWrite(in1,LOW);
digitalWrite(in2,HIGH);
digitalWrite(led,LOW);
delay(2000);
digitalWrite(in1,LOW);
digitalWrite(in2,LOW);
When the PIR Sensor detects any motion of a person, its Data OUT Pin will
become HIGH. As this pin is connected to the Arduino, it will detect this
HIGH Signal and understands that there is person approaching the door.
Arduino then immediately activates the L298N Motor Driver module to open
the door. After some time (about 2 to 5 seconds in this project), the Arduino
will once again activate the Motor Drive to close the door.
Applications
Arduino based Automatic Door Opener System is a very useful
project as it enables you to understand the concept of such automatic
door opener systems and how they work.
These systems are already being used in many places like malls,
theatres and hospitals.
You can implement this Arduino based project at you home in
Garage Door Openers, toilet cover openers, Office door openers, etc.