EE363 Mechatronics
Major Project
Automatic gate control using vision detection
EE363 - Mechatronics
Aim
The main aim of this project is to use the knowledge gained from mechatronics into designing a
vision based sliding gate system. The system should detect number plates and allow the user to
enter through the gate.
The objectives are to:
2|Page
EE363 - Mechatronics
Acknowledgement
We would like to thank the following people because without their help and support this project
would not be as successful as is it is today.
o
o
o
o
o
3|Page
EE363 - Mechatronics
Declaration
We declare hereby declare that this project is a compilation of our own hard work and effort.
Information from external sources such as published material and online sources are properly
referenced in the bibliography. Also help from any individual is acknowledged suitably.
_______________
Ronesh Chand
_______________
Kamendra Swami
_______________
Parth Kantharia
_______________
Rajneel Singh
4|Page
EE363 - Mechatronics
Table of Contents
1
Aim ............................................................................................................................... 2
Acknowledgement .......................................................................................................... 3
Declaration ..................................................................................................................... 4
Abstract ......................................................................................................................... 7
Methodology .................................................................................................................. 8
Introduction.................................................................................................................... 9
7.2
7.3
8.1
Actuators ............................................................................................................... 14
Motors ............................................................................................................ 14
8.1.1
8.2
Transducers............................................................................................................ 16
8.3
8.3.1
LabVIEW........................................................................................................ 18
8.3.2
8.3.3
8.3.4
8.3.5
8.3.6
8.4
AutoCAD .............................................................................................................. 20
10
11
Algorithms ......................................................................................................... 23
EE363 - Mechatronics
11.1.3 Situation 3 ....................................................................................................... 23
11.2
Flowchart ........................................................................................................... 24
12
12.1
12.2
13
Power Transmission...................................................................................................... 25
14
14.2
14.3
14.4
14.5
14.6
14.7
15
15.1
AutoCAD ........................................................................................................... 33
15.3
16
17
18
Recommendations ........................................................................................................ 37
19
Conclusion ................................................................................................................... 38
20
Bibliography ................................................................................................................ 39
6|Page
EE363 - Mechatronics
Abstract
For the mechatronics project, an automatic vision controlled gate system will be constructed. The
knowledge of mechanical engineering, with electrical engineering and proper software needs to be
used in order to construct and operate the gate. The gate system will scan and extract the numbers
from the number plate of the car and will only allow for authorized entry into the premises. The
project will make use of LabVIEW software with an Arduino Board in order to operate. Extracting
vision data from the environment is a very challenging step, but this has been made possible by
the LabVIEW kit for Vision Acquisition. The Arduino Board is very compatible with the
LabVIEW software and can be used in lots of application where monitoring and control is needed
in Real Time environment. The project results can have a lot of significant implications for the
commercial application of automatic gate control. It appears that this application and design can
be a way forward for mechatronics products when it comes to security and would be of great
beneficial in real time application where high security and efficient system of gate control is
needed.
7|Page
EE363 - Mechatronics
Methodology
The methodology of doing this project is divided into several parts, based on research, design,
analysis, simulate, implement and testing.
Research: There are basically two methods of research and can be classified as primary and
secondary methods. The primary method involves research from the library resources such as
books and journals. And the secondary method involves research from the internet.
Design and Analysis: Is where the data/information collected from the research will be used to
develop the circuitry/mechanism to complete the project
Simulation: Using software such as MATLAB, Circuit Maker etc to clarify if the design system is
functional or not.
Implementation: Involves massively in using components (actuators, transducer and controllers)
and construct the system.
Testing: Will simultaneously be done with implementation whereby the bugs in the designed
system will be identified and will be dealt with.
8|Page
EE363 - Mechatronics
Introduction
Automation and automatic control has become one of the centerpieces of research and
development in mechatronic in the pass decades[1]. A Controlling system for such event such as
operating equipment, processes in factories or even a simple door are trigged using simple detector
and trigger mechanisms [2]. This control system can answer to home security as well, as one of
the home security deals with gate accesses and control. And thus this bases this mechatronics
project.
The project is based on an automated gate system with vision recognition and verification control.
The system comprises of a mechatronics system thus, it consists of Mechanical, Electrical and
Software background. The system would include Transducers, Actuator and controllers. The main
system is control access where by the entry will be on recognition and verification of vehicle
entering. Specifically the verification of number plate of entering vehicles.
Automation system for gates is used in various settings such as residential as well as public areas
including parkings. These usually include automatic gates and barriers, sliding gates that would
prevent the unauthorized access. However, the most important concern of these installations is
safety and there are many possible hazards which are associated with these kinds of automation
such as crushing door closing, person lifting, getting entrapped and shearing.
Furthermore, these gates also open automatically when a pedestrian and animals walks from
nearby range. Opening of doors unnecessarily draws a lot of power which increases the electricity
bills.
9|Page
EE363 - Mechatronics
7 Project Planning
7.1 Gantt chart
Tasks
Literature review
Programming Process
Simulation/ Testing
Result comparison
Prototyping
Weekly Meetings
Report Write Up
10 Final Presentation
The Gantt chart was created by putting together lots of thinking and efforts. It was made sure that
all the major tasks were included in it. Proper time was also allocated to each tasks. For example,
Studying about the literature reviews of various components and softwares was given a time of
month, whereas Studying of vision sensors and actuators, Programming process,
10 | P a g e
EE363 - Mechatronics
Simulation/testing and Hardware implementation of the system were allocated with greater amount
of time since it required major understanding and grasping skills. Moreover, programming,
simulation and hardware implementation were a very important part of the project. Hence they
were allocated sufficient amount of time.
Kamendra
Parth
Rajneel
Ronesh
10
11
Legend
R Responsible
A Assist
All the major tasks were divided among the group members equally. Equal strength of work was
allocated to each group member. It was made sure that all the members understood the major
11 | P a g e
EE363 - Mechatronics
concepts of the project. Although a single task was allocated to one particular group member, it
was the responsibility of rest of the team to assist him with the tasks. In this way, all the group
members had a fair share of understanding about each others tasks and hence everyone would
know how the project functions. For example, the building of the gate structure was the task of the
mechanical engineer of the team. In our case it was Kamendra Swami. However, all the group
members assisted him in building the gate.
12 | P a g e
EE363 - Mechatronics
13 | P a g e
EE363 - Mechatronics
8 Literature Review
8.1 Actuators
8.1.1 Motors
When it comes to motors, there are two classifications of it, AC motors and DC motors. Since for
this project, a DC motor was used, this literature review will cater for DC motor only.
Direct Current (DC) motors come in several types, for example, stepper motors, servos,
brushed/brushless motors and so forth. For stepper motor, the inputs are pulses which control the
shaft of the motor between discrete positions, proportional to the pulses. In case, if the load of the
motor is not too great, then an open loop is used to control the motor. There are lots of applications
where this type of motors is used and few to mention are in disk drive head positioning and plotters.
Moving on, the input of servo motor is a voltage value which controls the output shaft to a
particular position according to the input voltage. Servo motors can be found in radio control
airplanes to control the position of wing flaps and similar devices. Finally, the input of a DC motor
can be either voltage or current depending on the torque (speed) required.
For a DC motor, the piece connected to the ground is the stator while the piece connected to the
output shaft is the rotor. The inputs are connected to two wires, where the voltage is applied so
that the motor can turn. A DC motor operates on the basic foundation of the Right Hand Rule,
which states that if one points his/her right hand fingers along the direction of the current, I, and
curl them towards the direction magnetic flux, B, then the direction of the force is along the thump.
14 | P a g e
EE363 - Mechatronics
For a DC Motor, the torque is proportional to the amount of current flowing through the windings,
that is;
=
Where;
T= Torque
I= Current
k= Constant
The coil of wire inside the motor contains both resistance, R, and an inductance, L.
=
Voltage is produced when the motor turns, switching the current flow in the wire. The voltage
produced is known as the back electromotive force (emf) or e. When the motor rotates, its angular
velocity,
w,
is
then
equal
to:
=
15 | P a g e
EE363 - Mechatronics
Now, this voltage generated by the angular velocity is against the voltage applied across the
terminals, therefore;
( ) =
This implies, for a DC motor, the maximum or stall torque is the torque at which w = 0 or T=kV/R.
Hence,
the
stall
or
starting
current
can
be
calculated
by:
8.2 Transducers
When put in general Transducers are devices that convert a signal into one form of energy from
another. The energy conversion types include mechanical, electrical, chemical, electromagnetic,
chemical, acoustic, thermal, etc.
Infrared transmitter/receiver transducers are being planned to be used for the safety problem as it
will immediately inform the controller to stop opening/closing if someone is in the middle of the
door/gate. Secondly the transducers that we want to incorporate in this project is a vision system
that is a camera device that will take shots of images at a particular rate of time and hand it down
to the controller to process.
There are factors that need to be researched on before choosing and implementing the transducer.
These factors are:
Error there is always an error in every measure but a transducer must be chosen that
would give an acceptable amount of error.
Accuracy
Repeatability
Linearity
Hysteresis
Resolution
Sensitivity
16 | P a g e
EE363 - Mechatronics
The two types of control systems are open loop control system and closed loop control system. An
open loop control system uses a controller as well as a control actuator in order to obtain a desired
output. An example of an open loop control system is an electric toaster.
A closed sloop control system however uses an additional measure of actual output that would
compare the desired output response with the actual output. A feedback signal is used to measure
the output. It maintains a relationship f one system variable to another by comparing the functions
and means of control is used as a difference. A more complex system has an interrelationship in
the control scheme. AN example of a closed sloop system is using an autos location in order to
steer an automobile by making the appropriate adjustments.
17 | P a g e
EE363 - Mechatronics
Control systems for this project would require a sensor that can detect any particular movement of
an object or a pedestrian that would cross the gate and thus the sliding door would open
automatically.
8.3.1 LabVIEW
Short for Laboratory Virtual Instrument Engineering Workbench is a system design and
development environment with a visual programming language for program creation. It was
created by National Instruments for mainly data acquisition, instrument control and industrial
automation for Windows, UNIX, Linux and Ma OS X platforms[4].
The graphical programming in LabVIEW is reference as G and is a dataflow programing. The
execution is determined by the structure of the a graphical block diagram on which different
functional node wires are connected created the flow of the program [5].
It has many application of which it has its own add-on and toolkits. As for this project three toolkit
were integrated in to LabVIEW and were; Vision Acquisition, Vision Development and Arduino
interfacing Toolkits.
8.3.2 Vision Acquisition Toolkit
NI Vision Acquisition Software is toolkit for LabVIEW is for acquiring, displaying, logging, and
monitoring image form a multitude of camera types. It can be used to create application using
LabVIEW, C, C++, C#, Visual Basic, and Visual Basic .NET. this toolkit includes NI frame
grabber, NI vision system and NI smart camera [6].
8.3.3 Vision Development Module Toolkit
NI Vision Development Module is toolkit designed to develop machine vision application. It
includes hundreds of function for process acquire images, such as OCR, Pattern recognition,
distance measuring, tracking, searching & matching etc. [6].
8.3.4 Arduino interface Toolkit
NI LabVIEW Interface for Arduino Toolkit is an integrated add-on software for LabVIEW to
easily the interfacing with the Arduino microcontroller with LabVIEW. With it the control and
acquisition of data from the Arduino microcontroller is easier and steam-lined [7].
8.3.5 Arduino Mega 2560
The Arduino Mega 2560 is a microcontroller based on the ATmega2560. It set with a USB
connection, power jack, an ICSP header and a reset button [8]. Its specific feature are shown in
Error! Reference source not found. below. It can be either
powered by the USB connection or with an external power, it
can select the power source automatically.
18 | P a g e
EE363 - Mechatronics
with a pre-burned with a boot loader that allows uploading of new code without the use of any
external hardware programmer. It communicates using STK500 protocol (C header file and
programmable through and using C++ coding use the Arduino software.
8.3.6 Spec of Arduino Mega 2560[8]
Microcontroller
ATmega2560
Operating Voltage
5V
7-12V
6-20V
16
40 mA
50 mA
Flash Memory
SRAM
8 KB
EEPROM
4 KB
Clock Speed
16 MHz
19 | P a g e
EE363 - Mechatronics
8.4 AutoCAD
CAD Computer aided design and drafting is a simple technique of working on a computer with
a CADD software in order to design and obtain drawings as well as models in accordance to
specific standards of industries and companies.
AutoCAD allows the users to draw and design objects of any shape and size. It could be used to
make two dimensional (2D) as well as three dimensional (3D) models. It is a general software that
is used to design, draft and for every engineering disciplines. For example it could be used to draw
or design mechanical parts as well as assemblies, building plans and other architectural drawings,
electronics and much more. Hence, it is one of the best softwares for any engineering profession.
(Yarwood, 2012)
20 | P a g e
EE363 - Mechatronics
21 | P a g e
EE363 - Mechatronics
10 Design Specifications
Some of the specifications of the design of this project are:
A Push Button Switch will be used in the project that indicates to the proximity sensors
that the verification process for the human detection must commence for the opening of
the door
A Camera would be present above the door that captures the image of the person who is
trying to seek entry through the door
A Proximity Sensor would give an analogue signal as output when a person comes in its
range of detection and opens the door accordingly
The transmitter sends signal to a RX Receiver and controls the direction of the moving
mechanism, i.e. the door
In order to control the distance of how much the door opens and closes, a Limiting sensor
is used to give signals to the control unit
There would be an Emergency Stop Switch that would be used to shut down power system
if there is any hazard or malfunction in the system
In this process, digital image is created from the physical image obtained by the sensors
and the cameras. This process is known as Image Acquisition
A database system would be created that stores the image of the entire authorized
individual who is eligible to enter the building.
In order to compare the digital image obtained in acquisition process with the images
saved in the database a Comparator will be used
An actuator used for the project is a Servo motor. Upon an instruction from the controller,
it controls the motion of gears in order to open the door
As a part of a display unit LED units will be used to indicate to the person that a match
has been found and that he is authorized to enter the building. There will be two LEDS.
Different colors are used to indicate success or failure
A buzzer will be used in the system to indicate that the actuators are in function of opening
the door, and the beep will only stop once the door has completely reclosed
In order to turn or shut the overall power in a proper manner an On/Off switch will be
used. Since this is an automatic door, the system will be turned on a 24/7 basis
22 | P a g e
EE363 - Mechatronics
11 Programming Phase
11.1 Algorithms
11.1.1 Situation 1
1. Start
2. Vehicle enters
3. The proximity sensor [1] detects movement
4. The camera gets activated and the camera take a picture
5. The grayscale image Is compared with the code in the memory
6. If the image matches then the gate opens
7. The gate opens up until the limit switch [1] gets pressed
8. The proximity sensor [2] ensures that the vehicle has passed by.
9. Once the proximity sensor detection is null the gate starts to close
10. If the proximity sensor [2] detects any movement it halts, just in case if anybody is in the
way. (avoids injuries/fatalities)
11. End
11.1.2
1.
2.
3.
4.
5.
6.
Situation 2
Start
Vehicle enters
The proximity sensor [1] detects movement
The camera gets activated and the camera take a picture
The grayscale image Is compared with the code in the memory
If the image does not match then the controller rings an alarm to the house hold and informs
the user.
7. If the user recognizes the vehicle he/she could open the gate wirelessly
8. The gate opens up until the limit switch [1] gets pressed
9. The proximity sensor [2] ensures that the vehicle has passed by.
10. Once the proximity sensor detection is null the gate starts to close
11. If the proximity sensor [2] detects any movement it halts, just in case if anybody is in the
way. (avoids injuries/fatalities)
12. End
11.1.3
1.
2.
3.
4.
5.
6.
Situation 3
Start
The user opens the gate wirelessly
The gate opens up until the limit switch [1] gets pressed
The proximity sensor [2] ensures that the vehicle has passed by.
Once the proximity sensor detection is null the gate starts to close
If the proximity sensor [2] detects any movement it halts, just in case if anybody is in the
way. (avoids injuries/fatalities)
23 | P a g e
EE363 - Mechatronics
11.2 Flowchart
24 | P a g e
EE363 - Mechatronics
12 Software Interfacing
The gate is control by Arduino Mega2560 which is interface with LabVIEW for real-time control.
There were two major integration of system for the mapping of the control of the gate; first was
the installation of the vision module into LabVIEW, second was the major one which was
interfacing LabVIEW with Arduino microcontroller.
13 Power Transmission
For the gate to moving back and forth linearly from the rotary motion of the motor mechanism has
to be installed. Transmitting the rotation motion of the motor produced when signaled by the
controller, to linear motion to control the gate motion, gears and rail mechanism would be used.
This mechanism will not only transmit but adjust the power and velocity of the motion of the gate
to the motor RPM. For gear, a gear train mechanism will be used to control/manipulate the power
& speed to be translated in such four gears with parallel shaft arrangement, one end connect to
the motor shaft and the other end gear to the transmit to the rail.
25 | P a g e
EE363 - Mechatronics
14 Programming LabVIEW
14.1 Interfacing LabVIEW Software with Arduino Mega Board.
For our gate design, most of the gate features were controlled by the LabVIEW Software. In order
to enable the software to communicate with the Arduino Mega 2650 Board, a firmware program
code, named LIFA was downloaded from the official site and sent to the microcontroller.
Fig 9:
Features
Input/output
Pin
Allocation.Pin
COM 3
USB port that connects the Laptop with LabVIEW software to the Arduino
Board.
9600
It is defining the Baud rate of the Mega board.
Mega 2650
It is the model number of the board that needs to be defined.
Port 2
Input pin for the proximity sensor 1
Port 3
Input for the proximity sensor 2
Port 7
Input for Limit switch 1
Port 8
Input for Limit switch 2
Port 11
Output for motor- clockwise
Port 12
Output for motor- anti-clockwise
26 | P a g e
EE363 - Mechatronics
27 | P a g e
EE363 - Mechatronics
28 | P a g e
EE363 - Mechatronics
29 | P a g e
EE363 - Mechatronics
30 | P a g e
EE363 - Mechatronics
Features
Image out
Shows the image of the Cars number plate currently in the trajectory. It
relates which numbers are matching with the numbers currently in the
database.
Match Found
String Read
Car detection
A LED that gives the output from the proximity sensor. It lights every time
the sensor detects a Car.
31 | P a g e
EE363 - Mechatronics
15 Hardware Design
15.1 Gate Mechanical Design
The mechanical designing of an automated gate system comprises of the follows subsections:
32 | P a g e
EE363 - Mechatronics
15.2 AutoCAD
AutoCAD was used in our project to design some of the components that were installed on the
model of the gate. The design of the AutoCAD drawing is shown above. It consists of the
components such as the tracks, rails, gear and wheels. These components were then printed using
the 3D printing facility available at the University.
There were four tracks that were joined together to form a single track on which the gate would
move. Each track was 150mm long. Moreover, there were 2 rails, each with a length of 150mm.
The rails were designed in a way to cater for the gears to rotate on them. The wheels were designed
in a way that they would accurately fit on the path of the tracks.
Designing the components with AutoCAD made our work easier since, it saved time and moreover
very accurate, thus making the final product after the 3D printing, of the same size and length as
per the requirement. Furthermore, it also helped us to broaden our knowledge on AutoCAD, which
would indeed be very helpful in our future endeavors.
33 | P a g e
EE363 - Mechatronics
34 | P a g e
EE363 - Mechatronics
35 | P a g e
EE363 - Mechatronics
36 | P a g e
EE363 - Mechatronics
17 Challenges Faced
This project was very challenging because our group found difficulty getting a suitable controller.
The Microcontroller PIC16F877 was all being used by students of other units. A lot of time was
wasted troubleshooting on faulty boards and initiating microcontroller. However, we lost hope
with this and search for an alternative.
The alternative controller Teensy 3.0 was obtained which was completely functional, however,
when it came to interfacing the processor with LabVIEW it did not work. The LIFA in Arduino
did not support Teensy 3.0 reason being that LabVIEW does not support teensy 3.0 because it has
an ARM processor.
It was really challenging to interface the proximity sensors with the system. The sensors would
sometime work and sometimes malfunction therefore we had to demonstrate with the sensors.
The 3D printing of the hardware model took a lot of time and the technicians werent available all
the time to have our design printed out this caused our project to be behind schedule.
18 Recommendations
It is highly recommended dynamic type of vision detection de used in this application as the user
will not always be parking or entering at the same place. At this point in the time the region of
interest is static and at a very specific region. Dynamic detection would enhance the features of
the project at it would not matter where the car is parked.
Secondly, it is highly recommended that sensors be used for protection as we were not able to
interface it in our project.
Thirdly, the model of the gate was half designed and 3D printer and half made by hand. It is
recommended that the whole system be printed in the 3D printer.
The most important recommendation is that embedded systems (standalone systems) be used for
controlling purposes instead of a personal computer as this is not feasible for real life applications.
37 | P a g e
EE363 - Mechatronics
19 Conclusion
In Conclusion it can be said that a mechatronic system had been composed and developed. A
mechatronic system can be identified by the availability of a control system, transducers and
actuators. The control system in our case was LabVIEW linked with Arduino mega. The
transducers or the feedback element of the design were switches and proximity sensors. The
actuator was a DC motor.
This project is has been a great learning experience for all the group members, we learnt from
model designing in AutoCAD, to using Arduino Mega, to flow programming in LabVIEW.
Automatic gate control using vision detection is a great innovative idea when implemented it
would get a good market value. However, our system has to be made more robust by using sensors
and with the use of dynamic vision processing.
38 | P a g e
EE363 - Mechatronics
20 Bibliography
1. M. P. Groover, Automation, production systems, and computer-integrated
manufacturing: Prentice Hall Press, 2007.
2. G. Campion, G. Bastin, and B. DAndrka-Novel, "Robotics and Automation," 1996.
3. M. Gopal, Control systems: Tata McGraw-Hill Education, 2012.
4. J. Travis and J. Kring, LabVIEW for Everyone: Graphical Programming Made Easy and
Fun (National Instruments Virtual Instrumentation Series): Prentice Hall PTR, 2006.
5. (2014, 29th May). LabVIEW. Available: http://en.wikipedia.org/wiki/LabVIEW
6. C. G. Relf, Image acquisition and processing with LabVIEW: CRC press, 2003.
7. M. . Granado Navarro, "Arduino based acquisition system for control applications,"
2012.
8. A. Mega, "2560," Internet: http://arduino.cc/it/Main/ArduinoBoardMega2560,[maj. 14,
2012], 2011.
9. Agarwal, T. (2013). Servo Motor Working, Advantages & Disadvantages. Mumbai: ElPro-Cus
10. Yarwood, A. (2012). Introduction to AutoCAD. London: Routledge.
39 | P a g e