Sie sind auf Seite 1von 78

Chapter one

Introduction

1.1 Background of the project

Security of human life and property is one of the paramount


challenges facing any nation or any corporate organization. Also,
ensuring safety and confidentiality of data & message stored in a
system or electrical appliances is quite essential to prevent
unauthorized

access.

The

design

and

construction

of

programmable electronic digital code lock system provides a sure


way of ensuring this security and safety for data. Programmable
digital code lock ignition system is a high security code lock
system that can be used to lock electronic devices ignition system
of a car. In this paper, the digital code lock was used as a security
measure in an automobile car, achieved through the ignition part
of the automobile car which is used to engage and disengage the
engine from cranking in order to put the car in motion.

This system is a combination of hardware and software at its best.


In this design, a device is locked using a six digit code (password).
The code can be set according to the users desire, hence the
name PROGRAMMABLE. The electronic code lock locks up the
system by switching to alarm mode when any wrong code is
entered for ones and stops, the system allows the user to start it
only when a proper 4-digit code is entered in the correct
sequence. This research proposes a simple electronic based
security lock for an engine car. In particular, the design includes
na

keypad

as

microcontroller

an
as

input,
a

two

control

relays
unit.

as

The

switches,
keypad

and

and

a
the

microcontroller were fitted in inside a car, whereas the output


wires from the microcontroller were connected to two relays. The
two relays were used to close the spark ignition and the fuel
pump circuits of a car. By default, the spark ignition and the fuel
pump circuits of a car are open. When a user enters a correct
password through the keypad to the microcontroller, the spark
ignition and the fuel pump circuits close and the engine operate
as normal. However, both spark ignition and fuel pump remain

open if a wrong password is entered. The developed design of the


security lock has been successfully tested.

1.2 Aims and objectives

This project aims at locking the ignition of the vehicle with a


password developed on a microcontroller unit. An anti-theft
system is a device or method used to prevent or detect the
unauthorized appropriation of items considered valuable. Theft
is one of the most common and oldest criminal behaviors.
Where the ownership of a physical possession can be altered
without the rightful owner's consent, theft prevention has been
introduced to assert the ownership whenever the rightful owner
is physically absent. Anti-theft systems have been around since
individuals began stealing other people's property and have
evolved accordingly to thwart increasingly complex methods of
theft. There are some of existing alarms and security systems
3

have been used in modern cars. The majority of these systems


are focusing on making of alarm voice if any one tries to enter
inside the car. These systems are based on electronic circuits
that receive signals from switches mounted on car doors or
sensors mounted on a car body. Modern security systems are
focusing on stopping car engine operation.
1.3 Scope of the project
In this project a student is to study and understand the basic
principles on the design and construction of a code lock ignition
system which is use to lock the ignition modules of a car, and if
the password is not entered well will not allow passage to
stating of the engine block.
1.4 Project limitation
As technology ranges from simple to complex, the design and
construction of a code lock ignition system can be bridge at the
ignition point of the car which if the person who is trying to make
a way with it is a good personal will sense the cutoff point in the
bonnet where the installation is made and he can now go and
bridge it.

Others includes the power supply unit which was driven from the
car can still case the code program failure which there is a hard
starting, the battery may go weak and the code circuit will not be
able to work properly.

1.5 Justification of the project


In the design and implementation of this system, a code lock
ignition system is trust worth as it helps to protect individuals
from accesses another persons car without his notification,
and also restrict theft inside or within the car system.
1.6 Project report organization
The organization of the project report is well detailed and vast
in its coverage. It covers all the activities encountered during
the research work. The first chapter is the introductory chapter,
which covers the background, project objectives, project
justification, scope of the project, limitations. Chapter two
presents the literature reviews. Chapter three covers the
system analysis and design in details. Chapter four presents
the system implementation which entails the component
layout, the wiring schedule, the wiring diagram and also the
5

complete schematic diagram. Chapter five covers the testing


and integration of the project design. Chapter six is the
summary and conclusion which includes the summary of
achievements, problems encountered during project design,
recommendation and suggestion for further improvement.

CHAPTER TWO
LITERATURE REVIEW
2.1 Origin of the project
Ignition system
Early one September morning in 1908, Ernest Sweet, chief
engineer for the Cadillac Motor Car Co., stepped off a train in
Dayton, Ohio. He was met by an engineer who worked for
National Cash Register.
In the five years he had spent at NCR, the younger man -- he was
32 -- had invented an electrically operated cash register that did
away with hand cranking. He had also developed OK Charge

Phone, the nation's first "automated" credit checking system. This


magnetic device, placed in a cash register, allowed a sales person
to press register keys and transmit information about a charge
customer's purchase to a central office. Approval or disapproval
was then telephoned back to the counter. The young man's
contemporaries thought him a genius.
However, Sweet was not in Dayton to discuss cash registers. At
the urging of his boss, Henry M. Leland, he was there to test-drive
a Cadillac Roadster owned by the NCR engineer. Leland had
received a letter from the Dayton resident describing a "flawless"
battery ignition system for motor vehicles. Magneto ignition was
the standard in those days because battery ignition just did not
work. Sparkplugs fouled, vibrators failed, and batteries often gave
out after 500 miles. Brief encounters with battery ignition by
other carmakers -- Duryea in 1893, for example -- caused them to
return to the reliable magneto.
For the next eight hours, Sweet drove the Cadillac over the hills
surrounding Dayton, putting the Roadster through every rigorous
test he knew. As the young engineer had promised, the ignition
7

system performed flawlessly. As a result of this test, Leland met


the NCR engineer several weeks later at Cadillac headquarters in
Detroit to personally hand him a contract calling for 8,000 of his
battery ignition units -- enough for every Cadillac that would be
produced in 1910. The young engineer was Charles Franklin
Kettering. In the years ahead, his influence on General Motors
would rival even that of Leland.
What had Kettering done that allowed a battery ignition to
perform reliably? To start with, he combined the standard four
induction coils (one for each sparkplug) into one by placing them
in a heat-resistant, solidly anchored, armored-steel box and
connecting them in series. This did away with the nagging
problem of rapid coil failure caused by vibration and heat, and
also allowed conservation of power. Battery life was therefore
extended.
Kettering also eliminated the individual vibrators (also called
"tremblers") - - one for each coil -- that made and broke the
circuit. He replaced them with a single master set of contact

