Automatic Garage Door System with Arduino

12 downloads 0 Views 2MB Size Report
technology. Key words— arduino, arduino software, park sensor, servo motor. ... In this study, a garage door system which enables the car garage door to be ... electronic device based on hardware and software which has open source code ...
Automatic Garage Door System with Arduino For defined licence plates of cars

Yelda FIRAT Çanakkale Onsekiz Mart University Çanakkale, TURKEY [email protected]

Abstract—Our life is kept under control and supervision at the same time as it gets easier with intelligent devices emerging with the technology of the century that we are in. One of these technologies is Arduino, a physical computing platform having a development environment for a simple microprocessor and software. Using Arduino, the signals from the various sensors can be read, the lights can be turned on and off, the engine can be started; in short, all electronic applications that might come to mind are possible. In this study, a garage door system which enables the car garage door to be opened and closed automatically according to the numbers of the identified car plates using the external hardware and software development environment via the Arduino platform, has been developed. In addition, while the garage door is moving down in case any entity approaches the door too close, the control of the door motor has been also considered as to provide the security through the sensor, remote controller and desktop software. This work designed specifically for the use of servo-motors scanning the angles of 360 degree also contributes to the next execution to be developed in order to create a safer system using face recognition technology. Key words— arduino, arduino software, park sensor, servo motor.

I. INTRODUCTION Today's technologies are advancing day by day with the need for which electronic devices can make our life easier and the information can be obtainable and available from everywhere all the time. Every moment of our life is under control and supervision with these intelligent devices that emerge with this advancing technology. The fact that these intelligent devices with which we encounter every day from our mobile phone, our car, our fridge in our home, television, washing machine to microwave have affected our life by operating has existed with the development of technology continuously up to now together with curiosity and need. The heart of these smart devices is microcontrollers. In other words, the microcontrollers are heavily used in embedded applications. As well as mobile phone, tablet and laptop, everybody has almost an intelligent device such under their hands, and they are basically created from hardware components like processor, ram/rom/flash memory/display/input-output ports. In this system, an operating system that controls the hardware is needed in order that the electronic card can work. The microcontrollers have the

978-1-5386-6878-8/18/$31.00 ©2018 IEEE

Taşkın UĞURLU Çanakkale Onsekiz Mart University Çanakkale, TURKEY [email protected]

necessary structure so that we can simply prepare and control this operating system [1]. Arduino is an electronic card that has already one microcontroller and is ready to work with pins and communication ports, the control elements of which can be connected. In this study, a garage door system which enables the car garage door to be opened and closed automatically according to the numbers of the identified car plates using the external hardware and software development environment via the Arduino platform with a microcontroller, has been developed. In addition, while the garage door is moving down in case any entity approaches the door too close, the control of the door motor has been also considered as to provide the security through the sensor, remote controller and desktop software. In this sense, Arduino platform has been introduced in the second part of this work. In the third part, the hardware units required by the automatic garage door system have been described along with their specifications. In the fourth part, the construction stage associated with each other and the software of these hardware units have been defined by showing through the figures. In the fifth part, the final results have been given. II. WHAT IS ARDUINO ? Arduino is an electronic prototype development platform that offers the possibility to use hardware and software easily. In other words, Arduino, flexible and easy to use, is an electronic device based on hardware and software which has open source code, an electronic prototyping platform [2]. The objects can be constructed that can control the light, sound, touch and movement, or can be obtained reactions through Arduino. Because of its flexibility, Arduino is now used to create incredible objects such as musical instruments, robots, light sculptures, games, interactive furniture and even interactive clothes. Arduino is used in many educational programs around the world by designers and artists who want to easily create prototypes, but do not need a deep understanding of the technical details behind their designs [3]. Arduino is best known for its hardware, but also needed software to program that hardware. This combination seems to provide the creation of projects that perceive and control the physical world.

