The project concerns about automatic door opening and closing system. An automatic door control system includes a sensor for sensing person or object approaching door. Systems and methods are very common in the art for opening and closing doors to enter and exit buildings, facilities etc. Automatic doors are commonly found in retail stores, supermarkets, and the like.

The project generally relates to an automatic opening and closing of door which will sense person or object approaching door and open automatically. This system is controlled by Arduino micro controller. The system includes DC motor which makes door to slides during opening or closing by rack and pinion gearing, a LCD to display information state of door, an audio buzzer to make sound through the duration of opened door and a controller for controlling the opening and closing of the door as a person or object detected by sensor.

The whole system is mechatronic system which is designed using seven steps of mechatronic system design.

To starts making such mechatronic system following elements and tools are required...

Step 1: Step 1:- Gather All Hardware (Materials and Tools)

Gather all hardware required to assemble system. LCD and Piezo Buzzer is not a mandatory requirement of this system. These are added just only for Visual and Audio identification to user for status of door whether it is open or closed.

To starts making such mechatronic system following elements and
tools are required...

Materials -

1. A computer to program instruction, must installed arduino IDE.

2. Arduino controller ( Any of UNO, MEGA etc.) but i took low cost UNO R3 for learning purpose and making this project for my academic partial fulfillment.

ATMEL : ATmega328-PU

3. HRSC04 Ultrasonic sensor (Used as proximity sensor to sens person or object arrived at door).

Ultrasonic ranging module HC - SR04 provides 2cm-400cm non-contact measurement function, the ranging accuracy can reach to 3mm. The modules includes ultrasonic transmitters, receiver and control circuit. The basic principle of work:

Using IO trigger for at least 10us high level signal

The Module automatically sends eight 40 kHz and detect whether there is a pulse signal back

IF the signal back, through high level , time of high output IO duration is the time from sending ultrasonic to returning

