Microcontroller Based Automatic Gate
Microcontroller Based Automatic Gate
1, March 2013
African Journal of Computing & ICT
© 2013 Afr J Comp & ICT – All Rights Reserved - ISSN 2006-1781
www.ajocict.net
O. Olatinwo
Department of Computer Engineering
Moshood Abiola Polytechnic, Abeokuta, Nigeria.
Department of Computer Science and Engineering
Ladoke Akintola University of Technology
Ogbomoso, Nigeria.
and [email protected]
ABSTRACT
The common gate found almost everywhere has a lot of problem in term of operation, it is energy consuming, stressful
and above all costly in term of paying for the man responsible for opening and closing of such gates, this then requires a
fast solution. The microcontroller based automatic gate control is a better solution for the elimination of these problems
caused by the manually controlled gates. The system monitors the gate as vehicles enter and exit the gate it is being
mounted. The microcontroller based automatic gate senses any vehicle approaching as it cut across the path of the Infra
red ray. After sensing this, the gate then automatically opens, wait for some time and closes after the time elapsed. The
systems also work as an automatic lock, when the lock button is pressed that is when it is ON the gate does not open even
if a vehicle cross the Infrared path. There is a special thing about this automatic gate I did in this project and that is it is
totally controlled by both software and hardware, if there is any need for modification it can be easily modified by
changing some part of the software since the microcontroller used can be reprogrammed, or if there is a hardware failure
this can be changed and the system will be alright..
1. INTRODUCTION
Microcontroller based systems refine, extend or Microcontroller based automatic gate is an alternative to
supplement human facilities and ability to observe, a manually controlled gate which is laborious, frustrating,
communicate, remember, calculate or reason and take costly and energy consuming. Many are the devices
certain decision when necessary. In a search for making which a microcontroller can be used in making some of
Electronics Applications think, act and respond like these are GSM phones, PDAs, Sound systems, Pumping
Human, the proposed system was developed. The machines, Robots e.t.c. The proposed system comprises
proposed system attempts to make life more interesting of several component, the first is the sensors which detect
by reducing unnecessary waste of man-power by any vehicle near it and send a signal to another set of
employing microcontrollers. There are changes everyday, component. It is interesting to note that this device can
many things are being discovered due to technology perform some things like opening automatically, closing
advancement, different devices are been discovered to automatically, lock up totally when the car park is filled
solve many of human’s problems. One of these problems up and no vehicle can gain an entrance into the park. This
can be solved using a microcontroller to control devices work can be employed in public car parks, markets,
thereby reducing the work of man. In addition to this libraries, hotel, homes and anywhere that require the use
development, human being is not resting in an effort to of gates. It has many advantages over a manned gate in
find a solution to all of there problems and this project is the sense that it eliminate stress and salary of a gateman,
in no exception. also it can determine what to do next when a vehicle has
come close to the gate.
21
Vol 6. No. 1, March 2013
African Journal of Computing & ICT
© 2013 Afr J Comp & ICT – All Rights Reserved - ISSN 2006-1781
www.ajocict.net
The sensors in the system which are Infrared Input/Output controller (PIO). The embedded software
transmitted and receiver, sense and send a signal to the causes the microprocessor to send a signal to the output
system, at one end an infrared transmitter is fitted port of the interface unit in other to activate the dc
which transmit a signal to another infrared receiver so motor to control the opening and closing of the gate.
if this signal is interrupted by a vehicle, there is an
input to the trigger circuit which is held HIGH. The A LOW will never activate the gate, false triggering is
trigger circuit serves as an ADC (Analog-to Digital taken care of by circuitry. There is a DC power unit
converter), which produces a HIGH when the beam is supplier which supplies the required voltage by the
interrupted. The trigger circuitry sends a signal to the system and this is constant because the microcontroller
interface unit, which is made up of Programmable is highly sensitive to voltage supplied into it.
22
Vol 6. No. 1, March 2013
African Journal of Computing & ICT
© 2013 Afr J Comp & ICT – All Rights Reserved - ISSN 2006-1781
www.ajocict.net
The circuit has the ability to detect the passage of an 2.5 PIC16F84 Microcontrollers
automobile through the entrance and the exit of the gate
only if the infrared beam is interrupted from either side. The PIC16F84 belongs to a class of 8-bit
Each pair of the sensor is separated by a reasonable microcontrollers of RISC architecture. The PIC chips
distance such that the passage of a person or other have two separate 'data' busses, one for instructions and
moving object cannot obstruct the sensor pair one for everything else. Instructions are essentially in
separation. Also the height of the sensor is considered ROM and dedicates the microcontroller to doing one
only the body of the vehicle can interrupt the light task, RAM is where variables are stored, there is very
beam of the sensor and not the tires or its windows. little RAM, a few dozen bytes, and this is reserved for
variables operated on by the program. There is also
very little 'data' storage, again a few dozen bytes, and
this is in EEPROM which is slow and clumsy to
change. EEPROM is used to hold values to be
remembered when the power is turned off
23
Vol 6. No. 1, March 2013
African Journal of Computing & ICT
© 2013 Afr J Comp & ICT – All Rights Reserved - ISSN 2006-1781
www.ajocict.net
The PIC16F84 CPU is one of the most powerful 8-bit microprocessor in the electronics world today. It is a sophisticated,
sequential, digital circuit that is designed to follow a sequence of instructions called a program. The program of
instructions put in memory for the microprocessor to execute makes it so versatile and flexible in that its operation can be
changed by simply changing the programs stored in memory (software) rather than rewire the electronics (hardware).It
has a role of connective element between other blocks in the microcontroller. It coordinates the work of other blocks and
executes the user program.
24
Vol 6. No. 1, March 2013
African Journal of Computing & ICT
© 2013 Afr J Comp & ICT – All Rights Reserved - ISSN 2006-1781
www.ajocict.net
PIC16F84 has a total of 18 pins. It is most frequently found in a DIP18 (Dual In Package) type of case but can also be
found in Surface Mount Devices (SMD) case which is smaller from a DIP.
The Pins on PIC16F84 microcontroller have the Clock from the oscillator enters a microcontroller via
following meaning: OSC1 pin where internal circuit of a microcontroller
divides the clock into four even clocks Q1, Q2, Q3, and
2.8 PIC16F84 Clock/Instructions Q4 which do not overlap. These four clocks make up one
Clock is microcontroller's main starter, and is obtained instruction cycle (also called machine cycle) during
from an external component called an "oscillator”. The which one instruction is executed. Execution of
small instruction set, (37 instructions), and the 14 bit size instruction starts by calling an instruction that is next in
of instructions lead to a number of compromises. One string. Instruction is called from program memory on
cannot have two registers specified in a single instruction. every Q1 and is written in instruction register on Q4.
Each register takes 7 bits to specify its address, but one Decoding and execution of instruction are done between
also have to specify the instruction number and what to the next Q1 and Q4 cycles. On the following diagram we
do. By comparing a microcontroller with a time clock, can see the relationship between instruction cycle and
the "clock" would then be a ticking sound we hear from clock of the oscillator (OSC1) as well as that of internal
the time clock. In that case, oscillator could be compared clocks Q1-Q4. Program counter (PC) holds information
to a spring that is wound so time clock can run. Also, about the address of the next instruction.
force used to wind the time clock can be compared to an
electrical supply.
25
Vol 6. No. 1, March 2013
African Journal of Computing & ICT
© 2013 Afr J Comp & ICT – All Rights Reserved - ISSN 2006-1781
www.ajocict.net
Note I= Input O= Output I/O = Input/Output P = Power ST = Trigger input TTL = TTL input __ = Not used
For a proper function of any microcontroller, it is necessary to provide a stable source of supply, a sure reset when you
turn it on and an oscillator. According to technical specifications by the manufacturer of PIC microcontroller, supply
voltage should move between 2.0V to 6.0V in all versions. The simplest solution to the source of supply is using the
voltage stabilizer LM7805 which gives stable +5V on its output. One such source is shown in the picture below.
26
Vol 6. No. 1, March 2013
African Journal of Computing & ICT
© 2013 Afr J Comp & ICT – All Rights Reserved - ISSN 2006-1781
www.ajocict.net
27
Vol 6. No. 1, March 2013
African Journal of Computing & ICT
© 2013 Afr J Comp & ICT – All Rights Reserved - ISSN 2006-1781
www.ajocict.net
28
Vol 6. No. 1, March 2013
African Journal of Computing & ICT
© 2013 Afr J Comp & ICT – All Rights Reserved - ISSN 2006-1781
www.ajocict.net
29
Vol 6. No. 1, March 2013
African Journal of Computing & ICT
© 2013 Afr J Comp & ICT – All Rights Reserved - ISSN 2006-1781
www.ajocict.net
4. SYSTEM CONSTRUCTION, TESTING AND The test instrument used for examining logic signal,
RESULT testing and troubleshooting applications in the course
of the project were: digital multimeter, logic probe, and
The stages involved in the construction of the proposed oscilloscope. Testing involve troubleshooting the
system are: design validation, bread board and vero hardware system to detect, isolate and correct internal
board implementations, testing, packaging and or external fault such as malfunction in the internal
modeling. circuitry, input or output shorted to ground or Vcc input
or output open circuited, short between two pins broken
4.1 Design Validation wire, poor of dry connection, bent or broken pins, or an
IC and faulty ICs socket. The hardware system was
The best workable circuit was devised taking into properly tested because the software cannot work when
consideration some parameters such as signal levels the hardware is not functioning properly.
between components, compatibility of signals and
components, cost and availability of components. The The testing of the entire circuit was carried out in
program to direct the operation of the gate was written stages
in the Assembly Language and electronically written 1. Each of the components was first tested using
into the PIC (16F84A). A very important advantage to the multimeter in order to check for their
design validation is the use of software packages such state of performance and accurate values.
as ORCAD PSPICE to simulate the design before 2. In the connection of each component on the
implementation. Vero board was then tested. This was done in
other to carry out the continuity, which is
4.2 Breadboard Implementation meant for proper connection of the circuit
and to detect any wrong connection.
The circuit design was implemented on the bread board 3. The sensor unit circuitry was tested to
after validating it on circuit simulator. During this ascertain the degree of sensitivity. A small
stage, various parameters like voltage drops, input prototype car (object was placed between the
impedance, base current, pulse width were measured in two pairs of the infrared diodes to obstruct
order to ensure good result. light rays. The voltage levels at the output
The circuit design was tested on the board and found to were observed with the aid to a digital
be working properly before soldering. multimeter. The result is shown in the table 2.
4.3 Vero Board Implementation Table 2: Voltage levels of the sensor unit
30
Vol 6. No. 1, March 2013
African Journal of Computing & ICT
© 2013 Afr J Comp & ICT – All Rights Reserved - ISSN 2006-1781
www.ajocict.net
6. After the proper testing of the peripherals and [1] Rafiquzzaman, M (2011) 'Microcontroller
found to be working perfectly, the entire Theory and Applications with the PIC 18F"
circuit was tested. Series of programs [2] Di Jasio, L (2008) "Programming 32-Bit
{software} were written and tested before the Microcontrollers in C: Exploring the PIC 32
working program was fully achieved. The (Embedded Technology)"
circuit worked perfectly as designed. The [3] Wilmshurst, T (2009) "DESIGNING
display unit was also observed during the Embedded Systems with PIC
testing. Microcontrollers: Principles and
Applications"
Packaging [4] Reese, R.B., Bruce, Bruce, J. W. And Jone,
B. A. (2008) "Microcontrollers: From
After proper testing was conducted, the packaging of Assembly Language to PC using the PIC
the design into a model and casing was considered. The Family"
connecting wires were properly connected and well [5] Morton, J (2005) "The PIC Microcontroller:
insulated, also the wires were well packed and bounded Your Personal Introductory Course"
together. [6] Huang, H and Chartrand, L (2004) "PIC
Microcontroller" An Introductory to Software
5. CONCLUSION and Hardware Interfacing"
[7] Sandhu, H (2008) "Making PIC
The use of microcontroller system has been achieved in Microcontroller Instruments and Controllers"
the design and implementation of this project. This [8] Bates, M. P (2011) "PIC Microcontrollers:
project can be easily tailored to any electric gate and all An Introduction to Microelectronics"
kinds and all forms of control, which has the use of [9] Van Dam, B (2008) "PIC Microcontrollers:
sensors. For an effective design of this kind of system it 50 Projects for Beginners and Experts" [10]
is imperative to have a good grasp of the basic sensor Prof. A.O Odinma, Software Engineering
characteristic, microcontroller characteristic and Lecture Notes
assembly language principles. The infrared photodiode [11] Prof. A.O Odinma and Engr. O. Shoewu,
which was used as a sensor serves as a transducer for Computer Aided Application Lecture Notes
vehicle detection while the programming language is [12] Engr. Lawrence Oborkhale, Microprocessor
fundamental to software design based on the system and Applications Lecture Notes
requirement, specification and operation of the system. [13] Engr. Balogun, Semiconductor Devices
The automatic gate designed can be used in companies, Lecture Notes
public car park, domestic parking lot and automobile [14] http://www.privatedoor.com
terminal, where little or no form of security is required. [15] http://www.access-automation.co.uk
[16] http://www.gateautomation.com
[17] http://www.twystedpair.com
[18] http://www.howstuffswork.com
31
Vol 6. No. 1, March 2013
African Journal of Computing & ICT
© 2013 Afr J Comp & ICT – All Rights Reserved - ISSN 2006-1781
www.ajocict.net
APPENDIX
32