points connected to a condenser. The condenser drew excess


current away from the points, contributing to their longevity.
Tremblers (steel springs) were susceptible to loosening by
vibration. This required motorists to make frequent adjustments.
The devices also quickly burned themselves to death as a result
of electrical arcing. Kettering's ignition produced a much hotter
spark than ever before, using less battery current, which
extended component life.
The contract Leland handed Kettering enabled him to quit NCR
and begin his own business, which he called Dayton Engineering
Laboratories Co. -- Delco for short. More important, the contract
put Kettering's mind solely on perfecting what was to be the
standard auto ignition system -- one that's still with us today -and on development of the self-starter.
Yet, when the 1910 Cadillac Model 30 hit the showrooms,
customers found that it possessed two independent ignition
systems -- the much-heralded Delco and the standard magneto,
installed just in case.

Although it was only another two years before dry cells were
replaced by storage batteries, it was quite a while longer before
storage batteries attained any degree of reliability.
As late as 1935, some manufacturers were still placing magnetos
into cars. But, for all intents and purposes, the end of the
magneto came with the end of the Model T Ford in 1927. Ford
refused to trust battery ignition for the Model T, even after the
development of more reliable storage batteries. So, every Model T
came with a self-starter and battery for "modern starting," and a
hand crank that sprung the magneto to life if the self-starter or
battery failed.
Equipment leasing is often used in manufacturing; it is possible it
was used in the manufacturing of these ignition systems.
Four basic systems
There have been only four basic auto ignition systems during the
last 100 years -- hot tube, magneto, battery and computerized -plus a number of oddball variations. As late as 1924, systems
using lighter flints and moving files (sometimes attached to the
10

piston) were being tried. Engines in which sliding valves exposed


the fuel mixture to a pilot light had proved dangerous, and the hot
tube finicky.
The hot tube was just that -- a closed metal tube that projected
from the cylinder and was heated red hot by a sort of Bunsen
burner. Because it was always hot, ignition took place as the
compression rose -- there was no "timing" as such.
The advantage of a spark ignition is that, not only can you time it,
but the flame doesn't blow out when you drive fast. The earliest
sparks were produced by a tiny generator that employed
permanent magnets and was therefore called a magneto.
Although several inventors are credited with developing magneto
ignition, Siegfried Marcus was issued a patent in 1883 for a
"magneto-electric ignition system." It proved to be the basis for
an automotive ignition system that lasted until battery ignition
took over.
Marcus's system used two contact points installed inside the
cylinder: one was stationary, the other, movable. The stationary
11

point was connected to the magneto, or generator. The movable


point was mounted on a small plate. As the plate moved, it
brought the two points into contact. At this moment, an external
pushrod operated by the camshaft interfered to break the circuit
and produce a spark.
The Marcus low-voltage make-and-break ignition system served
well as long as motor cars were driven at low speeds by singlecylinder engines. But, as multicylinder engines became popular
and roads improved, the need for an ignition system that could
deliver a steady stream of sparks became apparent. The result
was a jump-spark system that used induction coils, tremblers and
sparkplugs.
Some of those plugs were ingeniously designed to compensate for
fouling, which was frequent. They carried over to battery ignition
systems.
One popular type had an insulated knob at the top that was
connected to a small metal rod. It allowed the motorist to adjust a
secondary gap, which could be viewed through a window in the

12

plug's top section. Fiddling with this gap was said to blast away
deposits.
Another type was a priming plug. The driver opened a small valve
on the plug that allowed gas in a reservoir to drip through the
plug itself and into the cylinder. There was, however, a problem: If
the motorist didn't close the priming valves tightly before
starting, the engine either flooded or, if ignition did take place,
was transformed into a flame thrower. Then there was a plug with
electrodes at both ends. If the motorist experienced plug failure,
he simply unscrewed a terminal cap, turned the plug end for end,
reattached the terminal cap was to the fouled end, and he had a
fresh plug ready to go.
There have been many other ignition developments over the
years -- spark advance components, for example. The first manual
spark advance system was brought out by Packard in 1901. For
years after, drivers controlled spark advance by a lever on the
steering wheel hub. Studebaker pioneered the vacuum advance in
1930, and Chrysler installed the first combination vacuum and
centrifugal advance unit in 1931. During the 1980s, on-board
13

computers took over the job of spark advance. A computer can


generate three-dimensional timing "maps," as opposed to the old,
two-dimensional curves.
In l961, the Delco Division of General Motors announced an
ignition system that eliminated contact points and condensers by
using electronic circuitry. At the time, Herman Hartzell, Delco's
chief engineer, said the new breakerless system was being
studied with an eye toward installing it on trucks, tractors and
heavy-duty stationary engines. Chrysler made a similar system
standard equipment in 1972, and "pointless" ignition became
universal.
Two years ago, a new computerized system reared its headprobably the most revolutionary development in ignition since
1908. Introduced by Buick driven off the external water pump. on
its 3-liter V6 engines, it eliminates the mechanical distributor
entirely. Sensors on the engine detect crankshaft angle and,
therefore, piston position. This information is fed to the enginecontrol computer which, at the right moment, triggers one of
three coils in a black box. Each coil fires two sparkplugs
14

simultaneously, one near the end of a piston's compression


stroke, igniting the air-fuel mixture, and the other near the end of
the opposing piston's exhaust stroke, where it fires harmlessly.
Each pair of plugs fires once for every crankshaft revolution.
Variations of GM's ignition are likely to show up on all gasoline
engines of the future, replacing distributors just as the Delco
breaker point system took over from the magneto.

An Ignition (or starter) switch is a switch in the control system of


an internal combustion engine motor vehicle that activates the
main electrical systems for the vehicle. Besides providing power
to the starter solenoid and the ignition system components
(including the engine control unit and ignition coil) it also usually
switches on power to many "accessories" (radio, power windows,
etc.). The ignition switch usually requires a key be inserted that
works a lock built into the switch mechanism. It is frequently
combined with the starter switch which activates the starter
motor. The ignition locking system may be bypassed by

15

disconnecting the wiring to the switch and manipulating it


directly; this is known as hotwiring.
Ignition and starter systems
The ignition system is used to ignite the fuel-air mixture in the
engine. The starter system is the ignition system, plus the
battery, and starter switch, starter solenoid and electric starter
motor.
2.2 Principle of operation.
The code lock is four digit codes that are entered via the keypad
interfaced to the microcontroller. The user enters the code via the
keypad which consists of digit 0 to 9 as well as * and #. The
microcontroller

(Atmel89s52)

accepts

the

entered

code

and

comparator compares it with the registered code. When the code


is found to be correct, the microcontroller outputs a TTL logic
signal that is used to clock a timer stage. The timer stage is
implemented by using a timer/ oscillator IC (NE555) which outputs
a clock that toggles the D-flip flop. The flip-flop changes states on
every clock it receives and with this the security system is either
enabled or disabled.
16

It provides security system to the vehicle and developed the


accessories for the complete security.

CHAPTER THREE
DESIGN METHODOLOGY

In this paper, a digital code lock system was designed as a


security

measure

in

an

automobile.

It

can

however,

be

implemented for locking electronic devices such as Television set,


computer system and other electrical appliances. The system
17

consists of a hardware module and an application program for


microcontroller unit.
2 Conceptual review
The project consists of report consist of six blocks, which
describes the functional parts of the system. In this section, I
will like to make a conceptual design of the system to help in
the detail design of the hardware system. The conceptual
design gives an overview on the functions of the major block,
how they are integrated and the data flow arrangement.
3 Project specification
In the design and construction of this project, as we aimed from
initial, this is to archive an electronics system which is use to
on and off the ignition system

of a car when the password

word is entered correctly.


Due to the design requirement, to archive this design
electronically, we must input every required components
required for this operation to take control, like the resistors,
capacitors and transistors controlling the switching when there
is an input. All this contribute to the configuration of this design
which makes it specific in design and operation.
4 Design pattern
18

This includes the stages passed for the design and construction
of this project.
1

Information Gathering
The link which enhanced my knowledge to the design and
construction of this project was as a result my curiosity,
some which was gotten form the internet research I did,
some from the school environment, form the already existing
product which was the main source of my knowledge on how
to go about the project then others was from my teacher and
supervisor etc. all this information I gathered for the design
and construction of this project.

3.2 Design pattern


In the designation of this project, we employed different
design pattern to run a test of this design to checkout for its
perfection when fully designed. From the origin of the
design, from the list of the circuit symbol, the way they
operate help me to have a better design of this project were
employed different strategies to run the test operation for
each component for clarifications and better understanding
of them.

19

3.3 Design procedure


Before the design we first of all have our design designed
using

some

simulation

software

like

the

professional

schematic designer, eagle, livewire and proteuslite which


they all gave use the same out analysis of the circuit. Them
I made my circuit diagram (complete schematic of my
design) and debugged the complete design which gave me
a full highlight and hint of the physical operation of the
design.
3.4 Design processes
The procedures that lead to the complete designs of this
project followed gradual processes first:
3.4.1
Choice of component
The choice of component depends on the design circuit
requirement, were the components to be used depends on
3.4.2

circuit connections and operation requirement.


Component layout
Component layout is the layout for each component
according to the location of the component symbol. This
helps to allocate components to fit the operation of the

3.4.3

circuit which is dependent on the circuit diagram.


Component mounting
Component mounting or placing is the art or process of
placing the components in the required fittings to enable
20

lead soldering of the components to the circuit printed or


Vero boards before inter connecting the components
depending on the circuit connections.
3.4.4

Soldering and clearing


Soldering of the components is very essential to electronic
circuit design as it helps to hard hold the component leads
from

falling

off

from

the

circuit

which

can

cause

permanent damage to the component circuitry.


Clearing always cause before comes after soldering, as it
is the process of removing tiny segmented leads which
could cause bridges to the circuit network leading to burnt
and fire outbreak from the circuit.
3.4.5

Running cross check


Running check after any circuit design is required as it
gives no room for errors after design. This also helps to
correct the network errors and enhance operation as
required after design.

3.4.6
Project testing
Project testing is the art of placing the design in a running
mode for test and operation analysis, this helps to show the
designer that how accurate his/her work is and encourage

21

upgrading the present design when dealing with that type of


design.
3.5 Packaging

22

Structure view for prototype design

Packaging is the art of covering the inner structure of design


using some natural inspirational art and copies of an already
existing design in other to convince the viewer for recommended
comment. Packaging involves the covering of the inner nature of
a design which only through its look sends a message to anybody
who gaze at it what it really is. The appearance of any design one
made is a thing to be consider important as it is the only way
which a product sells itself without human recommendations, in
this project packaging is one of the vital part of this design
because the design which is considered here is a prototype of a
microcontroller base code lock ignition system

23

Chapter four
System design and implementation
4.1 System design
The construction of this work is base of the designed hardware
and software programs which from this report listed the steps
from the starting to the finishing of this project.
4.2 Component analysis
Design analysis of this project base on the construction done to
archive this design
4.3. Component description
This are the description of the design component that was use to
archive this network and it operation
4.3.1 Power supply unit
This circuit makes use of a DC powered battery of 9volts power
rating with a current of 25mA. The source battery is the main
24

supply power for the circuit. When this circuit is powered an


integrated circuit component (IC) regulates the power supply from
9v to 5v which the microcontroller makes use of. Below is the
block diagram of the power unit

9v DC Supply

FILTER
CAPACITOR
16v
1000uF

Regulator IC
LM7805

Fig 4.1 Block diagram of power supply unit

4.3.2 Regulator
Voltage Regulators
A Voltage Regulator (also called a "regulator") has only three
legs and appears to be a comparatively simple device but it is
actually a very complex integrated circuit. A regulator converts
varying input voltage and produces a constant "regulated"
output voltage. Voltage regulators are available in a variety of
outputs, typically 5 volts, 9 volts and 12 volts. The last two digits
in the name indicate the output voltage in the table below.
25

4.2 Voltage Regulators output Voltages


Name

Voltage

LM7805

+ 5 volts

LM7809

+ 9 volts

LM7812

+ 12 volts

LM7905

- 5 volts

LM7909

- 9 volts

LM7912

- 12 volts

26

4.3 LM7805 Integrated Circuit Internal Schematic

4.4 Diagram of 7805

4.3.4Capacitors

These are electronic devices that are capable of storing


charges or providing filtrations in circuits. Capacitors prevent the
flow of dc voltages and allow the flow of ac voltages through
27

them. They are mostly employed in electronic circuits to filter off