Test distance = (high level time X velocity of sound (340M/S) / 2

4. 12V DC Motor

Load current: 70mA (250mA MAX) (3V pm)

Operating voltage: 3V ~ 12V DC

Torque: 1.9 Kgf.cm

Speed without load: 170RMP (3V)

Reduction ratio: 1:48

Weight : 30gm

No-load current = 60 mA,

Stall current = 700 mA

5. LCD : 16 X 2 DOT MATRIX.

6. Piezo Buzzer

7. Motor Shield : L293D

The L293 and L293D devices are quadruple high current half-H drivers.

Reason to use Motor shield :

You can run motor directly connect to 9-12 V DC supply. The motor will draw current as much it requites from 12V DC supply. But In this project we have to control motor with program instruction so we have to connect motor through the arduino controller which output voltage and current is limited. So when you connect motor to arduino controller it it will draw more current at 5V. So there will be chances to burn controller.

To prevent micro-controller to burn, i used motor shield. which is simply acts as amplifier.

8. Mechanical elements : To make a prototype i used plastic acrylic sheet and cut them into peaces to make a house type model having sliding door.

9. Jumper Wires

10 Power Supply


1. Multi-meter

2. Soldering Iron

The tools are not required, but if you have then you will be good.

Step 2: ​Arduino Program:-

You can also down load attached .ino file and directly complie and upload.


LiquidCrystal lcd(12, 11, 5, 8, 9, 1);

const int trigPin = 7;

const int echoPin = 4;

const int mt_En_Pin1 = 2;

const int mt_IN1_Pin2 = 3;

const int mt_IN2_Pin3 = 6;

int buzz = 10;

long duration;

int distance;

void setup()



lcd.begin(16, 2);


pinMode(trigPin, OUTPUT);

pinMode(echoPin, INPUT);

pinMode(mt_En_Pin1, OUTPUT);

pinMode(mt_IN1_Pin2, OUTPUT);

pinMode(mt_IN2_Pin3, OUTPUT);


pinMode(buzz, OUTPUT);


void loop()


digitalWrite(trigPin, LOW);


digitalWrite(trigPin, HIGH);


digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance= duration*0.034/2;

if(distance <= 5)


digitalWrite(13, HIGH);


digitalWrite(mt_En_Pin1, HIGH);


analogWrite(mt_IN2_Pin3, 0);


analogWrite(mt_IN1_Pin2, 0);

analogWrite(mt_IN2_Pin3, 0);


tone(buzz, 1000);


tone(buzz, 1000);






lcd.print("Please Enter");








digitalWrite(13, LOW);

digitalWrite(mt_En_Pin1, LOW);


analogWrite(mt_IN2_Pin3, 0);



Step 3: Step 3:- Hardware Connections

Connects all hardware to arduino controller. The attached schematics are just for the reference only. You may use pins as per available at controller board.

The best way you can use my program for pin information. Also you raise me request to share.

Step 4: Step 4:- Flaysh Arduino Program and Power Supply

Upload arduino sketch provided in this tutorial to controller.

Watch video to view working system.

<p>I am a little puzzled. Your code has trigPin on digital pin 7 (as output) and echoPin as digital pin 4 (as Input). But your schematic shows the ultrasound module connected to digital pins 13 and 12 respectively. Can you explain please?</p>
<p>Please don't follow the schematic. Follow code. Code will give you right result.</p>
Even more puzzled! Surely the code and the physical connections have to match? So if the code says trigPin = 7 then the trigPin on the U/S module must be connected to digital pin 7 of the Arduino? (equally having it connected to pin 13 of the Arduino would be fine if I changed the code to &quot;const int trigPin = 13;&quot;). is this not correct?
Can you please share arduino codes for this ??
Its there...
#include <br><br>LiquidCrystal lcd(12, 11, 5, 8, 9, 1);<br><br>const int trigPin = 7;<br><br>const int echoPin = 4;<br><br>const int mt_En_Pin1 = 2;<br><br>const int mt_IN1_Pin2 = 3;<br><br>const int mt_IN2_Pin3 = 6;<br><br>int buzz = 10;<br><br>long duration;<br><br>int distance;<br><br>void setup()<br><br>{<br><br>lcd.clear();<br><br>lcd.begin(16, 2);<br><br>lcd.print(&quot;WELCOME&quot;);<br><br>pinMode(trigPin, OUTPUT);<br><br>pinMode(echoPin, INPUT);<br><br>pinMode(mt_En_Pin1, OUTPUT);<br><br>pinMode(mt_IN1_Pin2, OUTPUT);<br><br>pinMode(mt_IN2_Pin3, OUTPUT);<br><br>Serial.begin(9600);<br><br>pinMode(buzz, OUTPUT);<br><br>}<br><br>void loop()<br><br>{<br><br>digitalWrite(trigPin, LOW);<br><br>delayMicroseconds(2);<br><br>digitalWrite(trigPin, HIGH);<br><br>delayMicroseconds(10);<br><br>digitalWrite(trigPin, LOW);<br><br>duration = pulseIn(echoPin, HIGH);<br><br>distance= duration*0.034/2;<br><br>if(distance &lt;= 5)<br><br>{<br><br>digitalWrite(13, HIGH);<br><br>delay(1000);<br><br>digitalWrite(mt_En_Pin1, HIGH);<br><br>analogWrite(mt_IN1_Pin2,50);<br><br>analogWrite(mt_IN2_Pin3, 0);<br><br>delay(2000);<br><br>analogWrite(mt_IN1_Pin2, 0);<br><br>analogWrite(mt_IN2_Pin3, 0);<br><br>delay(1000);<br><br>tone(buzz, 1000);<br><br>delay(1000);<br><br>tone(buzz, 1000);<br><br>delay(1000);<br><br>noTone(buzz);<br><br>delay(3000);<br><br>lcd.clear();<br><br>lcd.setCursor(0,1);<br><br>lcd.print(&quot;Please Enter&quot;);<br><br>delay(1000);<br><br>analogWrite(mt_IN1_Pin2,0);<br><br>analogWrite(mt_IN2_Pin3,50);<br><br>delay(3000);<br><br>}<br><br>else<br><br>{<br><br>digitalWrite(13, LOW);<br><br>digitalWrite(mt_En_Pin1, LOW);<br><br>analogWrite(mt_IN1_Pin2,50);<br><br>analogWrite(mt_IN2_Pin3, 0);<br><br>}<br><br>}
Thanks Abhijeet
It is shared already Aman...<br> The ino file is arduino sketch. You can usevthis program.
I also used same piezo buzzer and also used yur program shared, that is working well. Now i want to try with some different sound alert. Can you please suggest about this ,??
You can sound different using piezo by defining tone and there frequency like #define....
Awsome contents. Thanks for sharing experience.
Thanks dinesh
Hello sir i am B.tech third year student and i am beginer user of arduino controller. <br>I am searching projects DIY like yours to work ipon and learn. <br>Thank you very much for sharing information. You explained vey nicely on video too.
Thanks Harinder.<br>All the best and always try to find out sonething new.
This is verh good. Wondering job.<br>The most beutifully prepare prototype for automatic door opening system.
Thank you very much abhijeet
Well done..... you explained it so nicely......
Thanks Ashita
Thanks ashita
Nice work. Your video presentation is too good. <br>Can you please suggest me different mechanism to open and close door using same setup and same arduino code.
You must try for linkage mechanism.
I took dc motor and choose rack and pinion mechanism. But you can also design for belt drive and some linkage mechanism. Or you can also design folding door rather than sliding door
<br>Big Thanks for auther<br><br>Thanks Pawan<br>
Thank you
Thanks for sharing
Thank you very much for apreciation.
I would like tk ask one more questikn sir.<br><br>How to calculate and define sensor range. Which formula did you use to calculate and how did you wrote program instructions.
You download the ino file that i attached. In thst program there is formula used to define range of sensor....<br>Also in materal and tools info i mentioned there.
Thank you
Great ....<br>Your system is working well...<br>Vlearly explaind in video too...<br><br>I am trying to dispay door status on LCD but is displaying garbage in japanese or chinese character....<br>Can you please help me on this and debug the arduino code...
One of the problem is clearly seen here for your system that...<br>Hardwares is not spevifically designed to server this project. So there can be spme limitations of hardware.
<p>The program is very cool...</p><p>It saved my time. Thank you for your article publish.</p><p>Heads up..</p>
Thanks Mr Sagar.
Can you please share the specifications of DC motor and link where to purchase.
Please watch video....<br>There is sufficient info about dc motor.
<p>Thank you very much Mr kumar.... You got very nice explanations...</p><p>Specially for L293D motor shield reason to use this.</p>
Thanks buddy
<p>Hello sir...</p><p>I tried to run you ino file provided and it compiled without syntax error.</p><p>Can you please send me youtube videos link...</p>
Youtube link already there at the top and also at the last step.
<p>Thank you very much for sharing valuable information...</p><p>Video information is also very good quality and clearly explained.</p><p>Can you please send me connections and pin information...</p>
If you follow the arduino program...<br>I have mentioned and pin info is clearly mentioned.
Thanks bitsj
There is attached ino file.<br>You can download and use directly.<br>
I agree @ sagar anand....<br>I also download ino file
Where is the video link
<p>For any assistance watch video and ask questions. Thank you.</p>

About This Instructable




Bio: Hi... This is Vijendra. I am a mechanical engineer by profession. I love to find new and innovative.
More by VijendraK:Angle of Projections : Engineering Drawing How to make Arduino based collision detection warning system How to Make Automatic Door Opening Using Ultrasonic Sensor HRSC04 
Add instructable to: