39
The University of the South Pacific EE363 Mechatronics Major Project Automatic gate control using vision detection Ronesh Chand S11081346 Parth Kantharia S11073898 Kamendra N Swami S11057378 Rajneel Singh S11086873

EE363 vision based Major Project

Embed Size (px)

DESCRIPTION

Mechatronics project report

Citation preview

Page 1: EE363 vision based Major Project

The University of the South Pacific

EE363 – Mechatronics

Major Project

Automatic gate control using vision detection

Ronesh Chand – S11081346

Parth Kantharia – S11073898

Kamendra N Swami – S11057378

Rajneel Singh – S11086873

Page 2: EE363 vision based Major Project

EE363 - Mechatronics

2 | P a g e

1 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:

Explore LabVIEW software

Interface Arduino with LabVIEW

Design circuits for high voltage motor control

Program the algorithm in LabVIEW

Page 3: EE363 vision based Major Project

EE363 - Mechatronics

3 | P a g e

2 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 Dr Kabir Mamun – for his guidance and constant supervision

o Dr. Utkal Mehta – for his guidance and help with the ARDUINO Mega controller

o Mr. Binal Raj – for is continuous help in lending us the components and 3D printing

o Our parents for their encouragement and support

o Finally we would like to thank god

Page 4: EE363 vision based Major Project

EE363 - Mechatronics

4 | P a g e

3 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

Page 5: EE363 vision based Major Project

EE363 - Mechatronics

5 | P a g e

Table of Contents 1 Aim ............................................................................................................................... 2

2 Acknowledgement .......................................................................................................... 3

3 Declaration ..................................................................................................................... 4

4 Abstract ......................................................................................................................... 7

5 Methodology .................................................................................................................. 8

6 Introduction .................................................................................................................... 9

7 Project Planning ........................................................................................................... 10

7.1 Gantt chart ............................................................................................................. 10

7.2 Responsibility Table ............................................................................................... 11

7.3 Major Tasks Breakdown ......................................................................................... 13

8 Literature Review ......................................................................................................... 14

8.1 Actuators ............................................................................................................... 14

8.1.1 Motors ............................................................................................................ 14

8.2 Transducers ............................................................................................................ 16

8.3 Control Systems ..................................................................................................... 17

8.3.1 LabVIEW........................................................................................................ 18

8.3.2 Vision Acquisition Toolkit ............................................................................... 18

8.3.3 Vision Development Module Toolkit ................................................................ 18

8.3.4 Arduino interface Toolkit ................................................................................. 18

8.3.5 Arduino Mega 2560 ......................................................................................... 18

8.3.6 Spec of Arduino Mega 2560[8] ........................................................................ 19

8.4 AutoCAD .............................................................................................................. 20

9 Block Diagram of the overall System ............................................................................. 21

10 Design Specifications ................................................................................................... 22

11 Programming Phase ...................................................................................................... 23

11.1 Algorithms ......................................................................................................... 23

11.1.1 Situation 1 ....................................................................................................... 23

11.1.2 Situation 2 ....................................................................................................... 23

Page 6: EE363 vision based Major Project

EE363 - Mechatronics

6 | P a g e

11.1.3 Situation 3 ....................................................................................................... 23

11.2 Flowchart ........................................................................................................... 24

12 Software Interfacing ..................................................................................................... 25

12.1 Vision System ..................................................................................................... 25

12.2 LabVIEW Arduino Interface ................................................................................ 25

13 Power Transmission ...................................................................................................... 25

14 Programming – LabVIEW ............................................................................................ 26

14.1 Interfacing LabVIEW Software with Arduino Mega Board. .................................. 26

14.2 Initializing the pins. ........................................................................................... 26

14.3 Car Detection ...................................................................................................... 27

14.4 Vision Acquisition .............................................................................................. 28

14.5 Motor Control for Gate Opening .......................................................................... 29

14.6 Motor Control for Gate Closing ........................................................................... 30

14.7 Graphical User Interface ...................................................................................... 31

15 Hardware Design .......................................................................................................... 32

15.1 Gate Mechanical Design ...................................................................................... 32

15.1.1 Structure, Mounting & Housing design ............................................................. 32

15.2 AutoCAD ........................................................................................................... 33

15.3 ACTUAL HARDWARE MODEL ....................................................................... 34

16 Real life application of the System ................................................................................. 36

17 Challenges Faced .......................................................................................................... 37

18 Recommendations ........................................................................................................ 37

19 Conclusion ................................................................................................................... 38

20 Bibliography ................................................................................................................ 39

Page 7: EE363 vision based Major Project

EE363 - Mechatronics

7 | P a g e

4 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.

Page 8: EE363 vision based Major Project

EE363 - Mechatronics

8 | P a g e

5 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.

Page 9: EE363 vision based Major Project

EE363 - Mechatronics

9 | P a g e

6 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 parking’s. 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 draw’s a lot of power which increases the electricity

bills.

Page 10: EE363 vision based Major Project

EE363 - Mechatronics

10 | P a g e

7 Project Planning

7.1 Gantt chart

Tasks

Week

1-4

March

Week

1-4

April

Week

1-2

May

Week

3-4

May

Week

1-2

June

Week

3-4

June

1 Literature review √

2 Studying about the Vision sensors

and Actuators

√ √

3 Programming Process √ √

4 Simulation/ Testing √ √

5 Hardware implementation of the

system √ √

6 Result comparison √

7 Prototyping √

8 Weekly Meetings √ √ √ √ √ √

9 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 software’s was given a time of

month, whereas Studying of vision sensors and actuators, Programming process,

Page 11: EE363 vision based Major Project

EE363 - Mechatronics

11 | P a g e

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.

7.2 Responsibility Table

Task Kamendra Parth Rajneel Ronesh

1 R A A A

2 A R A A

3 A A A R

4 A A R A

5 R A A A

6 A R A A

7 A A A R

8 A A R A

9 R A A A

10 A R A A

11 A A A R

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

Page 12: EE363 vision based Major Project

EE363 - Mechatronics

12 | P a g e

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 other’s 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.

Page 13: EE363 vision based Major Project

EE363 - Mechatronics

13 | P a g e

7.3 Major Tasks Breakdown

1. Studying of Literature Review

Actuators

Motors

Transducers

Sensors

Control System

AutoCAD

LabVIEW

Arduino MEGA 2560

2. Studying about the Vision sensors and Actuators

Proximity Sensors

3. Programming Process

LabVIEW modelling

Arduino MEGA 2560 – LIFA code

4. Simulation/Testing

LabVIEW

5. Hardware Implementation of the system

The final hardware model should works as follows: Whenever a car was tracked in front

of the camera, the LabVIEW triggered the Webcam to take the picture of the car’s number

plate, which would then be verified by LabVIEW database. After a delay of 5 seconds the

motor would move in the reverse direction and hence the gate would close. The following

materials and resources would be used in the Hardware implementation:

Gate Design – AutoCAD

3D printer

Gate

Limit Switches

Motor Driver IC

Webcam

Proximity Sensors

6. Results Comparison

Reviewing the obtained results and comparing with the available

techniques to get better results.

7. Prototyping

8. Weekly Meetings

9. Report Write Up

10. Final Presentation

Page 14: EE363 vision based Major Project

EE363 - Mechatronics

14 | P a g e

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.

Page 15: EE363 vision based Major Project

EE363 - Mechatronics

15 | P a g e

Figure 1: Right Hand Rule

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:

𝑒 = 𝑘𝑤

Page 16: EE363 vision based Major Project

EE363 - Mechatronics

16 | P a g e

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:

𝐼 = 𝑉

𝑅

At no load, the motor can give the maximum speed w.

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

Page 17: EE363 vision based Major Project

EE363 - Mechatronics

17 | P a g e

8.3 Control Systems

An interconnection of components in order to form a system configuration to produce desired

system response is referred to as a Control system. A component or a process can be controlled in

the following way:

Figure 2: Process under control[3]

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.

Figure 3.Open Loop Control System[3]

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 auto’s location in order to

steer an automobile by making the appropriate adjustments.

Figure 4: Closed Loop control system[3]

Page 18: EE363 vision based Major Project

EE363 - Mechatronics

18 | P a g e

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.

This controller can be programmed with Arduino software

provided by the manufacture at the website. This board come Figure 5 Arduino Mega 2560

Page 19: EE363 vision based Major Project

EE363 - Mechatronics

19 | P a g e

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

Input Voltage (recommended) 7-12V

Input Voltage (limits) 6-20V

Digital I/O Pins 54 (of which 15 provide PWM output)

Analog Input Pins 16

DC Current per I/O Pin 40 mA

DC Current for 3.3V Pin 50 mA

Flash Memory 256 KB of which 8 KB used by boot loader

SRAM 8 KB

EEPROM 4 KB

Clock Speed 16 MHz

Page 20: EE363 vision based Major Project

EE363 - Mechatronics

20 | P a g e

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 software’s for any engineering profession.

Figure 6: A Sample AutoCAD design

(Yarwood, 2012)

Page 21: EE363 vision based Major Project

EE363 - Mechatronics

21 | P a g e

9 Block Diagram of the overall System

Figure 7: Block Diagram

Page 22: EE363 vision based Major Project

EE363 - Mechatronics

22 | P a g e

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