A. Arduino Software Software programs, called sketches, which are used to program the Arduino cards are created on the computer using the Arduino IDE (Integrated Development Environment). The IDE enables the code to be written and edited and allows this code to be converted into instructions that the Arduino hardware understands. The IDE also passes these instructions to the Arduino board. The programs written on the IDE are prepared using C and C # programming languages. B. Arduino Hardware A microcontroller is an intelligent hardware element that can be controlled by being programmed. It can also be called a small computer that contains a processor, memory unit, and programmable input/output unit. Basically, any device that has interaction and communication with a user works with the microcontroller. A microcontroller is a computer on a chip in which many support devices like RAM (random access memory), ROM (read only memory), timers, counters, I/O (input/output) peripherals are fixed in one integrated circuit [4]. Arduino is an electronic card that has already one main microcontroller, is ready to work with pins and communication ports, the control elements of which can be connected. The input/output block diagram of this card is simply shown in Fig. 1 [9].

Fig. 1. The arduino input/output board block diagram.

As can be seen in Fig. 1, the input/output board contains a serial port, power supply circuitry, expansion connectors and miscellaneous support components. AVR (Alf Vegard RISC) architecture, which is one of the most important out of 8 bit microcontroller architectures, is usually used in Arduino cards [5]. The priority on the Arduino platform is simplicity. It does not require more extensive electronic and programming knowledge. The sensors that measure temperature, humidity, light, movement, distance and air quality can be easily integrated. The Arduino chip has been designed as LED simulator system and the air quality sensor system by many scientists [2, 6]. Since Arduino has an open source platform and it also allows to develop free designs with cheap, easily accessible, extra functions, this work has been tried to develop a system

978-1-5386-6878-8/18/$31.00 ©2018 IEEE

that allows a designated garage door to be automatically opened and closed according to the plates of defined cars. III. ARDUINO DEVELOPMENT ENVIRONMENT FOR AUTOMATIC GARAJE DOOR SYSTEM The main elements that the structured system needs are: • Arduino UnoR3MEGA328P- CH340G Chip • Servo 360 Motor (PowerHD AR3606HB) • Camera • Parking Sensor (HC-SR04 Ultrasonic Distance Sensor) • Keyes IR (Infrared) Receiver Module Wireless Remote Controller Kit • IDE software platform A. Arduino Uno R3MEGA328P-CH340G Chip Arduino Uno is a platform based on the ATmega328 microcontroller. There are 14 input and output pins. Six out of them can be used as PWM (Pulse Width Modulation) output. A Uno on which incorporates 6 items of analogue inputs, a 16 Mega Hertz (MHz) ceramic resonator, a USB (Universal Serial Bus) port, a power socket, an ICSP (In-circuit serial port) header and a reset button contains everything needed to support a microcontroller. Power can be provided by connecting a USB cable linked to an AC-DC (Alternative Current-Direct Current) adapter, a battery or a PC to the Uno. Arduino's hardware function can be expanded with external plugs, called shields that are commercially produced or created by the user. Shields functions include networking capabilities such as Ethernet, Bluetooth, ZigBee. Arduino's areas of usage are touch panel capability, data logging capability without the need of a computer, joystick and button combination for reading user input, motor drive shields and specific shields with LED drivers included for LED control. In practice, the Ethernet shield gives the Arduino an IP address allowing it to be controlled over the internet, the Bluetooth shield allows wireless communication with mobile phones running on Android and IOS (internetwork operating system) /iPhone (internet phone) Units [7]. In Fig. 2, the faceplate and connection points of the Arduino Uno R3 version are shown. Here; the reset button, USB connector, USB serial port converter circuit, 7-12 Volt (V) power connection, power and auxiliary pins, analogue / digital converter pins, Atmega 328 MCU (Microcontroller Unit), MCU ISCP pins (In Circuit Serial Programming), Debug LED, general purpose pins are available.

C. Parking Sensor (HC-SR04 Ultrasonic Distance

Sensor) The garage parking sensor is a very useful device when the parking space is limited and the space between the rear wall or garage door and the car is very small. It prevents bumping into the wall and helps stop at exactly the desired location. A sample parking sensor and Arduino connection diagram are shown in Fig. 4. Garage parking sensor uses HC-SR04 ultrasonic distance sensor to measure distance from a sensor position to a car. When car approaches sensor and gets in range, red, yellow, green LED lights up depending on distance readings.

Fig. 2. The connection points on arduino uno cards.

B. Servo 360 Motor (PowerHD AR3606HB) DC motors are easy-to-drive motors. However, they are not suitable for precision works because they do not provide feedback indicating exactly where the motor shaft is. In other words, in order to know the position of DC motors, an external encoder needs to be installed on the shaft. Servo motors move angularly according to the given command and can stay in the desired position. The parts of servo motors constitute a drive circuit, a potentiometer, and a motor. A servo motor on the left side and its internal structure on the right side are seen in Fig. 3. The servo motors shown in the figure are produced as standard and continuous rotation according to the operation. Standard servo motors move between 0-1800. The reason of the travel limit is the potentiometer used for feedback in the motor gear shaft. With this potentiometer, how many turns the motor has made is sent to the servo drive circuit. Thus, the drive circuit in this servo motor senses whether or not the motor moves as required by feedback from the potentiometer. Pulses of a certain length are sent to control the servo motor [8, 10]. When the potentiometer of the standard servo motor shown in Fig. 3 is disassembled, the servo motor rotating continuously is obtained.

Fig. 4. Parking sensor and arduino connection diagram.

The HC-SR04 Ultrasonic Distance Sensor seen in Fig. 4, can measure sensitively as distant as 3 millimeters (mm) from 2 centimeters (cm) to 400 centimeters (cm). D. IR (Infrared) Wireless Remote Controller Kit A variety of remote control robots and interactive works can be design by IR Remote Kit. In Fig. 5, IR Remote Controller Kit appears. This kit includes infrared remote and IR receiver.

Fig. 3. Servo motor and internal structure. Fig. 5. Infrared remote controller kit.

978-1-5386-6878-8/18/$31.00 ©2018 IEEE

IV. THE CONSTRUCTION STAGE OF AUTOMATIC GARAGE DOOR SYSTEM A circuit created from an IR remote controller kit receiver, a parking sensor and a motor has been connected to the Arduino Uno. Thus, this enables the vehicle to control the motor that provides the motion of the garage door both for the distance to the sensor and by pressing the reverse and forward buttons of the IR remote controller kit. Here, while the garage door is moving down in case any entity approaches the door too close, the control of the door motor has been also considered as to provide the security through the sensor, remote controller and desktop software. HC-SR04 is one of the most popular sensors used with Arduino in robotic projects. It is easy to use, and as stated before, can measure the distances between 2 centimeters (cm) and 400 centimeters (cm) properly if the program part is smooth. An ultrasonic sound wave from the TRIG pin of the sensor as a signal is transmitted at the frequency of 40 Kilo Hertz (KHZ). When this sound wave is reflected back from any object, it is caught by ECHO pin. Thus, the distance of the vehicle from the sensor is calculated by being measured the duration between the transmission of the signal and the capture of the reflection. On the other hand, the receiver of the IR Remote Controller Kit is also placed on the breadboard. The GND (GROUND) header of the receiver is then grounded. Its VCC (+) header is given 5 Volt (V). The DATA header is connected to the pin number 8. After this connection, the GND header of the servo motor is grounded. Its VCC (+) header is given 5 Volt (V). The PULSE header is connected to the pine number 9. The scheme of this phase of this work in Fig. 6, the breadboard scheme is shown in Fig. 7, and its test image is also shown in Fig. 8.

Fig. 6. The board scheme that enables the motor to move according to the parking sensor and the IR remote controller kit.