varying voltage signals.
Capacitors are of different types, namely;
Polarized capacitors.
Non-polarized capacitors.
Variable capacitors
Polarizes capacitor
These types of capacitor do have both positive and negative
terminals. The negative terminal is made shorter than the positive
terminal for easy identification. The terminals of this type of
capacitor must be connected accordingly for it to function
properly. They are mainly used to store charges in circuits and in
some occasions, they are used in providing delays and preventing
the flow of dc voltages. The values of this type of capacitor are
written on their body, both capacitance and voltage rating.

28

Circuit symbol

schematic diagram

Fig: 4.5 circuit and schematic diagram of polarized


capacitor
Non-polarize capacitor
This type of capacitor does not have positive and negative
terminal, they can be connected by any means necessary. They
are mostly used in filtering noise from circuits. The values of this
type of capacitor are printed on their body with no voltage rating.

29

Circuit symbol
schematic diagram

Fig: 4.6 circuit and schematic diagram of non-polarized


capacitor

VARIABLE CAPACITORS:
This type of capacitor has varying value capabilities. It has a
maximum and minimum range of values within which it can be
adjusted. It is mostly used as tuning circuits.

Circuit symbol

schematic diagram
30

Fig: 4.7 circuit and schematic diagram of variable


capacitor

4.3.5 Resistors
Resistance is the property of a component which restricts the
flow of electric current. Energy is used up as the voltage across
the component drives the current through it and this energy
appears as heat in the component.
Resistance is measured in ohms; the symbol for ohm is an
omega .
1

is quite small for electronics so resistances are often given in

and

1 k = 1000

M .

1 M = 1000000 .

Resistors used in electronics can have resistances as low as 0.1


or as high as 10 M .

Resistors connected in Series

31

Resistor connected in series

When

resistors

are

connected

in

series

their

combined

resistance is equal to the individual resistances added together.


For example if resistors R1 and R2 are connected in series their
combined resistance, R, is given by:

Combined resistance in series: R = R1 + R2


Combined

resistance

of

two resistors in parallel:


This

can

be

extended

R=

for

R1 R2
R1 + R2
more

resistors:

R = R1 + R2 + R3 + R4 + ...
Note that the combined resistance in series will always be
greater than any of

the

resistances.

Fig 4.8 Resistors connected in Parallel


32

individual

Resistors connected in parallel

When resistors are connected in parallel their combined


resistance is less than any of the individual resistances. There is
a special equation for the combined resistance of two resistors
R1 and R2:

For more than two resistors connected in parallel a more difficult


equation must be used. This adds up the reciprocal ("one over")
of each resistance to give the reciprocal of the combined
resistance, R:
1/R=1/R1 + 1/R2 + 1/R3
The simpler equation for two resistors in parallel is much easier
to use!
Note that the combined resistance in parallel will always be less
than any of the individual resistances.

How to read Resistor Colour Codes


33

Table 4.1 Resistor color code


Bla

Bro

Re

Oran

Yello

Gre

Blu

Viol

Gra

Whit

ck

wn

ge

en

et

The mnemonic
Bad Boys Ravish Only Young Girls But Violet Gives Willingly
Black is also easy to remember as zero because of the
nothingness common to both.

Fig4.9 Resistor color code representation

First find the tolerance band, it will typically be gold ( 5%) and
sometimes silver (10%).
34

Starting from the other end, identify the first band - write down
the number associated with that color; in this case Blue is 6.
Now 'read' the next color, here it is red so write down a '2' next
to the six. (You should have '62' so far.) Now read the third or
'multiplier' band and write down that number of zeros.
In this example it is two so we get '6200' or '6,200'. If the
'multiplier' band is Black (for zero) don't write any zeros down. If
the 'multiplier' band is Gold move the decimal point one to the
left. If the 'multiplier' band is Silver move the decimal point two
places to the left. If the resistor has one more band past the
tolerance band it is a quality band.

Read the number as the '% Failure rate per 1000 hour' This is
rated assuming full wattage being applied to the resistors. (To
get better failure rates, resistors are typically specified to have
twice the needed wattage dissipation that the circuit produces)
1% resistors have three bands to read digits to the left of the
multiplier. They have a different temperature coefficient in order
to provide the 1% tolerance.
At 1% most error is in the temperature coefficient - i.e. 20ppm.

4.3.6 Display unit

35

The display unit consist of seven segment display(thirteen in


number) which are used to indicate the entrance door, the exit
door, as well as the count of the visitors that entered the building.
All the anodes of the seven segment LEDs are internally
connected together and brought out to Vcc, which is connected to
the emitter of the switching transistor (NPN C 945), and its
collector is connected to the Vcc, and its base is then connected
to our terminal of 4.7K resistor which in turn is connected from
the microcontroller. So remaining terminal of the 2K resistor is
connected to the VCC.
Light emitting diode(LED) characteristics
As the name indicates, it iss a forward-biased P-Njunction which
emits visible light when energised. The colour of the emitted light
depends on the type of material used as given below
GaAs- Infrared radiation (invisible)
GaP- Red or green light
GaAsP- Red or yellow (amber) light

36

LEDs that emits blue light are also available but red is the most
common. LEDs emit no light when reverse biased.
LEDs are manufactured with domed lensses in order to lesssen
the reabssorption problem ; they are always encased in order to
protect their delicate wires. Being made of semiconductor
material, it is rugged and has a life of more than 10,000 hours.
Since LEDs operate at voltage levels from 1.5v to 3.3v, they are
highly compatible with solid state circuitry [2].

LED Seven segment display


This type of display comes in a variety of colours, sizes and
packaging styles.

While red is still the most favored colour,

green, yellow and orange LED readouts are also available. The
readouts come packaged in standard DIP configurations with clear
or modified diffused lens the latter, for Full-flood visibility.
Its mode of fabrication is based in either a common-cathode or
common-anode arrangement. But common anode arrangement
was used in this project for easier configuration.

37

The seven-

segment display gets its name from the fact seven illuminated
segments are used to configure the digits 0-9 (and a few lower
and upper case letters).

Its arrangement is in the figure of

number eight. Its read out and list of segments required for it to
illuminate is given below.
In common cathode, all the cathode are internally tied together
and brought out to circuit ground through an external current
limiting, or pull-down resistor.

A high voltage to an individual

anode turns the LED segment ON.