Page 23: EE363 vision based Major Project

EE363 - Mechatronics

23 | P a g e

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 halt’s, just in case if anybody is in the

way. (avoids injuries/fatalities)

11. End

11.1.2 Situation 2

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 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 halt’s, just in case if anybody is in the

way. (avoids injuries/fatalities)

12. End

11.1.3 Situation 3

1. Start

2. The user opens the gate wirelessly

3. The gate opens up until the limit switch [1] gets pressed

4. The proximity sensor [2] ensures that the vehicle has passed by.

5. Once the proximity sensor detection is null the gate starts to close

6. If the proximity sensor [2] detects any movement it halt’s, just in case if anybody is in the

way. (avoids injuries/fatalities)

Page 24: EE363 vision based Major Project

EE363 - Mechatronics

24 | P a g e

11.2 Flowchart

Figure 8: Flow Chart

Page 25: EE363 vision based Major Project

EE363 - Mechatronics

25 | P a g e

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.

12.1 Vision System

LabVIEW only has no vision accusation and processing programs, therefore add-on development

by its creator were install for the vision system. This were;

NI Vision Acquisition software

NI Vision Development Module

These two are integrated in LabVIEW was responsible acquiring the image from the webcam,

process the image and then running it follow its optical character recognition (OCR) software for

matching and verification.

12.2 LabVIEW Arduino Interface

The interface of LabVIEW to Arduino was achieve through NI Arduino Interfacing toolkit created

by NI. It comprise with its interfacing graphical dataflow codes and a coded C++ Arduino software

to be uploaded to the microcontroller. The file uploaded “LIFA” located in the Arduino Interfacing

root directories contain the real time control of the microcontroller via LabVIEW.

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.

Page 26: EE363 vision based Major Project

EE363 - Mechatronics

26 | P a g e

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.

14.2 Initializing the pins.

Fig 9:

Input/output

Pin

Allocation.Pin

Features

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

Page 27: EE363 vision based Major Project

EE363 - Mechatronics

27 | P a g e

14.3 Car Detection

Fig 10: Loop for car detection

For this step, a proximity sensor was connected to Port 3. The sensor was connected at the main

entrance, where the car will come and wait in front of the gate. Every time, if the sensor detects an

object, it will trigger the LED and will turn on the camera. The main advantage of using this sensor

in the gate system is that it helps save electricity that might have been consumed by the camera if

was switched ON all the time. Another point to note is that this step is an ongoing step, since the

proximity sensor needs to keep on checking for car detection, therefore, the whole processed is

looped.

Page 28: EE363 vision based Major Project

EE363 - Mechatronics

28 | P a g e

14.4 Vision Acquisition

Fig 12: Image comparing

Once the Car Detection process is successful, the camera is switched on. In the acquisition process,

the camera takes an image of the cars number plate and then extracts the numbers in the form of

strings. After extraction process, the program than compares the numbers with the already stored

numbers in the database and tries to find a match. If there is a match, then the LabVIEW will give

for the gate to be opened, otherwise it will blink the LED indicating that the car is unauthorized to

enter. Moreover, at the phase, a buzzer could have been connected which could have notified the

owner or the responsible authorities of the failure.

Page 29: EE363 vision based Major Project

EE363 - Mechatronics

29 | P a g e

14.5 Motor Control for Gate Opening

Fig 13: Gate Opening

Upon the successful match of the car’s number plate with the number plates in the database,

LabVIEW will then give a command to through Port 11 of the Mega Board to rotate the motor for

gate operation. The motor will rotate until it hits the limit switch 1 placed at the end of the track

through Port 7. Once the switch is triggered, the motor will stop for 5000 ms. This will allow the

driver to drive through the gate into the premises.

Note:

At this point, for safety precaution, a proximity sensor could be used instead of the delay. The

proximity sensor will relay on the real time input which will be more enhancing and safe compared

to the delay set. Also, the delay value can be varied.

Page 30: EE363 vision based Major Project

EE363 - Mechatronics

30 | P a g e

14.6 Motor Control for Gate Closing

Fig 13: Gate Closure

After the 5 sec Delay, the LabVIEW will give the command through the port 12 of the mega board

to rotate the motor in opposite direction. The motor will keep on rotating until it hits Switch 2.

This will indicate that the gate has been closed and that the car has successfully entered the

premises. The whole program is looped, therefore after completing this process; the program will

start again and wait for a Car Detection.

Page 31: EE363 vision based Major Project

EE363 - Mechatronics

31 | P a g e

14.7 Graphical User Interface

Fig 14: Graphical User Interface

Interface Features

Image out Shows the image of the Car’s number plate currently in the trajectory. It

relates which numbers are matching with the numbers currently in the

database.