Fig. 7. The breadboard scheme that enables the motor to move according to parking sensor and IR remote controller kit.

978-1-5386-6878-8/18/$31.00 ©2018 IEEE

Fig. 8. Test image of the movement of the motor according to the parking sensor and IR remote controller kit.

As seen in Fig. 6 and Fig. 7, the voltage output of the parking sensor is connected to the 5 Volt (V) pin of the Arduino, the GND header is connected to the GND pin, the TRIG output is connected to pin number 10, and the ECHO output is connected to pin number 11. Three tasks are performed at the same time with this connection through the Multi- Thread application. With this application, while the car and entity are moving towards the garage, the when the distance between the parking sensor and the ground is less than 5 inches, the motor thread of the garage door in motion is stopped as a security countermeasure. When a safe environment is established and the distance measured is 5 inches or greater than 5 inches, the motor thread is restarted and resumed from where it is in motion. Thus, the motor is provided with freedom of movement again. The Arduino IDE code that provides this is shown in Fig. 9, Fig. 10, Fig. 11, Fig. 12.

Fig. 9. Arduino IDE code1 providing the control of the garage door.

According to this working principle, Arduino Uno is programmed as follows; if the input value is openTheDoor, the door is opened; if it is stopTheDoor, the door is stopped; if it is closeTheDoor, the door is closed. This input value can be obtained from different ways; • Independently the Garage Controller (GC) via desktop software • Independently through the remote controller • Through the Ultrasonic Sensor

Fig. 10. Arduino IDE code2 providing the control of the garage door.

978-1-5386-6878-8/18/$31.00 ©2018 IEEE

one of which is the void loop (), are created in order to provide the control and restriction of vector motion. One of the arguments of the values of 1, 0, or -1 is sent to MotorAction () method, which is created to be called from the void loop (), the mobility and immobility of the motor, hence the garage door is controlled. In other words, the direction of the movement is provided by the value coming to the action parameter of the Motor Action () function according to both sensor, the remote controller and the desktop software of the garage door. As seen in the code given in Fig. 9, Fig. 10, Fig. 11, and Fig. 12, the control of the garage door is also provided with the GC desktop software which makes LPR (License Plate Recognition) written in C # via the camera. Respectively: • This software is installed on a computer where the windows operating system is computerized. • A camera is connected to one of USB ports of the computer and Arduino microcontroller is connected to another. The connection formation is shown in Fig. 13. Fig. 11. Arduino IDE code3 providing the control of the garage door.

• The plate information obtained through the camera is sent to the Arduino microcontroller via COMX serial port and the necessary communication is provided. • After processing the captured images, the plate information obtained is compared with the list of vehicles allowed by the GC software. If there is a match between the plate information obtained and the list of authorized vehicles, the door opens. • Whether or not the match is; the plate of the vehicle incoming, the time and information if the door is opened or not are added to the recent logs. • In addition, the garage door can be closed, stopped and opened through the program via a virtual remote control in the GC. • Via GC; controller and/or LPR services (modules) can be stopped and started. The general interface of this software is shown in Fig. 14.

Fig. 12. Arduino IDE code4 providing the control of the garage door.

As seen in the code given in Fig. 9, Fig. 10, Fig. 11, and Fig. 12, the MotorAction (int toggle) method is called in the main thread. That is, in order to ensure safety, if 0 (zero) value is sent to the movement function of the motor, the garage door in motion is stopped. If coding is tackled in more detail, the thread loops of void Chronometer (void) which are based on duration and the thread loops of void parksensor (void) which are based on distance,

978-1-5386-6878-8/18/$31.00 ©2018 IEEE

Fig. 13. The integrated view of motor, parking sensor, IR remote controller kit and camera.

Fig. 14. Garage Controller (GC) interface coded in C #.

Fig. 16. LPR interface.

As shown in Fig. 14, four buttons, a log list and a search box to check in the logs for settings, remote controller, LPR management and permissions management have been configured on this interface.

