Introduction: How to Make Automatic Door Opening Using Ultrasonic Sensor HRSC04

About: Hi... This is Vijendra. I am a mechanical engineer by profession. I love to find new and innovative.

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

Tools-

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.

#include

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.clear();

lcd.begin(16, 2);

lcd.print("WELCOME");

pinMode(trigPin, OUTPUT);

pinMode(echoPin, INPUT);

pinMode(mt_En_Pin1, OUTPUT);

pinMode(mt_IN1_Pin2, OUTPUT);

pinMode(mt_IN2_Pin3, OUTPUT);

Serial.begin(9600);

pinMode(buzz, OUTPUT);

}

void loop()

{

digitalWrite(trigPin, LOW);

delayMicroseconds(2);

digitalWrite(trigPin, HIGH);

delayMicroseconds(10);

digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance= duration*0.034/2;

if(distance <= 5)

{

digitalWrite(13, HIGH);

delay(1000);

digitalWrite(mt_En_Pin1, HIGH);

analogWrite(mt_IN1_Pin2,50);

analogWrite(mt_IN2_Pin3, 0);

delay(2000);

analogWrite(mt_IN1_Pin2, 0);

analogWrite(mt_IN2_Pin3, 0);

delay(1000);

tone(buzz, 1000);

delay(1000);

tone(buzz, 1000);

delay(1000);

noTone(buzz);

delay(3000);

lcd.clear();

lcd.setCursor(0,1);

lcd.print("Please Enter");

delay(1000);

analogWrite(mt_IN1_Pin2,0);

analogWrite(mt_IN2_Pin3,50);

delay(3000);

}

else

{

digitalWrite(13, LOW);

digitalWrite(mt_En_Pin1, LOW);

analogWrite(mt_IN1_Pin2,50);

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.

Sensors Contest 2017

Participated in the
Sensors Contest 2017

Microcontroller Contest 2017

Participated in the
Microcontroller Contest 2017