Match Found A LED that lights every time a match has been found.

String Read It gives an output of the numbers that can be read by the camera.

Car detection A LED that gives the output from the proximity sensor. It lights every time

the sensor detects a Car.

Page 32: EE363 vision based Major Project

EE363 - Mechatronics

32 | P a g e

15 Hardware Design

15.1 Gate Mechanical Design

The mechanical designing of an automated gate system comprises of the follows subsections:

Structure, Mounting & Housing designing

Power transmission designing

Condition and Safety designing

15.1.1 Structure, Mounting & Housing design

15.1.1.1 Frame

The base frame from the gate design will incorporate base structure, the power transmitting rail,

housing from the sensors and rolling mechanisms. A draft as of the frame as shown in Figure 1. It

show the location of the sensor housing and gear rail for power transmission.

Figure 15 Gate Frame

Page 33: EE363 vision based Major Project

EE363 - Mechatronics

33 | P a g e

15.2 AutoCAD

Figure 16: AutoCAD Drawing

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.

Page 34: EE363 vision based Major Project

EE363 - Mechatronics

34 | P a g e

15.3 ACTUAL HARDWARE MODEL

The Hardware model of the final design consisted of a gate, tracks, wheels, gear, rails, DC motor,

MEGA Arduino 2560, limit switches, webcam and a laptop. The tracks were mounted to the base.

Thereafter, rails were also screwed on the body of the gate. In order to allow the gate to move,

wheels were attached to its bottom, by inserting a shaft through its center. The gate was then placed

on the tracks and it was made sure that it moved freely. In order to protect the gate from falling

down a support was made using a piece of wood.

The final hardware design also had two limit switches at the ends of the gate. The gear was attached

to the DC motor and it was placed in such a way that it moved freely on the rails. The motor was

connected to the motor driver IC – 74410NE. This was used since the Arduino board was not able

to provide enough provide that was sufficient enough to drive the motor powerfully. The limit

switches were connected to the Arduino board and so were the controlling wires of the motor.

The gate was designed in such a way that whenever a car is present in front of the gate, the

LabVIEW software would compare the number on the number plate of the car with those stored

in its database. If the number is correct, the Arduino would trigger, the motor, and that gate opens.

This would continue until a point in time when the gate would touch one of the limit switches

present at the far end of the tracks. As soon as it touches the limit switch, the motor would stop,

hence stopping the motor. This happens because the limit switch is now normally open. Hence

there is no power to the motor. Hence the car can move inside the gate at this time. After a delay

of five seconds, the gate would start to close. Yet again, the motor stops when the gate triggers the

limit switch present at the other end of the tracks.

This process would continue whenever a car approaches the gate. In case of an unrecognized

number plate, the gate would not open. In this case, a buzzer would send whereby the owner would

be informed about the presence of a car near the gate. A push button was provided. This could be

sued to open the gate manually in such situation. The final model of the hardware design is shown

below:

Page 35: EE363 vision based Major Project

EE363 - Mechatronics

35 | P a g e

Figure 17: Final Hardware model

Page 36: EE363 vision based Major Project

EE363 - Mechatronics

36 | P a g e

16 Real life application of the System

This project could be implemented in many real life scenarios. Since, the gate of the house only

opens for certain vehicles, it could add more safety to a building. It could be implemented at many

places where high security is required, such as Parliament house, banks and many other places

which permit access for only limited number of people.

Furthermore, in order for this project to work on a real life application this project it is needed to

develop it on to an embedded system, which could work without a computer. Thus, this small

embedded device with all the circuitry could then be installed at any places mentioned above. This

would provide very high security and hence solve the problem of trespassing.

Moreover, in a real life application, DC servo motor should be used in order to open and close the

gate. This is highly recommended since it uses a position sensing device, thus allowing the motor

to know the direction in which it should rotate (Agarwal, 2013). Thus it is more precise. In order

to add more safety in a real life application, vision detecting sensors should also be used in this

project. Hence it would protect the cars passing through the gate.

Thus a real life application of this project is very much possible and it could become a very

successful invention in the area of housing as well as commercial security.

Page 37: EE363 vision based Major Project

EE363 - Mechatronics

37 | P a g e

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 weren’t 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.

Page 38: EE363 vision based Major Project

EE363 - Mechatronics

38 | P a g e

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.

Page 39: EE363 vision based Major Project

EE363 - Mechatronics

39 | P a g e

20 Bibliography

1. M. P. Groover, Automation, production systems, and computer-integrated

manufacturing: Prentice Hall Press, 2007.

2. G. Campion, G. Bastin, and B. D’Andrka-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: El-

Pro-Cus

10. Yarwood, A. (2012). Introduction to AutoCAD. London: Routledge.