As seen in Fig. 16, after the operation starts, the camera image is watched live through the two forms that are opened and the operations performed through the camera and the plate information obtained can be followed live from here.

The settings control is activated by the settings button as shown in Fig. 14. This control enables the selection of Baud Rate for COM and communication between the GC and the Arduino Uno microcontroller. The remote controller and LPR system can be disabled or restarted. Also access to the permissions list can be closed with a password.

A new interface form opens with the permissions management button as well. By means of this form, the list of permissions of the plate information from the LPR system to check the match by the program can be managed. This interface is shown in Fig.17. With this interface, the existing authorized vehicles can be displayed and deleted; new entries can be added to the list of authorized vehicles.

A new interface (form) opens with the virtual remote controller button. This interface is in the form of a small remote controller. OpenTheDoor, closeTheDoor, stopTheDoor commands can be sent to the Arduino Uno microcontroller via this control. The reverse, forward and stop buttons controlling the garage door can be seen in Fig. 15. A new interface (form) opens with the LPR management button. Through this form, the system-dependent camera hardware can be seen and the desired hardware can be operated for GC-LPR. This interface is given in Fig. 16.

Fig. 17. Permissions management interface.

18.

Fig. 15. Virtual remote controller interface.

978-1-5386-6878-8/18/$31.00 ©2018 IEEE

The model image of the work carried out is shown in Fig.

[10] S. Monk, 30 Arduino Projects for the Evil Genius, New York:McGrawHill, 2010, pp. 138.

Fig. 18. The model image of automatic garage door system.

V. CONCLUSION As shown in the work fulfilled, Arduino is a physical programming platform created from developing atmosphere consisting of an application of the processing/wiring language and an input/output card. As programming can be realized with Arduino libraries easily, the robots and systems that are interactive with the environment by processing of signals from the sensors can be designed. In addition, Arduino has a variety of cards and modules designed to produce solutions for different needs. In this study, using Arduino's work platform, a garage door system has been developed that opens and closes automatically according to the car license plate numbers defined. In addition, while the garage door is moving down in case any entity approaches the door too close, the control of the door motor has been also considered as to provide the security through the sensor, remote controller and desktop software. This system can be converted into a more secure system by means of driver-vehicle matching using face recognition technology in the next phase of the work. REFERENCES [1] [2]

[3] [4] [5]

[6]

[7]

[8] [9]

E. Delebe, Projelerle ARDUINO, 9 rd ed.,KODLAB, 2016, pp. 1. P. Teikari, R. Najjar, H. Malkki, K. Knoblauch, D. Dumortier, C. Gronfier, and H. Cooper, “An inexpensive Arduino-based LED stimulator system for vision research”, Journal of Neuroscience Methods, vol. 211, no. 2, pp. 227-236, 2012. M. Margolis, Arduino cookbook., 1st ed. Sebastopol: O’Reilly Media, 2011, pp. 1-3. W. Bolton, Programmable Logic Controllers, Fourth Edition, Published by Elsevier Newnes, 2006, pp.3-6. D. Russel, Introduction to Embedded Systems: Using ANSI C and the Arduino Development Environment, Morgan & Claypool Publishers, 2010, pp. 89-96. D. Mendez, M. Labradorb, and K. Ramachandranc, “Data interpolation for participatory sensing systems”, Pervasive and Mobile Computing, vol. 9, no. 1, pp. 132-148, 2013. R. Faludi, Building wireless sensor networks: with ZigBee, XBee, Arduino, and Processing, Sebastopol: O’Reilly Media, Inc; 2010, pp. 189-233. R. Firoozian, Servo Motors and Industrial Control Theory, Mechanical Engineering Series, Second Edition, Springer, 2014, pp. 73. D. Wheat, Arduino Internals, New York: Friendsof apress, 2011, pp. 2.

978-1-5386-6878-8/18/$31.00 ©2018 IEEE