Arduino Based Door Automation System Using Ultrasonic Sensor and Servo Motor
Arduino Based Door Automation System Using Ultrasonic Sensor and Servo Motor
net/publication/336253681
Arduino Based Door Automation System Using Ultrasonic Sensor and Servo
Motor
CITATIONS READS
5 17,354
3 authors, including:
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Everistus Zeluwa Orji on 04 October 2019.
ISSN: 2394-2630
Research Article CODEN(USA): JSERBR
Arduino Based door Automation System Using Ultrasonic Sensor and Servo Motor
Computer Engineering, Enugu State University of Science and Technology, Enugu, Nigeria
Abstract Opening and closing of doors have always been a tedious and boring job, especially in places like;
hotels, shopping malls, theaters, etc where a person is always required to open and close the door for visitors.
This human involvement can be avoided by automating the process using different sensors like infrared,
pressure, ultrasonic, laser etc. In this paper, automatic door control system using Arduino microcontroller was
designed. The system combines ultrasonic sensor, servo, and Arduino to achieve the desired goal. When the
ultrasonic sensor installed at the entrance of the building detects a person or an object within the range of the
sensor, a signal is sent to the Arduino microcontroller which controls the servo motor to automatically open the
door. The door remains open until the object goes out of range of the sensor and in turn closes the door
automatically. The results clearly show that the system is cheap, effective, and a reliable means of opening and
closing doors in places like retail stores, super markets, factories and the like.
Keywords Arduino, Ultrasonic Sensor, Automation, Servo Motor, Arduino IDE, PWM
1. Introduction
The market for automated doors is growing and becoming more specialized. The type of product that fits best
with a particular application is determined by frequency of operation, speed of operation required, new versus
existing construction, traffic flow and cost.
Automatic doors are a normal feature in many commercial buildings and infrastructures such as shopping
centers and airports, as well as in industrial environments such as factories. Although they come in variety of
types, including sliding, swing, folding, etc; they all need to conform to the highest standards of safety.
a b
341
Orji EZ et al Journal of Scientific and Engineering Research, 2018, 5(4):341-349
In an industrial environment, automatic doors enables the set temperature in cold storage rooms to be
maintained by fast opening and closing, leading to considerable energy efficiency and reduction of cost.
Automated doors in commercial facilities are the preferred means of access for all users, not only people with
disabilities, and are significant aid to accessibility. Moreover, their use minimizes heat or air conditioning loss,
maintaining a constant temperature and consequently saving money.
Arduino based door automation system was developed to automate the process of opening and closing of doors.
The system uses ultrasonic sensor to detect the presence of an object within the range of the sensor and
automatically opens the door or closes the door when the object goes out of range of the sensor as shown in
figure 1.
Figure 1 shows two scenarios, first, the door remain closed because no object was detected and second scenario,
the door automatically open immediately it detects of an object. In our system, upon detecting an object by the
ultrasonic sensor, it sends an information to the Arduino microcontroller who in turn controls the servo motor to
open the door and keep it open until the ultrasonic sensor sends another information that the object is no longer
in its range of detection. That is, the sensor keeps the detection area under surveillance by emitting ultrasonic
waves. The door is left open while people are in the area as shown in figure 1b.
2. Literature Review
Lucky [1] proposed password protected home automation system with automatic door lock which works on the
principle of breaking an infrared beam of light, sensed by a photodiode. It consists of transmitting infrared
diodes and receiving photo-diodes. The system is to detect whether someone is coming in or not. The
photodiodes are connected to comparators, which give a lower output when the beam is broken and high output
when transmitting normally. The general operation of the work and performance is dependent on the presence of
an object entering through the door and how close the object is to the door. This accomplished detecting an
object that is approaching the door but has a drawback which is the distance the infrared can detect an object
before it gets to the door.
Mahmood [2] designed an automatic door system using a unique wireless ID by using infrared ray or Bluetooth
technology. It consists of a sensing unit, control unit and drive unit to open and close doors at the entrance for a
car that has the unique ID. This process is controlled by using Arduino Leonard and programmed with IDE free
open source software, that receives the signal code from the car which sends the ID through IR LED or
Bluetooth by using a mobile application, decode it. And switch ON the driver that controls the DC motor. Like
[1] work, the system detects a car successfully using infrared ray or Bluetooth technology but both technologies
have short range detection which is not good because the door might hit the car during opening or closing
process.
3. Methodology
This proposed work is about the design of Arduino based door automation system using ultrasonic sensor and
servo motor. When a person or an object approaches the door, the HC-SR04 ultrasonic sensor detects the person
or objects and sends a signal to the Arduino microcontroller who in turn controls the servo motor to
automatically open the door. The door stay open as long as the doorway in not clear and once the doorway is
cleared, the ultrasonic sensor sends another information to the microcontroller to close the door until another
object is detected.
3.1. Hardware Overview
Detailed description of the hardware components used in carrying out this work will be provided in this
subsection.
3.1.1. Ultrasonic Sensor
The ultrasonic sensor emits short and high frequency signal. These signals propagate in the air at the velocity of
sound. If there is an object or obstacle on its path, it will bounce back to the module. The ultrasonic sensor
consists of a multi vibrator, fixed to the base. The multi vibrator is combination of a resonator and vibrator. The
resonator delivers ultrasonic wave generated by the vibration. The ultrasonic sensor actually consists of two
parts; the emitter which produces a 40 kHz sound wave and a detector that detects 40 kHz sound wave and
342
Orji EZ et al Journal of Scientific and Engineering Research, 2018, 5(4):341-349
sends electrical signal back to the Arduino microcontroller [3]. The HC-SR04 ultrasonic module used in this
project has 4 pins, ground, VCC, trig and echo. The Ground and the VCC pins of the module needs to be
connected to the ground and the 5 volts pins on the Arduino board respectively and the trig and echo pins to any
digital I/O pin on the Arduino board.
Distance Measurement
Ultrasonic Sensor
(Transmitter)
Pulse-
Transmission
Circuit
Object
Control Ultrasonic Sensor
Circuit (Receiver)
Receiving
Circuit
Reflection Time: T
Distance: L
Counter Standard
Circuit Oscillation
Circuit
343
Orji EZ et al Journal of Scientific and Engineering Research, 2018, 5(4):341-349
𝑠 10
𝑡= = = 294µ𝑠
𝑣 0.034
The obtained distance will be twice the actual distance since it gives to and fro distance of the object as per the
to and fro time equated to the equation:
𝐷𝑖𝑠𝑡𝑎𝑛𝑐𝑒 = 𝑡𝑖𝑚𝑒 ∗ 𝑠𝑝𝑒𝑒𝑑 (𝟐)
𝑙 = 𝑡 ∗ 𝑣 = 294 ∗ 0.034 = 10𝑐𝑚
Thus the obtained distance divided by 2 gives actual distance of the obstacle.
𝑡𝑖𝑚𝑒 ∗ 𝑠𝑝𝑒𝑒𝑑
𝐷𝑖𝑠𝑡𝑎𝑛𝑐𝑒 = (𝟑)
2
𝑡 ∗ 𝑣 294 ∗ 0.034
𝑙= = = 5𝑐𝑚
2 2
Measurement Scenarios
Figure 4 shows three typical ultrasonic sensor measurement scenarios.
Distance
Distance
Distance
344
Orji EZ et al Journal of Scientific and Engineering Research, 2018, 5(4):341-349
The servo motor in figure 5 use pulse width modulation (PWM) signal for controlling the DC motor; unlike
normal PWM usually used in ordinary DC motor; this PWM signal is not use for controlling the rotation speed,
instead it is use for controlling the motor direction or position [5]. Most servo motor will work well on 50Hz of
PWM frequency; this mean the PWM signal should have a period of 20ms. We can vary SG90 Micro servo
motor angular rotation in between 0° to 180° angle with PWM signal as shown in figure 5.
345
Orji EZ et al Journal of Scientific and Engineering Research, 2018, 5(4):341-349
Arduino UNO- The Arduino Uno is a microcontroller board based on the ATmega 168. It has 14 digital
input/output pins (of which 6 can be used as PWM (pulse width modulation) outputs), 6 analog inputs, a 16
MHz ceramic resonator, a USB connection, a power jack, an ICSP (in-circuit serial programming) header, and a
reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a
USB cable or power it with an AC-to-DC adapter or a battery to get started [6]. Figure 7 above depicts a typical
Arduino UNO board.
Power Suply
Transmitter
Arduino SERVO
Object Microcontroller MOTOR
EC
HO
Receiver
Door Close
346
Orji EZ et al Journal of Scientific and Engineering Research, 2018, 5(4):341-349
The block diagram of the proposed door automation system, which includes opening and closing actions, is
depicted in figure 8. When the HC-SR04 ultrasonic distance sensor senses an object within the specified range
of detection, a signal is sent to the microcontroller which in turn opens the door accordingly with the help of the
servo motor. On the other hand, when there is no object within the specified range, the closing of the door is
activated. The door remains open as long as objects are still within the specified range of detection.
4.1. Control Flow
The control flow diagram of the proposed door automation system, which includes opening and closing actions,
is depicted in figure 9.
Start
Ultrasonic Sensor
is Activated
ECHO No
Received?
Yes
Yes Distance No
=10cm?
Motor Activated
Door Remain &
Opened Door Closed
347
Orji EZ et al Journal of Scientific and Engineering Research, 2018, 5(4):341-349
4.1. Results
Working Principle of Arduino based door automation system using ultrasonic sensor and servo motor illustrated
in figure 9 is as follows:
If there is no person or object within radar of the ultrasonic sensor (10cm), the door remains closed as shown in
figure 9(b). But if there is an object or a person within the ultrasonic radar, the door will automatically open as
in figure 8(b).
a b
Ultrasonic
Sensor
Servo Motor
Servo Motor
Arduino
Microcontroller
348
Orji EZ et al Journal of Scientific and Engineering Research, 2018, 5(4):341-349
The door will remain open until the object goes out of the ultrasonic radar, then it will automatically close. The
system is setup with one Ultrasonic sensor (in front) for ease purpose, but can be extended by adding another
sensor at the back using the same process. This will help to automate entry and exit of our system.
5. Conclusion
This paper presented a prototype of Arduino bases door automation system using ultrasonic sensor and servo
motor. The door automation system uses ultrasonic sensor to detect presence of human or an object within its
radar and sends a signal to Arduino microcontroller who instructs the servo motor to open the door and keeps it
open. Once the object is out of the ultrasonic sensor radar, it sends another signal to the microcontroller for it to
instruct the servo motor to close the door automatically.
Since the door is opened only when a person is detected and remains close all other times, it can save a lot of
energy in the form air conditioning and can be useful for aged and disabled person.
5.1. Limitations
Although this technique is successful in opening and closing the door when a person or objects are detected, the
system is not capable of understanding the type and the intention of the objects. For instance, a puppy or a
passing pedestrian may accidentally trigger the door and cause a false opening action. Frequent false action is
not only annoying, and results in air conditioning energy waste, but also reduces equipment lifetime. Also the
system only serve entry but none was set up exiting using the same door.
Reference
[1]. Lucky Gautam, Chinoy Sharma, Akshaj Arora, and Pinku yadav, "Developing Infrared Controlled
Automated Door System", International Journal of Modern Engineering Research (IJMER) Vol. 3,
Issue. 5, Sep - Oct. 2013 pp-2872-2874.
[2]. Mahmood, S.H., Hassan, O.G., Abass, S.F. and Kwad, A.M, “Auto Opening Door and Car
Identification”, Journal of Computer and Communications, 2016, 4, 132-141.
[3]. Dejan Nedelkovski, (2015), "Ultrasonic Sensor HC-SR04 and Arduino Tutorial", Retrieved 25
September 2017, from http://howtomechatronics.com/tutorials/arduino/ultrasonic-sensor-hc-sr04/
[4]. Tesla Institute, (2016), "Servo motor", Retrieved 26 September 2017, from http://www.tesla-
institute.com/index.php/servo-motor
[5]. RWB, (2009), "Basic Servo Motor Controlling with Microchip PIC Microcontroller", Retrieved 27
September 2017, from http://www.ermicro.com/blog/?p=771
[6]. Brian W. Evans, (2007). "Arduino Programming Notebook, First Edition", Brian W. Evans.
[7]. Massimo Banzi, (2012), "Getting started with Arduino", Beijing, O'Reilly.
349