Arduino Projects

Automatic door opening system using arduino & ultrasonic sensor

Hi creators in this project I will show you how to make an automatic door opening system using arduino and an ultrasonic sensor.

This is a very interesting project to consider if you are looking for a unique project.

In this tutorial, I will go through the circuit diagram, Arduino codes, and project report.

What is automatic arduino door opener

Generally speaking when you are entering the house you open the door manually by using or pulling the door.

The automatic word is used here since we are automating this process with help of a device.

The work of opening and closing will be taken care by servo.

The mechanism behind working of automatic door is very simple, when the sensor detects obstacles it triggers servo.

The servo is kept in such a way that it can open and close the door.

Bonus: This Automatic bathroom light project could be your next build

To begin with, let us go through the supplies to build this automatic door opener.

If you are building this project you can buy the exact same components that I used from below.

Note that these are affiliate links and I may earn a small commission on qualifying sales at no extra cost to you.

Circuit diagram of automatic door opening system

The circuit diagram is very simple for this arduino project.

Connect the components as follows.

The ultrasonic sensor has four terminals, Vcc, Gnd, Echo and Trig .

Vcc and gnd is connect to 5v and Gnd pins of nano .

circuit diagram of automatic door opening system

The trig is connect to the D9 pin on Uno while echo is connect to D8 pin on the UNO.

Micro servo has 3 pins two for power supply and the signal is connected to D7 pin on the UNO.

You can either power this project via an external battery DC power source or USB power supply from its cable.

As you can see i have used jumper wires for the connection, if you want to make the circuit still smaller you can use PCB.

circuit for automatic arduino door project

 After the circuit is complete you can follow these steps to use the circuit as a door.

Automatic door opening system using arduino code

This is the code that we are using for automatic door opener project.

Copy and paste this code on IDE, Select the proper port number and click on upload.

You can get the servo Libraries from here

// automatic door opening project with arduino //
#include <Servo.h>
Servo servo1;
int trigPin = 9;
int echoPin = 8;
long distance;
long duration;
void setup() 
{
servo1.attach(7); 
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);// put your setup code here, to run once:
}
void loop()
{

ultra_sonic();
servo1.write(90);
if(distance <=9)
{
servo1.write(0);
}
}
void ultra_sonic()
{
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = duration*0.034/2;
}

After the code is done uploading to arduino uno, test the circuit by placing hand in front of hcsr04.

The Ultrasonic sensor when detects something in front of it activates the micro servo.

I have made a simple frame that looks like a door and it can open and close with the help of hot glue.

I attached a micro servo to this door so that we can perform the open and close action.

Also to the side of door frame I will be connecting this ultrasonic sensor module.

Automatic door opening system using arduino circuit installing

This wire needs to be organized well when we are installing this circuit to the model of a door.

How the arduino door project works

When the obstacle is detected by the ultrasonic sensor signals are sent to the UNO the codes will process the signals to activate the Micro servo.

The servos that are in contact with door move as per the horn movements.

When no obstacle is detected by the ultrasonic sensor the servo will remain closed so the door.

The same mechanism is applicable in the automatic door that you will find in parking lots, Shopping Complex and in smart house doors but the components are different.

Video Tutorial

Working video of this project is here

This was all about building the arduino door-opening system using Uno.

If you are looking to build a project with ultrasonic sensor, micro servo and arduino build this useful award winning project.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button