Also, in common anode arrangement all anodes are internally
connected and brought out to + Vcc through an external current
limiting, or pull-up resistor.
turns it on [3].

A low voltage to any LED cathode

As read out, LED display offers two distinct

advantages, which are as follows:


Allows digital designers maximum flexibility due to their sizes and
shapes.
They are visible in subdued light.

38

But operation of LED in bright light (out door displays) makes the
display to be washed off by direct sunlight (invisible).

The

diagram of the seven segment display is shown below.

SEVEN

SEGMENT

DIFFERENT COLOURS OF LED


LAYOUT

39

DISPLAY

4.10 Internal Circuitry Of The Two Types Seven Segment


Display

4.3.6 Microcontrollers
The AT89s52 is a low power, high performance cmos 8-bit
microcomputer
erasable

read

with
only

8Kbytes
memory

of

flash

programmable

(EEPROM).

The

device

and
is

manufactured using Atmel`s high density nonvolatile memory


technology and is compatible with the industry standard MCS-51
instruction set and pin out. The on-chip flash allows the program
memory to be reprogrammed in system or by a conventional
40

nonvolatile memory programmer. By combining a versatile 8-bit


CPU with flash on a monolithic chip, the Atmel AT89s52 is a
powerful microcomputer, which provides a highly flexible and
cost effective solution to many embedded control application.
The AT89s52 is designed with static logic for operation down to
zero frequency and support two software selectable power
saving modes. The idle mode stops the CPU while allowing the
RAM, timer/counters, serial port and interrupt system to continue
functioning. The power down mode saves the RAM contents but
freezes the oscillator disabling all other chip functions until the
next hardware reset

41

Fig.
4.11

Pin

configuration

of

AT89S51

Features of AT89S52

Programmable serial channel

Compatible with MCS-51TM product

8Kbytes of in-system Reprogrammable flash memory Endurance: 1,000 write/Erase cycles

Fully static operation:0Hz to 12MHz

Three-level program memory lock

256x 32-bit external RAM

32 programmable I/O lines

Two 16-bit timer/counters

Six interrupt sources


42

Low-power idle and power-down modes.

Fig. 4.12 Block diagram of AT89s52 internal circuitry

43

Pin description
Vcc
Supply voltage.
GND
Ground.
Port 0
Port 0 is an 8-bit open-drain bi-directional I/O port. As an output
port, each pin can sink eight TTL inputs. When 1s are written to
port 0 pins, the pins can be used as high impedance inputs. Port
0 may also be configured to be the multiplexed low order
Address/data bus during accesses to external program and data
memory. In this mode P0 has internal pull-ups. Port 0 also
receives the code bytes during Flash programming, and outputs
the code bytes during program verification. External pull-ups are
required during program verification.

44

Port 1
Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The
Port 1 output buffers can sink/source four TTL inputs. When 1s
are written to Port 1 pins they are pulled high by the internal
pull-ups and can be used as inputs. As inputs, Port 1 pins that
are externally being pulled low will source current (IIL) because
of the internal pull-ups. Port 1 also receives the low-order
address bytes during Flash programming and verification.

Port 2
Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. The
Port 2 output buffers can sink/source four TTL inputs. When 1s
are written to Port 2 pins they are pulled high by the internal
pull-ups and can be used as inputs. As inputs, Port 2 pins that
are externally being pulled low will source current (IIL) because
of the internal pull-ups. Port 2 emits the high-order address byte
during fetches from external program memory and during
accesses to external data memory that uses 16-bit addresses
(MOVX @ DPTR). In this application, it uses strong internal pullups when emitting 1s. During accesses to external data memory
that uses 8-bit addresses (MOVX @ RI), Port 2 emits the contents
of the P2 Special Function Register.
Port 2 also receives the high-order address bits and some control
signals during Flash programming and verification.
45

Port 3
Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. The
Port 3 output buffers can sink/source four TTL inputs. When 1s
are written to Port 3 pins they are pulled high by the internal
pull-ups and can be used as inputs. As inputs,
Port 3 pins that are externally being pulled low will source
current (IIL) because of the pull-ups. Port 3 also serves the
functions of various special features of the AT89S51 as listed
below.

Table 4.2 Alternate functions of port 3

Port 3 also receives some control signals for Flash programming


and verification.

46

RST
Reset input. A high on this pin for two machine cycles while the
oscillator is running resets the device.
ALE/PROG
Address Latch Enable output pulse for latching the low byte of
the address during accesses to external memory. This pin is also
the program pulse input (PROG) during Flash programming. In
normal operation ALE is emitted at a constant rate of 1/6 the
oscillator frequency, and may be used for external timing or
clocking purposes. Note, however, that one ALE pulse is skipped
during each access to external Data Memory. If desired, ALE
operation can be disabled by setting bit 0 of SFR location 8EH.
With the bit set, ALE is active only during a MOVX or MOVC
instruction. Otherwise, the pin is weakly pulled high. Setting the
ALE-disable bit has no effect if the microcontroller is in external
execution mode.
PSEN
Program Store Enable is the read strobe to external program
memory. When the AT89C51 is executing code from external
program memory, PSEN is activated twice each machine cycle,
except that two PSEN activations are skipped during each access
to external data memory.
EA/VPP

47

External Access Enable. EA must be strapped to GND in order to


enable the device to fetch code from external program memory
locations starting at 0000H up to FFFFH.
Note, however, that if lock bit 1 is programmed, EA will be
internally latched on reset. EA should be strapped to VCC for
internal program executions. This pin also receives the 12-volt
programming enable voltage (VPP) during Flash programming,
for parts that require 12-volt VPP.
XTAL1
Input to the inverting oscillator amplifier and input to the
internal clock operating circuit.

4.3.8 Alarm unit

This consists of an LED, which connects from the P2.7 of the


micro controller, which in turn connects to 4.7K resistor, which
finally connects to the VCC. The LED indicates on the alarm is
set to slow.
P2.6 of the micro controller connects to the resistor (2K),
through the base of the transistor (NPN C, 945) and the collector
to the ground, while the emitter terminal is connected to the
48

negative terminal of the alarm buzzer, and the positive to the


Vcc. The remaining terminal of the resistor to Vcc, as shown in
the figure 3.4

1k

MICRO- CONTROLLER AT89C51

P2.7

28

vcc

VCC
VCC
Buzzer
4.7k
2k

P2.6 27

C945 or NPN Transistor

GND

4.13 Transistors
Transistors
Transistors can be regarded as a type of switch, as can many
electronic components. They are used in a variety of circuits and
you will find that it is rare that a circuit built in a school
Technology Department does not contain at least one transistor.
49

They are central to electronics and there are two main types;
NPN and PNP.
Most circuits (e.g. this project design) tend to use NPN. There are
hundreds of transistors that work at different voltages but all of
them fall into these two categories.
Types of Transistor

Figure 4.15: Transistor circuit symbols

There are two types of standard transistors, NPN and PNP, with
different circuit symbols. The letters refer to the layers of
semiconductor material used to make the transistor. Most
transistors used today are NPN because this is the easiest type
to make from silicon. This page is mostly about NPN transistors.
The leads are labeled base (B), collector (C) and emitter (E).
These terms refer to the internal operation of a transistor but
they are not much help in understanding how a transistor is
used.

50

A Darlington pair is two transistors connected together to give a


very high current gain.
In addition to standard (bipolar junction) transistors, there are
field-effect transistors that are usually referred to as FETs. They
have different circuit symbols and properties and they are not
covered by this page.

Transistor currents
The diagram shows the two current paths through a transistor.
The small base current controls the larger collector current.
When the switch is closed, small current flows into the base (B)
of the transistor. It is just enough to make LED B glow dimly. The
transistor amplifies this small current to allow a larger current to
flow through from its collector (C) to its emitter (E). This collector
current is large enough to make LED C light brightly.

51

Figure 4.16: Current path of a Transistor


When the switch is open no base current flows, so the transistor
switches off the collector current. Both LEDs are off. A transistor
amplifies current and can be used as a switch.
This arrangement where the emitter (E) is in the controlling
circuit (base current) and in the controlled circuit (collector
current) is called common emitter mode. It is the most widely
used arrangement for transistors.
Functional model of an NPN transistor.

Fig 4.17 Model of NPN Transistor

52

The base-emitter junction behaves like a diode. A base current


IB flows only when the voltage VBE across the base-emitter
junction is 0.7V or more. The small base current I B controls the
large collector current IC. Ic = hFE IB

(unless the transistor is

full on and saturated) hFE is the current gain (strictly the DC


current gain), a typical value for hFE is 100 (it has no units
because it is a ratio) The base current IB controls the collectoremitter resistance RCE:
IB = 0 RCE = infinity transistor off
IB small RCE reduced transistor partly on
IB increased RCE = 0 transistor full on ('saturated')
Additional notes:
A resistor is often needed in series with the base connection to
limit the base current IB and prevent the transistor being
damaged.

Transistors have a maximum collector current Ic

rating. The current gain hFE can vary widely, even for transistors
of the same type!
A transistor that is full on (with RCE = 0) is said to be 'saturated'.
When a transistor is saturated the collector-emitter voltage V CE is
reduced to almost 0V.

When a transistor is saturated the

collector current Ic is determined by the supply voltage and the


external resistance in the collector circuit, not by the transistor's
current gain. As a result the ratio Ic/I B for a saturated transistor is

53

less than the current gain h FE. The emitter current IE = Ic + IB, but
Ic is much larger than IB, so roughly IE = Ic.

4.4 Block diagram of the project

LED indicators
Power supply unit

keypad

Microcontroller unit
Relay lamp switching unit
Fig 4.18 block diagram of design

54

4.5 Circuit diagram


U2

+12V

+5v

+5V

+5V

+12v

7805
VI

VO

+5V

GND

R3

R4

R5

220R

220R

220R

C1
100u

C2

D2

D3

LED-RED

LED-YELLOW
LED-GREEN

D1
RL1

U1
10p

C3

X1

19

CRYSTAL
18
10p

9
0

clear

29
30
31

1
2
3
4
5
6
7
8

3
4

enter

XTAL1

P0.0/AD0
P0.1/AD1
P0.2/AD2
P0.3/AD3
P0.4/AD4
P0.5/AD5
P0.6/AD6
P0.7/AD7

XTAL2

RST

P2.0/A8
P2.1/A9
P2.2/A10
P2.3/A11
P2.4/A12
P2.5/A13
P2.6/A14
P2.7/A15

PSEN
ALE
EA

P1.0/T2
P1.1/T2EX
P1.2
P1.3
P1.4
P1.5
P1.6
P1.7

P3.0/RXD
P3.1/TXD
P3.2/INT0
P3.3/INT1
P3.4/T0
P3.5/T1
P3.6/WR
P3.7/RD

39
38
37
36
35
34
33
32
21
22
23
24
25
26
27
28

12V

R2
1k

R1

Q1

L1

2N3904

12V

1k

Q2
2N3904

10
11
12
13
14
15
16
17

AT89C52

R6
10k

AmakaProjectdesign

MicrocontrollerB aseddigitallocksystem
55

Fig 4.19 circuit diagram

4.6 SOFTWARE DESIGN


Software, are computer programs; instructions that cause
the hardware, the machines to do work. Software as a whole can
be divided into a number of categories based on the type of
work done. The two primary software categories are operating
systems (system software), which control the workings of the
computer,

and application

software,

which

addresses

the

multitude of tasks for which people use computers.


Application software performs word processing, database
management, and the like. Two additional categories that are
neither system nor application software, nor language software,
which provide programmers with the tools they need to write
programs. In addition to these task-based categories, several
types of software are described based on their software design.

4.7 SOFTWARE DEVELOPMENT PROCESS


In writing the software for this project a modular approach
was employed.

This made it easier to check for errors and

debug the program. Three major tools were used in the


development process; the C51 compiler was used to translate
from the source code into the object code. The SDCPP was

56

employed to link the program while the PACKIHX did the


conversion from binary to hex.

4.8

CHOICE OF PROGRAMMING LANGUAGE

My implementation programming language for this project is


asm programming language.

Reason being the fact that it

combines the elements of high level languages with the


functionalism

of

assembly

language.

manipulation of bits, bytes and

Asm

allows

the

addresses. Also C codes are

portable which means that it is possible to adapt software


written for one type of computer to another.
Nevertheless, a special feature of Asm is that it allows the
direct manipulation of bits, bytes, words and pointers. This suits
it to system-level programming, where these operations are
common.
4.9 PROGRAM ENTRY AND EDITING
After the design of the software, a text editor is employed to
enter the source code into the disk file. As noted earlier, the text
editor also functions to correct error in the program. The text
editor used is MIDc51 text editor.
4.9.1 COMPILING AND LINKING

57

The MIDc51 compiler comes with a lot of modules. It does the


task of compilation, linking, binary to hex conversion once the
compilation command is issued.
Once the compilation command is issued, an object file, a listing
file, a hex and a binary file.

4.9.2

PRELIMINARIES OF THE DESIGN

In every design, especially an electronic design, there is always


the need to do a preliminary or a prototype work on the project in
view this is to ensure compatibility in the components required
referring to art 1.4 above. However in this project I designed a
prototype of it using a breadboard, in this my aim was just to
make an LED blink using the Micro-controller (AT89s52).

4.9.3 MAKING AN LED BLINK WITH AT89c51 MICROCONTROLLER


Step 1: The first step is to build the circuit. At this point I was
already familiar with the parts used. (2 resistors, 3 capacitors,
1LED). We then put these parts together using breadboard. Vcc
= 5V and Gnd = 0V. The only thing I want to do with this project
is to make the LED blink. By doing this, I will be able to learn the

58

basic process of compiling a program written in C language


program I am going to use.
Step 2: Compiling the Code: type the code on the text editor
(MIDc51 compiler), then save it as ledset.c. Next compile by
typing this in the run program C:\sdcc\bin\sdcc.exe ledtest.c.
This will create a file called ledset.hex
Close the DOS prompt window now.
Step 3: Downloading the code to the Micro controller. I made
sure the parallel cable and the power supply are connected to
the SPI flash programmer.
Start the SPI flash programmer software.
Select device type (89s51)
Press BROWSE.
Find ledtest.hex and click on it (single click).
Press OK to select the file.
press PROGRAM to program the file into the micro controller.
Make sure the power is off for the circuit you have built.
Turn on the power to the circuit. The LED starts blinking, and
then I noticed I have successfully built my prototype micro
controller project.

59

4.10 SYSTEM CONTROL PROGRAM STEPS


The operation of the microcontroller based alarm system is
summarized as follows:
When system is powered; the microcontroller monitors the
sensors to know when an intruder interrupts the sensors and
then displays the position of the intruder and as well, switches
on the alarm.
4.11 Program source code
#include "regx51.h"
#define bt1 P1_0
#define bt2 P1_1
#define bt3 P1_2
#define bt4 P1_3
#define bt5 P1_4
#define bt6 P1_5
#define bt7 P1_6
#define bt8 P1_7
#define bt9 P3_0
60

#define bt0 P3_1


#define clear P3_2
#define enter P3_3
#define Power_led P0_0
#define erro_led P0_1
#define access_led P0_2
#define relay P2_0

delay(unsigned int w){


int x,y,z;
for (x = 0x00; x< w; x++){
for (y = 0x00; y< w; y++){
for (z = 0x00; z< w; z++){
;}}}
return 0;

61

initialize(){
relay = 0;
Power_led = 0;
erro_led =1;
Power_led = 1;
erro_led =1;
access_led = 0;
delay(25);
return 0;
}

unsigned int m1A,m1,m2,m3,m4 = 0xff;

62

shift(){
m4 = m3 ;
m3 = m2 ;
m2 = m1 ;
m1= m1A ;
}

clear_mem0(){
m1A,m1,m2,m3,m4 = 0xff;
return 0;
}

clock_error(){
erro_led = 0;
delay(25);

63

erro_led =1;
delay(25) ;
return 0;
}

clock_access(){
access_led = 0;
delay(25);
access_led =1;
delay(25) ;
return 0;
}

int main(){
initialize();

64

initialize();
initialize();
while (1){
begin:{ Power_led = 0;
access_led = 1;
while (1){
if (bt0 == 0){loop0:if(bt0==0){goto loop0;}else{ m1A =
0;shift(); Power_led = 1; delay(25);goto begin ;}}
if (bt1 == 0){loop1:if(bt1==0){goto loop1;}else{ m1A =
1;shift(); Power_led = 1; delay(25);goto begin ;}}
if (bt2 == 0){loop2:if(bt2==0){goto loop2;}else{ m1A =
2;shift(); Power_led = 1; delay(25);goto begin ;}}
if (bt3 == 0){loop3:if(bt3==0){goto loop3;}else{ m1A =
3;shift(); Power_led = 1; delay(25);goto begin ;}}
if (bt4 == 0){loop4:if(bt4==0){goto loop4;}else{ m1A =
4;shift(); Power_led = 1; delay(25);goto begin ;}}

65

if (bt5 == 0){loop5:if(bt5==0){goto loop5;}else{ m1A =


5;shift(); Power_led = 1; delay(25);goto begin ;}}
if (bt6 == 0){loop6:if(bt6==0){goto loop6;}else{ m1A =
6;shift(); Power_led = 1; delay(25);goto begin ;}}
if (bt7 == 0){loop7:if(bt7==0){goto loop7;}else{ m1A =
7;shift(); Power_led = 1; delay(25);goto begin ;}}
if (bt8 == 0){loop8:if(bt8==0){goto loop8;}else{ m1A =
8;shift(); Power_led = 1; delay(25);goto begin ;}}
if (bt9 == 0){loop9:if(bt9==0){goto loop9;}else{ m1A =
9;shift(); Power_led = 1; delay(25);goto begin ;}}
if (clear == 0){ access_led = 0 ; clear (); delay(25); goto begin ;}
if (enter == 0){ ; delay(25);goto memo;}
}}
// comparing memorys
while (1){
if (m1 == 3 & m2 == 3 & m3 == 6 & m4 == 3){
clock_access() ;
66

if (relay == 0){relay = 1; m1A = m1 = m2 = m3 = m4 =


0xff;goto begin ;}
else { relay = 0 ; m1A=m1=m2=m3=m4 = 0xff;goto begin ;}
}
else {clock_error() ; delay(25); goto begin;}
}}}
}

67

CHAPTER FIVE
BILL OF ENGINEERING MEASUREMENT AND EVALUTION.

5.1: System Testing and Integration


After the design and implementation phase, the system built has
to be tested for Durability, Efficiency, and Effectiveness and also
ascertain if there is need to modify this design. The system was
first assembled using a breadboard. All components were
properly inserted into the breadboard from whence some tests
were carried out at various stages.
To ensure proper functioning of components expected data, the
components were tested using a digital millimeter (DMM).
Resistors were tested to ensure that they were within the
68

tolerance value. Faulty resistors were discarded .The 78LS05


voltage regulator was also tested, the resulting output was 5.02v
which is just a deviation of 0.20v from the expected result of
5.00v.The LEDs were tested to ensure that they were all working
properly.

5.2 Test plan and Test data


This chapter entails an overall system testing of the integrated
design of the voltage measurement device. The testing and
integration is done to ensure that the design is functioning
properly as expected thereby enabling one or even intended
users for which the project was targeted for, appreciate its
implementation and equally approaches used in the design and
integration of the various modules of the project.
However, this involves checks made to ensure that all the
various units and subsystems function adequately. Also there
has to be a good interface existing between the input/output
unit subsystems.

69

When the totality of the modules was integrated together, the


system was created and all modules and sections responded to
as specified in the design through the power supply delivering
into the system designed.

5.2.1

Components Test

Similar components like resistors were packed together. Other


components includes capacitor, preset switches, transformer,
diodes (rectifier) LED, transistor, voltage regulator etc
Reference was made to resistor color code data sheet to
ascertain the expected values of resistors used. Each resistor
was tested and the value read and recorded. Also for transistor
test the DMM was switched to the diode range with the symbol
The collector, base and emitter junctions were tested in the
following order. The collector, emitter and base pins were gotten
from the data analysis on power transistor.

Table 4.3 Test for Transistor

70

Black probe

Red probe

1st test on pins

Collector

Base

2nd test on pins

Emitter

Base

5.2.2 System Test


The system was powered and operated upon using several
possibilities. They include depressing more than one button at
the same time and noting the output responses of the system
hardware. The system allows only one input at a time and gives
the voice output alongside flashing the corresponding LED.

5.2.3 Other Tests


Light emitting diode (LED) emits rays when forward biased .For
capacitors the DMM was switched to the 22uf range and the
capacitors were inserted into the slot provided for it by the
meter. Finally the sensors where blocked to trigger the alarm,
when the alarm was activated the alarm indicator lighted to
show that the alarm system is armed.

3.3 EXPERIMENTED RESULT VS ACTUAL RESULT


71

Table 4.4 Experimented Value/ Actual value


COMPONENT

EXPERIMENTE

ACTUA

UNI

TOLERANC

D VALUE

VALUE
Resistor

Capacitor

Transistor

10000

10000

2000

2000

220

218

10000

9980

10

10.20

10

10.15

30

29.82

Rbe

520

550

Rbc

510

548

13.2

Transformer

12Vac

voltage

240Vac input

@
72

Regulator

5.00

210
5.02

5%

4.5 Performance Evaluation


From the table above, shows the range between the expected
value and the actual value can be tolerated. As a result of this
the drift in expected value has no critical effect on the system
design since the result current range was not also exceeded,
also the operational voltage range was not exceeded.

5.5 COST ANALYSIS


In the course of the implementation of this project the under listed cost was
incurred for the respective constituent components at make the project as a single
entity or that aided in testing of the work.

73

CHAPTER SIX
SUMMARY
6.1 Summary and Conclusion
This section of this project report forms the concluding part of
the write up and takes a look at some of the problems
encountered during the progressive job on the system and also
brings

in

suggestions

for

further

improvement

and/or

enhancement for the system design.

6.2 Summary of Achievement


The design and development of this project has really been
challenging, as I have been faced with choices far beyond what I
expected. But in the long run the result paid off.
After the complete design of the system, the deviation between
the expected result and the actual result was very close. The
performance and efficiency was beyond expectation and from
every ramification, the design of the project was a success.

6.3 Problems Encountered and Solution

74

During the course of the design of this system, there were series
of problems which came in the way of achieving the design goals
of this project, most of them where over come via share
troubleshooting, in some cases some parts require redesigning
and the software debugging also created a bit of a problem.
One major setback of this project is the availability of
components required to build the hardware of the system. In
most cases I had to look through electrical catalogs to obtain
replacements of some of the components which are not
available in the market.
After developing the software for the microcontroller, it was very
difficult to find a firm/individual to help program the chip
(burning the embedded software on to the chip). This posed
serious problem as it brought about delay in the design time and
it was also costly, this also affected the overall cost of the
system.
The final packaging of the design was also another trouble, as
this actually caused problems on the circuit board. Such
problems include partial contact within the circuit board,
between components and also with the wiring. This was actually
one

of

the

most

challenging

aspects

of

the

circuit

implementation phase. Due to this fact, there was a lot of


soldering and de-soldering to ensure that the circuit was well
implemented.

75

6.4 Suggestions for further improvement


It will be more appreciated if the system is designed to have
integrated voice output playback with video capture.

6.5: Conclusion
Going through the planning, flow process, design and software
implementation the system had really been a tough one; but on
the whole it has been a chance to show case a little bit of
craftsmanship.

76

REFERENCES

1. Alan, C. (2000). The Principles of Computer hardware, Third


edition, U.S.A., Oxford University Press.
2. Khanna, V.K. (2003). Concise handbook of electronic and
electrical engineering, S. Chand and company Ltd, Ram Nagar,
New Delhi.
3. Martin, P.B. (2009). Interfacing PIC microcontrollers, 2nd
edition, Microchip technology, Houston College, UK.
4. Martin, P.B. (2009). Programming 8-bit PIC microcontroller,
MikroElectronika, Hongkong.
5. Mehta, T.K. (1994). Principle of electronics, 5th edition,
macmillian India Ltd, India.
77

6. Microchip Technology, Inc. 2009. PIC16F84A data


Sheet,. (Retrieved August 23, 2012).
http://ww1.microchip.com/downloads/en/devicedoc/ 35007b.pdf
7. Ronald J. T. and Neal S. W. (1998). Digital Systems:

Principles and Applications, seventh edition, Prentice Hall, U.S.A.


8. Sickle T.V (2001). Programming Microcontrollers in Assembly
Language, 2nd edition, LLH Technology Publishing, Valley center,
California.
10. Theraja, B.L. and Theraja A.K. (1996). A Textbook of electrical
Technology, 23rd edition, S. Chand and company Ltd, London.
11. www.bookaid.org
12. www.hellodip.asm

78

Das könnte Ihnen auch gefallen