You are on page 1of 51

`

1








CHAPTER 01
INTRODUCTION








`
2

1.1 INTRODUCTION

Vehicular traffic at intersecting streets is typically controlled by traffic control
lights. The function of traffic lights requires sophisticated control and
coordination to ensure that traffic moves as smoothly and safely as possible.
In recent days electro-mechanical controllers are replaced by electronic circuits.
The accuracy & fault tolerant drive towards electronic circuits. This project is
developed to meet the requirements of solid state traffic light controller by
adopting microcontroller as the main controlling element, and leds as the
indication of light. A micro controller is interfaced to leds provide for centralized
control of the traffic signals. Microcontroller is programmed in such a way to
adjust their timing and phasing to meet changing traffic conditions. The circuit
besides being reliable and compact is also cost effective

Traffic signals are used to control the flow of vehicles.In the recent years, the need
of transportation has gain immense importance for logistics as well as for common
human. This has given rise to the number of vehicles on the road. Due to this
reason, traffic jams and road accidents are a common sight in any busy city. Traffic
Signals provide an easy, cheap, automatic and justified solution to the road points
where the vehicles may turn to other directions e.g. roundabouts, culverts, busy
walk throughs etc.

BASIC IDEA The project we have chosen is an 8-lane traffic controller. The basic
idea behind the design is to avoid the collision of vehicles by providing appropriate
signals to different directions for a limited time slot, after which the next waiting
drivers will be given same treatment. In This way a cycle will be established which
will control the traffic.

CONTROL SIGNALS The control signals are 3-lights. Top light is Red(Stop),
Middle light is Yellow(Wait) Bottom light is Green(Go). STATES OF
TRAFFIC FLOW There are 8-lanes and at most two ways can be safely open. In
this way a minimum of 4-states are possible for which different vehicles will pass
through






`
3

1.2 OBJECTIVE OF THIS PROJECT:

Traffic congestion is a severe problem in many modern cities around the world.
Traffic congestion has been causing many critical problems and challenges in the
major and most populated cities. To travel to different places within the city is
becoming more difficult for the travelers in traffic. Due to these congestion
problems, people lose time, miss opportunities, and get frustrated. Traffic
congestion directly impacts the companies. Due to traffic congestions there is a
loss in productivity from workers, trade opportunities are lost, delivery gets
delayed, and thereby the costs goes on increasing.
To solve these congestion problems, we have to build new facilities &
infrastructure but at the same time make it smart. The only disadvantage of making
new roads on facilities is that it makes the surroundings more congested. So for
that reason we need to change the system rather than making new infrastructure
twice. Therefore many countries are working to manage their existing
transportation systems to improve mobility, safety and traffic flows in order to
reduce the demand of vehicle use.






1.3 BASIC IDEA OF THE PROJECT:

The project uses simple Electronic components such as LED as TRAFFIC LIGHT
indicator and a MICROCONTROLLER for auto change of signal after a pre-
specified time interval.
Microcontroller AT89c51 is the brain of the project which initiates the traffic
signal at a junction. The leds are automatically on and off by making the
corresponding port pin of the micro controller high. A seven segment display also
connected to display the timing of each signal. At a particular instant only one
green light holds and other lights hold at red. During transition from green to red,
the present group yellow led and succeeding group yellow led glows and then
succeeding group led changes to green. This process continues as a cycle.



`
4

1.4 ADVANTAGE AND DISADVANTAGES:

Reduction in normal recurring.
Significantly enhanced operational tools congestion to
Effectively manage traffic incidents.
It improved public transport service.
Reduction in emergency response times and safer travel.
Improve traffic guidance and traffic flow
Reduce fuel consumption
Increase safety They increase the traffic-handling capacity of the intersection
Less cost
Excessive delay may be caused.
These unnecessary delay results in significant fuel waste and higher motorist
costs.
Disobedience of signals




















`
5














CHAPTER 02
COMPONENTS DESCRIPTION














`
6

2.1 POWER SUPPLY:

A power supply is a device that supplies electric power to an electrical load. The
term is most commonly applied to electric power converters that convert one form
of electrical energy to another, though it may also refer to devices that convert
another form of energy (mechanical, chemical, solar) to electrical energy.
A regulated power supply is one that controls the output voltage or current to a
specific value; the controlled value is held nearly constant despite variations in
either load current or the voltage supplied by the power supply's energy source.
Every power supply must obtain the energy it supplies to its load, as well as any
energy it consumes while performing that task, from an energy source. Depending
on its design, a power supply may obtain energy from:
Electrical energy transmission systems. Common examples of this include
power supplies that convert AC line voltage to DC voltage.
Energy storage devices such as batteries and fuel cells.
Electromechanical systems such as generators and alternators.
Solar power.
A power supply may be implemented as a discrete, stand-alone device or as an
integral device that is hardwired to its load. Examples of the latter case include the
low voltage DC power supplies that are part of desktop computers and consumer
electronics devices.
Commonly specified power supply attributes include:
The amount of voltage and current it can supply to its load.
How stable its output voltage or current is under varying line and load
conditions.
How long it can supply energy without refueling or recharging (applies to
power supplies that employ portable energy sources).






`
7

POWER SUPPLY TYPES:

Power supplies for electronic devices can be broadly divided into line-frequency
(or "conventional") and switching power supplies. The line-frequency supply is
usually a relatively simple design, but it becomes increasingly bulky and heavy for
high-current equipment due to the need for large mains-frequency transformers and
heat-sinked electronic regulation circuitry. Conventional line-frequency power
supplies are sometimes called "linear", but that is a misnomer because the
conversion from AC voltage to DC is inherently non-linear when the rectifiers feed
into capacitive reservoirs. Linear voltage regulators produce regulated output
voltage by means of an active voltage divider that consumes energy, thus making
efficiency low. A switched-mode supply of the same rating as a line-frequency
supply will be smaller, is usually more efficient, but would be more complex

Battery:




Alkaline batteries

A battery is a device that converts stored chemical energy to electrical energy.
Batteries are commonly used as energy sources in many household and industrial
applications. There are two types of batteries: primary batteries (disposable
batteries), which are designed to be used once and discarded, and secondary
batteries (rechargeable batteries), which are designed to be recharged and used
multiple times. Batteries come in many sizes, from miniature cells used in hearing
aids and wristwatches to room-size battery banks that serve as backup power
supplies in telephone exchanges and computer data centers.

`
8

DC Power supply:




A home-made linear power supply



An AC powered unregulated power supply usually uses a transformer to convert
the voltage from the wall outlet (mains) to a different, nowadays usually lower,
voltage. If it is used to produce DC, a rectifier is used to convert alternating voltage
to a pulsating direct voltage, followed by a filter, comprising one or
more capacitors, resistors, and sometimes inductors, to filter out (smooth) most of
the pulsation. A small remaining unwanted alternating voltage component at mains
or twice mains power frequency (depending upon whether half- or full-wave
rectification is used)rippleis unavoidably superimposed on the direct output
voltage.
For purposes such as charging batteries the ripple is not a problem, and the
simplest unregulated mains-powered DC power supply circuit consists of a
transformer driving a single diode in series with a resistor.
Before the introduction of solid-state electronics, equipment used valves (vacuum
tubes) which required high voltages; power supplies used step-up transformers,
rectifiers, and filters to generate one or more direct voltages of some hundreds of
volts, and a low alternating voltage for filaments. Only the most advanced
equipment used expensive and bulky regulated power supplies.



`
9

AC Power supply:

An AC power supply typically takes the voltage from a wall outlet (mains supply)
and lowers it to the desired voltage. Some filtering may take place as well.

Linear regulated power supply:

The voltage produced by an unregulated power supply will vary depending on the
load and on variations in the AC supply voltage. For critical electronics
applications, a linear regulator may be used to set the voltage to a precise value,
stabilized against fluctuations in input voltage and load. The regulator also greatly
reduces the ripple and noise in the output direct current. Linear regulators often
provide current limiting, protecting the power supply and attached circuit from
over current.

Adjustable linear power supplies are common laboratory and service shop test
equipment, allowing the output voltage to be adjusted over a range. For example, a
bench power supply used by circuit designers may be adjustable up to 30 volts and
up to 5 amperes output. Some can be driven by an external signal, for example, for
applications requiring a pulsed output.

AC/DC supply:

In the past, mains electricity was supplied as DC in some regions, AC in others.
Transformers cannot be used for DC, but a simple, cheap unregulated power
supply could run directly from either AC or DC mains without using a transformer.
The power supply consisted of a rectifier and a filter capacitor. When operating
from DC, the rectifier was essentially a conductor, having no effect; it was
included to allow operation from AC or DC without modification






`
10

Switched-mode power supply:





A computer's switched mode power supply unit


In a switched-mode power supply (SMPS), the AC mains input is directly rectified
and then filtered to obtain a DC voltage. The resulting DC voltage is then switched
on and off at a high frequency by electronic switching circuitry, thus producing an
AC current that will pass through a high-frequency transformer or inductor.
Switching occurs at a very high frequency (typically 10 kHz 1 MHz), thereby
enabling the use of transformers and filter capacitors that are much smaller, lighter,
and less expensive than those found in linear power supplies operating at mains
frequency. After the inductor or transformer secondary, the high frequency AC is
rectified and filtered to produce the DC output voltage. If the SMPS uses an
adequately insulated high-frequency transformer, the output will be electrically
isolated from the mains; this feature is often essential for safety.
Switched-mode power supplies are usually regulated, and to keep the output
voltage constant, the power supply employs a feedback controller that monitors
current drawn by the load. The switching duty cycle increases as power output
requirements increase.
SMPSs often include safety features such as current limiting or a crowbar circuit to
help protect the device and the user from harm.
[1]
In the event that an abnormal
high-current power draw is detected, the switched-mode supply can assume this is
a direct short and will shut itself down before damage is done. PC power supplies
`
11

often provide a power good signal to the motherboard; the absence of this signal
prevents operation when abnormal supply voltages are present.
SMPSs have an absolute limit on their minimum current output.
[2]
They are only
able to output above a certain power level and cannot function below that point. In
a no-load condition the frequency of the power slicing circuit increases to great
speed, causing the isolated transformer to act as a Tesla coil, causing damage due
to the resulting very high voltage power spikes. Switched-mode supplies with
protection circuits may briefly turn on but then shut down when no load has been
detected. A very small low-power dummy load such as a ceramic power resistor or
10-watt light bulb can be attached to the supply to allow it to run with no primary
load attached.
Power factor has become an issue of concern for computer manufacturers.
Switched mode power supplies have traditionally been a source of harmonics and
have a very poor power factor. The rectifier input stage distorts the wave shape of
current drawn from the supply; this can produce adverse effects on other loads.
The distorted current causes extra heating in the wires and distribution equipment.
Switched mode power supplies in a building can result in poor power quality for
other utility customers. Customers may face higher electric bills for a low power
factor load.
Some switch-mode power supplies use filters or additional switching stages in the
incoming rectifier circuit to improve the waveform of the current taken from the
AC line. This adds to the circuit complexity. Many computer power supplies built
in the last few years now include power factor correction built right into the
switched-mode supply, and may advertise the fact that they offer 1.0 power factor.
High voltage refers to an output on the order of hundreds or thousands of volts.
High-voltage supplies use a linear setup to produce an output voltage in this range.
Additional features available on high-voltage supplies can include the ability to
reverse the output polarity along with the use of circuit breakers and special
connectors intended to minimize arcing and accidental contact with human hands.
Some supplies provide analog inputs that can be used to control the output voltage,
effectively turning them into high-voltage amplifiers albeit with very
limited bandwidth




`
12

2.2 TRANSFORMER:





A transformer is an electrical device that transfers energy between two circuits
through electromagnetic induction. A transformer may be used as a safe and
efficient voltage converter to change the AC voltage at its input to a higher or
lower voltage at its output. Other uses include current conversion, isolation with or
without changing voltage and impedance conversion.
A transformer most commonly consists of two windings of wire that are wound
around a common core to provide tight electromagnetic coupling between the
windings. The core material is often a laminated iron core. The coil that receives
the electrical input energy is referred to as the primary winding; the output coil is
the secondary winding.
An alternating electric current flowing through the primary winding (coil) of a
transformer generates a varying electromagnetic field in its surroundings which
induces a varying magnetic flux in the core of the transformer. The varying
electromagnetic field in the vicinity of the secondary winding induces
an electromotive force in the secondary winding, which appears as a voltage across
the output terminals. If a load is connected across the secondary winding, a current
`
13

flows through the secondary winding drawing power from the primary winding
and its power source.
A transformer cannot operate with direct current. When connected to a DC source,
a transformer typically produces a short output pulse as the input current rises.
The invention of transformers during the late 1800s enabled long distance, cheaper,
and energy efficient transmission, distribution, and utilization of electrical energy.
In the early days of commercial electric power, the main energy source was direct
current (DC), which operates at relatively low-voltage and high-current. According
to Joule's Law, energy losses are directly proportional to the square of the current.
This law revealed that even a tiny decrease in current or rise in voltage can cause a
substantial lowering in energy losses and costs. Thus, the historical pursuit for a
high voltage low current electricity transmission system took shape. Although high
voltage transmission systems offered many benefits, the future fate of high-voltage
alternating current remained unclear for several reasons: high-voltage sources had
a much higher risk of causing severe electrical injuries. Many essential appliances
could only function at low voltage. Regarded as one of the most influential
electrical innovations of all time, the introduction of transformers had successfully
reduced the safety concerns associated with alternating current and had the ability
to lower voltage to the value required by most essential appliances
Transformers perform voltage conversion, isolation protection, and impedance
matching. In terms of voltage conversion, transformers can step up voltage and
step down current from generators to high voltage transmission lines, and step
down voltage/step up current to local distribution circuits or industrial customers.
The step-up transformer is used to increase the secondary voltage relative to the
primary voltage. The step-down transformer is used to decrease the secondary
voltage relative to the primary voltage. Transformers range in size from thumbnail-
sized units used in microphones to those weighing hundreds of tons
interconnecting the power. A broad range of transformer designs are used in
electronic and electric power applications, including miniature, audio, isolation,
high-frequency, power conversion, etc.
Voltage conversion, isolation protection, and impedance matching. In terms of
voltage conversion, transformers can step up voltage and step down current from
generators to high voltage transmission lines, and step down voltage/step up
current to local distribution circuits or industrial customers. The step-up
transformer is used to increase the secondary voltage relative to the primary
voltage. The step-down transformer is used to decrease the secondary voltage
relative to the primary voltage. Transformers range in size from thumbnail-sized
`
14

units used in microphones to those weighing hundreds of tons interconnecting the
power. A broad range of transformer designs are used in electronic and electric
power applications, including miniature, audio, isolation, high-frequency, power
conversion, etc.

Basic principles:

The operation of a transformer is based on two principles of the laws of
electromagnetic induction: An electric current through a conductor, produces
a field surrounding the conductor, and a changing magnetic field in the vicinity of
a conductor induces a voltage across the ends of that conductor.
The magnetic field excited in the primary coil gives rise to self-induction as well as
mutual induction between coils. This self-induction counters the excited field to
such a degree that the resulting current through the primary winding is very small
when the secondary winding is not connected to a load.
The physical principles of the inductive behavior of the transformer are most
readily understood and formalized when making some assumptions to construct a
simple model which is called the ideal transformer. This model differs from real
transformers by assuming that the transformer is perfectly constructed and by
neglecting that electrical or magnetic losses occur in the materials used to construct
the device








`
15

2.3 RECTIFIER:

A rectifier is an electrical device that converts alternating current (AC), which
periodically reverses direction, to direct current (DC), which flows in only one
direction. The process is known as rectification. Physically, rectifiers take a
number of forms, including vacuum tube diodes, mercury-arc valves, copper and
selenium oxide rectifiers, semiconductor, silicon-controlled rectifiers and other
silicon-based semiconductor switches. Historically, even synchronous
electromechanical switches and motors have been used. Early radio receivers,
called crystal radios, used a "cat's whisker" of fine wire pressing on a crystal
of galena (lead sulfide) to serve as a point-contact rectifier or "crystal detector".
Rectifiers have many uses, but are often found serving as components of
DC power supplies and high-voltage direct current power transmission systems.
Rectification may serve in roles other than to generate direct current for use as a
source of power. As noted, detectors of radio signals serve as rectifiers. In gas
heating systems flame rectification is used to detect presence of flame.
Because of the alternating nature of the input AC sine wave, the process of
rectification alone produces a DC current that, though unidirectional, consists of
pulses of current. Many applications of rectifiers, such as power supplies for radio,
television and computer equipment, require a steady constant DC current (as would
be produced by a battery). In these applications the output of the rectifier is
smoothed by an electronic filter to produce a steady current.
A more complex circuitry device that performs the opposite function, converting
DC to AC, is called an inverter.

Before the development of silicon semiconductor rectifiers, vacuum
tube thermionic diodes and copper oxide- or selenium-based metal rectifier stacks
were used. With the introduction of semiconductor electronics, vacuum tube
rectifiers became obsolete, except for some enthusiasts of vacuum tube audio
equipment. For power rectification from very low to very high current,
semiconductor diodes of various types (junction diodes, Schottky diodes, etc.) are
widely used.




`
16

Bridge rectifier


Bridge rectifier


A bridge rectifier can be made using four individual diodes, but it is also available
in special packages containing the four diodes required. It is called a full-wave
rectifier because it uses the entire AC wave (both positive and negative sections).
1.4V is used up in the bridge rectifier because each diode uses 0.7V when
conducting and there are always two diodes conducting, as shown in the diagram
below. Bridge rectifiers are rated by the maximum current they can pass and the
maximum reverse voltage they can withstand (this must be at least three times the
supply RMS voltage so the rectifier can withstand the peak voltages). Please see
the Diodes page for more details, including pictures of bridge rectifiers






Output: full-wave varying DC





`
17

Smoothing:

Smoothing is performed by a large value electrolytic capacitor connected across
the DC supply to act as a reservoir, supplying current to the output when the
varying DC voltage from the rectifier is falling. The diagram shows the
unsmoothed varying DC (dotted line) and the smoothed DC (solid line). The
capacitor charges quickly near the peak of the varying DC, and then discharges as
it supplies current to the output.






Note that smoothing significantly increases the average DC voltage to almost the
peak value (1.4 RMS value). For example 6V RMS AC is rectified to full wave
DC of about 4.6V RMS (1.4V is lost in the bridge rectifier), with smoothing this
increases to almost the peak value giving 1.4 4.6 = 6.4V smooth DC.
Smoothing is not perfect due to the capacitor voltage falling a little as it discharges,
giving a small ripple voltage. For many circuits a ripple which is 10% of the
supply voltage is satisfactory and the equation below gives the required value for
the smoothing capacitor. A larger capacitor will give fewer ripples. The capacitor
value must be doubled when smoothing half-wave DC.







`
18

Regulator:


Voltage regulator ICs are available with fixed (typically 5, 12 and 15V) or variable
output voltages. They are also rated by the maximum current they can pass.
Negative voltage regulators are available, mainly for use in dual supplies. Most
regulators include some automatic protection from excessive current ('overload
protection') and overheating ('thermal protection').
Many of the fixed voltage regulator ICs has 3 leads and look like power transistors,
such as the 7805 +5V 1A regulator shown on the right. They include a hole for
attaching a heat sink if necessary.





For low current power supplies a simple voltage regulator can be made with a
resistor and a zener diode connected in reverse as shown in the diagram. Zener
diodes are rated by their breakdown voltage Vz and maximum power Pz (typically
400mW or 1.3W).
The resistor limits the current (like an LED resistor). The current through the
resistor is constant, so when there is no output current all the current flows through
the zener diode and its power rating Pz must be large enough to withstand this.
Please see the Diodes page for more information about zener diodes.





`
19

2.4 DIODE:

In this discussion the term diode and rectifier will be used interchangeably;
however, the term diode usually implies a small signal device with current
typically in the milliamp range; and a rectifier, a power device, conducting from1
to 1000 amps or even higher. Many diodes or rectifiers are identified as 1NXXXX
A semiconductor diode consists of a PN junction and has two(2) terminals, an
anode(+) and a cathode(-). Current flows from anode to cathode within the diode.
A diode and schematic representation are shown below.

An ideal diode is like a light switch in your home. When the switch is closed, the
circuit is completed; and the light turns on.When the switch is open, there is no
current and the light is off.
This can be shown as:

However, the diode has an additional property; it is unidirectional, i.e.current flows
in only one direction(anode to cathode internally).When a forward voltage is
applied, the diode conducts; and when a reverse voltage is applied, there is no
conduction. A mechanical analogy is a ratchat, which allows motion in one
direction only. An ideal diode characteristic would be:

`
20

However, a typical diode characteristic is more like the following:

Forward Voltage Drop , Vf
Notice that the diode conducts a small current in the forward direction up to a
threshold voltage, 0.3 for germanium and 0.7 for silicon ; after that it conducts as
we might expect. The forward voltage drop, Vf, is specified at a forward current,
If.
Leakage current
In the reverse direction there is a small leakage current up until the reverse
breakdown voltage is reached. This leakage is undesireable, obviously the lower
the better, and is specified at a voltage less the than breakdown; diodes are
intended to operate below their breakdown voltage.
Current Rating
The current rating of a diode is determined primarily by the size of the diode chip,
and both the material and configuration of the package, Average Current is used,
not RMS current. A larger chip and package of high thermal conductivity are both
conducive to a higher current rating.

`
21

2.5 RESISTOR:

A resistor is a passive two-terminal electrical component that implements electrical
resistance as a circuit element. The current through a resistor is in direct proportion
to the voltage across the resistor's terminals. Thus, the ratio of the voltage applied
across a resistor's terminals to the intensity of current through the circuit is called
resistance. This relation is represented by Ohm's law:

where I is the current through the conductor in units of amperes, V is the potential
difference measured across the conductor in units of volts, and R is the resistance
of the conductor in units of ohms. More specifically, Ohm's law states that the R in
this relation is constant, independent of the current. Resistors are common
elements of electrical networks and electronic circuits and are ubiquitous in
electronic equipment. Practical resistors can be made of various compounds and
films, as well as resistance wire (wire made of a high-resistivity alloy, such as
nickel-chrome).

Resistor

`
22

Power Ratings of Resistors:

Electrical energy is converted to heat when current flows through a resistor.
Usually the effect is negligible, but if the resistance is low (or the voltage across
the resistor high) a large current may pass making the resistor become noticeably
warm. The resistor must be able to withstand the heating effect and resistors have
power ratings to show this.
Power ratings of resistors are rarely quoted in parts lists because for most circuits
the standard power ratings of 0.25W or 0.5W are suitable. For the rare cases where
a higher power is required it should be clearly specified in the parts list, these will
be circuits using low value resistors (less than about 300 ) or high voltages (more
than 15V).
The power, P, developed in a resistor is given by:
P = I R
or
P = V / R
where: P = power developed in the resistor in watts (W)
I = current through the resistor in amps (A)
R = resistance of the resistor in ohms ( )
V = voltage across the resistor in volts (V)





Resistor colour Code:



First the history and development of the resistor as we no it. Georg Simon Ohm
was born on March 16, 1789 in the city of Erlangen in Bavaria, which is now
Germany. He died on July 6, 1854 in Munich, Bavaria, Germany. Ohm came from
a protestant family. His father, Johann Wolfgang Ohm, was a locksmith while his
mother, Maria Elizabeth Beck, was the daughter of a tailor. Although his parents
had not been formally educated, Ohm's father was a rather remarkable man who
had educated himself to a high level and was able to give his sons and excellent
education through his own teachings. Had Ohm's brothers and sisters all survived
he would have been one of a large family but, as was common in those times,
several of the children died in their childhood. Of the seven children born to
Johann and Maria Ohm only three survived, Georg, his brother Marin who went on
`
23

to become a well-known mathematician, and his sister Elizabeth Barbara.

While children, Georg and Martin were taught by their father who brought them to
a high standard in mathematics, physics, chemistry and philosophy. This was in
stark contrast to their school education. Georg Simon entered Erlangen
Gymnasium at the age of eleven but there he received little by the way of scientific
training. In fact, his formal part of his schooling was uninspired stressing learning
by rote and interpreting texts. This contrasted strongly with the inspired instruction
that both Georg Simon and Martin received from their farther who brought them to
a level in mathematics which led the professor at the University of Erlangen, Karl
Christian von Langsdorf, to compare them to the Bernoulli Family. It is worth
stressing again the remarkable achievement of Johann Wolfgang Ohm, an entirely
self-taught man, to have been able to give his sons such a fine mathematical
andscientific education continue Ohm's deduction of results from experimental
evidence and, particularly in the second paper, he was able to propose laws which
went a long way to explaining results of others working on galvanic electricity.
This second paper certainly was a first step in a comprehensive theory which Ohm
was able to give in his famous book published in the following year called "Die
Galvanische Kette, mathematisch bearbeitet" (1827) which means "The Galvanic
Chain, Mathematically worked" and contained what is now know as the 'Ohm
Laws' and they are for voltage: E=IxR, current: I=E/R, resistance: R=E/I, power:
P=E
2
/R, also P=I
2
*R or P=E*I
At the time Ohm started to write his papers (8) he was on a one year sabbatical
doing his research at the Jesuit Gymnasium of Cologne.
















`
24

Diagram of resistor color code







Resistance color code


`
25

2.6 CAPACITOR:

What exactly is a 'Capacitor'? A capacitor is a device that stores an electrical
charge or energy on its plates. These plates (see Fig. 1), a positive and a negative
plate, are placed very close together with an insulator in between to prevent the
plates from touching each other. A capacitor can carry a voltage equal to the
battery or input voltage. Usually a capacitor has more than two plates depending
on the capacitance or dielectric type.

The 'Charge' is called the amount of stored electricity on the plates, or actually the
electric field between theses plates, and is proportional to the applied voltage and
capacitor's 'capacitance'.
The Formula to calculate the amount of capacitance is Q = C * V where:
Q = Charge in Coulombs
C = Capacitance in Farads
V = Voltage in Volts

There is also something else involved when there is 'charge', something stored
called 'Energy'.
The formula to calculate the amount of energy is: W = V
2
* C / 2 where:
W = Energy in Joules
V = Voltage in Volts
C = Capacitance in Farads





Capacitor


`
26

The larger the plate area and the smaller the area between the plates, the larger the
capacitance. Which also depends on the type of insulating material between the
plates which is the smallest with air. (You see this type of capacitor sometimes in
high-voltage circuits and are called 'spark-caps'.) Replacing the air space with an
insulator will increase the capacitance many times over. The capacitance ratio
using an insulator material is called Dielectric Constant while the insulator
material itself is called just Dielectric. Using the table in Fig. 4, if a Polystyrene
dielectric is used instead of air, the capacitance will be increased 2.60 times.


Types of capacitor:

Electrolytic - Made of electrolyte, basically conductive salt in solvent. Aluminum
electrodes are used by using a thin oxidation membrane. Most common type,
polarized capacitor. Applications: Ripple filters, timing circuits. Cheap, readily
available, good for storage of charge (energy). Not very accurate, marginal
electrical properties, leakage, drifting, not suitable for use in hf circuits, available
in very small or very large values in F. They WILL explode if the rated working
voltage is exceeded or polarity is reversed, so be careful. When you use this type
capacitor in one of your projects, the rule-of-thumb is to choose one which is twice
the supply voltage. Example, if your supply power is 12 volt you would choose a
24volt (25V) type. This type has come a long way and characteristics have
constantly improved over the years. It is and always will be an all-time favorite;
unless something better comes along to replace it. But I don't think so for this
decade; polarized capacitors are heavily used in almost every kind of equipment
and consumer electronics.

Tantalum - Made of Tantalum Pentoxide. They are electrolytic capacitors but used
with a material called tantalum for the electrodes. Superior to electrolytic
capacitors, excellent temperature and frequency characteristics. When tantalum
powder is baked in order to solidify it, a crack forms inside. An electric charge can
be stored on this crack. Like electrolytics, tantalums are polarized so watch the '+'
and '-' indicators. Mostly used in analog signal systems because of the lack of
current-spike-noise. Small size fits anywhere, reliable, most common values
readily available. Expensive, easily damaged by spikes, large values exists but may
be hard to obtain. Largest in my own collection is 220F/35V, beige color.




`
27

Super Capacitors - The Electric Double Layer capacitor is a real miracle piece of
work. Capacitance is 0.47 Farad (470,000 F). Despite the large capacitance value,
its physical dimensions are relatively small. It has a diameter of 21 mm (almost an
inch) and a height of 11 mm (1/2 inch). Like other electrolytics the super capacitor
is also polarized so exercise caution in regards to the break-down voltage. Care
must be taken when using this capacitor. It has such large capacitance that, without
precautions, it would destroy part of a powersupply such as the bridge rectifier,
volt regulators, or whatever because of the huge inrush current at charge. For a
brief moment, this capacitor acts like a short circuit when the capacitor is charged.
Protection circuitry is a must for this type.

Polyester Film - This capacitor uses a thin polyester film as a dielectric. Not as
high a tolerance as polypropylene, but cheap, temperature stable, readily available,
widely used. Tolerance is approx 5% to 10%. Can be quite large depending on
capacity or rated voltage and so may not be suitable for all applications.

Polypropylene - Mainly used when a higher tolerance is needed then polyester
caps can offer. This polypropylene film is the dielectric.
Very little change in capacitance when these capacitors are used in applications
within frequency range 100KHz. Tolerance is about 1%.
Very small values are available.

Ceramic - Constructed with materials such as titanium acid barium for dielectric.
Internally these capacitors are not constructed as a coil, so they are well suited for
use in high frequency applications. Typically used to by-pass high frequency
signals to ground. They are shaped like a disk, available in very small capacitance
values and very small sizes. Together with the electrolytic the most widely
available and used capacitor around. Comes in very small size and value, very
cheap, reliable. Subject to drifting depending on ambient temperature. NPO types
are the temperature stable types. They are identified by a black stripe on top.
Silver-Mica - Mica is used as a dielectric. Used in resonance circuits, frequency
filters, and military RF applications.
Highly stable, good temperature coefficient, excellent for endurance because of
their frequency characteristics, no large values, high voltage types available, can be
expensive but worth the extra dimes.





`
28


Capacitors in Parallel:

Capacitors connected in parallel, which is the most desirable, have their
capacitance added together, which is just the opposite of parallel resistors. It is an
excellent way of increasing the total storage capacity of an electric charge:
C
total
= C
1
+ C
2
+ C
3


Keep in mind that only the total capacitance changes, not the supplied voltage.
Every single capacitor will see the same voltage, no matter what. Be careful not to
exceed the specified voltage on the capacitors when combining them all with
different voltage ratings, or they may explode. Example: say you have three
capacitors with voltages of 16V, 25V, and 50V. The voltage must not exceed the
lowest voltage, in this case the 16V one. As a matter of fact, and a rule-of-thumb,
always choose a capacitor which is twice the supplied input voltage. Example: If
the input voltage is 12V you would select a 24V type (in real life 25V).


Capacitors in Series:

Again, just the opposite way of calculating resistors. Multiple capacitors connected
in series with each other will have the total capacitance lower than the lowest
single value capacitor in that circuit. Not the preferred method but acceptable.
For a regular two capacitor series combo use this simple formula:

If you have two identical capacitors in series the formula is simplicity itself:



`
29

2.7 LIGHT EMITTING DIODE:

A light-emitting diode (LED) is a semiconductor light source. LEDs are used as
indicator lamps in many devices and are increasingly used for other lighting.
Introduced as a practical electronic component in 1962, early LEDs emitted low-
intensity red light, but modern versions are available across the visible, ultraviolet,
and infrared wavelengths, with very high brightness.
When a light-emitting diode is forward-biased (switched on), electrons are able
to recombine with electron holes within the device, releasing energy in the form
of photons. This effect is called electroluminescence and the color of the light
(corresponding to the energy of the photon) is determined by the energy gap of the
semiconductor. LEDs are often small in area (less than 1 mm
2
), and integrated
optical components may be used to shape its radiation pattern. LEDs present
many advantages over incandescent light sources including lower energy
consumption, longer lifetime, improved robustness, smaller size, and faster
switching. LEDs powerful enough for room lighting are relatively expensive and
require more precise current and heat management than compact fluorescent
lamp sources of comparable output.
Light-emitting diodes are used in applications as diverse as aviation
lighting, automotive lighting, advertising, general lighting, and traffic signals.
LEDs have allowed new text, video displays, and sensors to be developed, while
their high switching rates are also useful in advanced communications technology.

`
30

Connecting and soldering:

LEDs must be connected the correct way round, the diagram may be labelled a or
+ for anode and k or - for cathode (yes, it really is k, not c, for cathode!). The
cathode is the short lead and there may be a slight flat on the body of round LEDs.
If you can see inside the LED the cathode is the larger electrode (but this is not an
official identification method).
LEDs can be damaged by heat when soldering, but the risk is small unless you are
very slow. No special precautions are needed for soldering most LEDs.

Testing an LED:

Never connect an LED directly to a battery or power supply!
It will be destroyed almost instantly because too much current will pass through
and burn it out.
LEDs must have a resistor in series to limit the current to a safe value, for quick
testing purposes a 1k resistor is suitable for most LEDs if your supply voltage is
12V or less. Remember to connect the LED the correct way round!
Colours of LEDs:
LEDs are available in red, orange, amber,
yellow, green, blue and white. Blue and
white LEDs are much more expensive
than the other colours.
The colour of an LED is determined by
the semiconductor material, not by the
colouring of the 'package' (the plastic body). LEDs of all colours are available in
uncoloured packages which may be diffused (milky) or clear (often described as
'water clear'). The coloured packages are also available as diffused (the standard
type) or transparent.

Tri-colour LEDs:

The most popular type of tri-colour LED has a red and a green LED combined in
one package with three leads. They are called tri-colour because mixed red and
`
31

green light appears to be yellow and this is produced when both the red and green
LEDs are on.
The diagram shows the construction of a tri-colour LED. Note the different lengths
of the three leads. The centre lead (k) is the common cathode for both LEDs, the
outer leads (a1 and a2) are the anodes to the LEDs allowing each one to be lit
separately, or both together to give the third colour.

Bi-colour LEDs:

A bi-colour LED has two LEDs wired in 'inverse parallel' (one forwards, one
backwards) combined in one package with two leads. Only one of the LEDs can be
lit at one time and they are less useful than the tri-colour LEDs described above.

Sizes, Shapes and Viewing angles of LEDs:

LEDs are available in a wide variety of sizes and shapes. The 'standard' LED has a
round cross-section of 5mm diameter and this is probably the best type for general
use, but 3mm round LEDs are also popular.
Round cross-section LEDs are frequently used and they are very easy to install on
boxes by drilling a hole of the LED diameter, adding a spot of glue will help to
hold the LED if necessary. LED clips are also available to secure LEDs in holes.
Other cross-section shapes include square, rectangular and triangular.
As well as a variety of colours, sizes and shapes, LEDs also vary in their viewing
angle. This tells you how much the beam of light spreads out. Standard LEDs have
a viewing angle of 60 but others have a narrow beam of 30 or less.
Calculating an LED resistor value:
An LED must have a resistor connected in series to limit the current through the
LED, otherwise it will burn out almost instantly.
The resistor value, R is given by:
R = (V
S
- V
L
) / I
`
32

V
S
= supply voltage
V
L
= LED voltage (usually 2V, but 4V for blue and white LEDs)
I = LED current (e.g. 20mA), this must be less than the maximum permitted
If the calculated value is not available choose the nearest standard resistor value
which is greater, so that the current will be a little less than you chose. In fact you
may wish to choose a greater resistor value to reduce the current (to increase
battery life for example) but this will make the LED less bright.
For example
If the supply voltage V
S
= 9V, and you have a red LED (V
L
= 2V), requiring a
current I = 20mA = 0.020A,
R = (9V - 2V) / 0.02A = 350 , so choose 390 (the nearest standard value which
is greater).
Working out the LED resistor formula using Ohm's law
Ohm's law says that the resistance of the resistor, R = V/I, where:
V = voltage across the resistor (= V
S
- V
L
in this case)
I = the current through the resistor
So R = (V
S
- V
L
) / I
Connecting LEDs in series:
If you wish to have several LEDs on at the same time it may be possible to connect
them in series. This prolongs battery life by lighting several LEDs with the same
current as just one LED.
All the LEDs connected in series pass the same current so it is best if they are all
the same type. The power supply must have sufficient voltage to provide about 2V
for each LED (4V for blue and white) plus at least another 2V for the resistor. To
work out a value for the resistor you must add up all the LED voltages and use this
for V
L
.
Example calculations:
A red, a yellow and a green LED in series need a supply voltage of at least
3 2V + 2V = 8V, so a 9V battery would be ideal.
V
L
= 2V + 2V + 2V = 6V (the three LED voltages added up).
If the supply voltage V
S
is 9V and the current I must be 15mA = 0.015A,
`
33

Resistor R = (V
S
- V
L
) / I = (9 - 6) / 0.015 = 3 / 0.015 = 200 ,
so choose R = 220 (the nearest standard value which is greater).


Avoid connecting LEDs in parallel:

Connecting several LEDs in parallel with just one resistor shared between them is
generally not a good idea.
If the LEDs require slightly different voltages only the lowest voltage LED will
light and it may be destroyed by the larger current flowing through it. Although
identical LEDs can be successfully connected in parallel with one resistor this
rarely offers any useful benefit because resistors are very cheap and the current
used is the same as connecting the LEDs individually. If LEDs are in parallel each
one should have its own resistor.

Reading a table of technical data for LEDs:
Suppliers' catalogues usually include tables of technical data for components such
as LEDs. These tables contain a good deal of useful information in a compact form
but they can be difficult to understand if you are not familiar with the abbreviations
used.
The table below shows typical technical data for some 5mm diameter round LEDs
with diffused packages (plastic bodies). Only three columns are important and
these are shown in bold. Please see below for explanations of the quantities.






`
34

2.8 ULN2803A DRIVER I.C.:

The ULN2801A-ULN2805Aeach contain eight darlington transistors with
common emitters and integral suppression diodes for inductive loads. Each
darlington features a peak load current rating of 600mA (500mA continuous) and
can withstand at least50V in the off state. Outputs maybe paralleled for higher
current capability. Five versions are available to simplify interfacing to standard
logic families : the ULN2801Ais designed for general purpose applications with a
current limit resistor ; theULN2802Ahas a 10.5kW input resistor and zener for 14
25VPMOS; theULN2803Ahas a 2.7kW input resistor for 5V TTL and CMOS ; the
ULN2804A has a 10.5kW input resistor for 6-15V CMOS and the ULN2805A is
designed to sink a minimum of 350mA for standard and Schottky TTL where
higher output current is required. All types are supplied in a 18-lead plastic DIP
with a copper lead from and feature the convenient in put opposite- output pin out
to simplify board layout.

The ULN2803A is a monolithic high-voltage, high-current Darlington transistor
array. The device consists of eight npn Darlington pairs that feature high-voltage
outputs with common-cathode clamp diodes for switching inductive loads. The
collector-current rating of each Darlington pair is 500 mA. The Darlington pairs
may be paralleled for higher current capability. Applications include relay drivers,
hammer drivers, lamp drivers, display drivers (LED and gas discharge), line
drivers, and logic buffers. The ULN2803A has a 2.7-kW series base resistor for
each Darlington pair for operation directly with TTL or 5-V CMOS devices. The
ULN2803A is offered in a standard 18-pin dual in-line (N) package. The device is
characterized for operation over the temperature range of 20C to 85C.












`
35

Diagram:



ULN2803A




`
36

2.9 MICROCONTROLLER:

A microcontroller (sometimes abbreviated C, uC or MCU) is a small computer on
a single integrated circuit containing a processor core, memory, and programmable
input/output peripherals. Program memory in the form of NOR flash or OTP ROM
is also often included on chip, as well as a typically small amount of RAM.
Microcontrollers are designed for embedded applications, in contrast to the
microprocessors used in personal computers or other general purpose applications.
Microcontrollers are used in automatically controlled products and devices, such as
automobile engine control systems, implantable medical devices, remote controls,
office machines, appliances, power tools, toys and other embedded systems. By
reducing the size and cost compared to a design that uses a separate
microprocessor, memory, and input/output devices, microcontrollers make it
economical to digitally control even more devices and processes. Mixed signal
microcontrollers are common, integrating analog components needed to control
non-digital electronic systems.
Some microcontrollers may use four-bit words and operate at clock rate
frequencies as low as 4 kHz, for low power consumption (single-digit milliwatts or
microwatts). They will generally have the ability to retain functionality while
waiting for an event such as a button press or other interrupt; power consumption
while sleeping (CPU clock and most peripherals off) may be just nanowatts,
making many of them well suited for long lasting battery applications. Other
microcontrollers may serve performance-critical roles, where they may need to act
more like a digital signal processor (DSP), with higher clock speeds and power
consumption.
The first single-chip microprocessor was the 4-bit Intel 4004 released in 1971, with
the Intel 8008 and other more capable microprocessors becoming available over
the next several years. However, both processors required external chips to
implement a working system, raising total system cost, and making it impossible to
economically computerize appliances.
The Smithsonian Institution says TI engineers Gary Boone and Michael Cochran
succeeded in creating the first microcontroller in 1971. The result of their work
was the TMS 1000, which became commercially available in 1974. It combined
read-only memory, read/write memory, processor and clock on one chip and was
targeted at embedded systems.
`
37

Partly in response to the existence of the single-chip TMS 1000, Intel developed a
computer system on a chip optimized for control applications, the Intel 8048, with
commercial parts first shipping in 1977. It combined RAM and ROM on the same
chip. This chip would find its way into over one billion PC keyboards, and other
numerous applications. At that time Intel's President, Luke J. Valenter, stated that
the microcontroller was one of the most successful in the company's history, and
expanded the division's budget over 25%.
Most microcontrollers at this time had two variants. One had an erasable EPROM
program memory, with a transparent quartz window in the lid of the package to
allow it to be erased by exposure to ultraviolet light. The other was a PROM
variant which was only programmable once; sometimes this was signified with the
designation OTP, standing for "one-time programmable". The PROM was actually
exactly the same type of memory as the EPROM, but because there was no way to
expose it to ultraviolet light, it could not be erased. The erasable versions required
ceramic packages with quartz windows, making them significantly more expensive
than the OTP versions, which could be made in lower-cost opaque plastic
packages. For the erasable variants, quartz was required, instead of less expensive
glass, for its transparency to ultravioletglass is largely opaque to UVbut the
main cost differentiator was the ceramic package itself.
In 1993, the introduction of EEPROM memory allowed microcontrollers
(beginning with the Microchip PIC16x84) to be electrically erased quickly without
an expensive package as required for EPROM, allowing both rapid prototyping,
and In System Programming. (EEPROM technology had been available prior to
this time, but the earlier EEPROM was more expensive and less durable, making it
unsuitable for low-cost mass-produced microcontrollers.) The same year, Atmel
introduced the first microcontroller using Flash memory, a special type of
EEPROM. Other companies rapidly followed suit, with both memory types.
Cost has plummeted over time, with the cheapest 8-bit microcontrollers being
available for under 0.25 USD in quantity (thousands) in 2009, and some 32-bit
microcontrollers around 1 USD for similar quantities.
Nowadays microcontrollers are cheap and readily available for hobbyists, with
large online communities around certain processors.
In the future, MRAM could potentially be used in microcontrollers as it has infinite
endurance and its incremental semiconductor wafer process cost is relatively low.
`
38

Volumes:
About 55% of all CPUs sold in the world are 8-bit microcontrollers and
microprocessors. According to Semico, over four billion 8-bit microcontrollers
were sold in 2006. More recently, Semico has claimed the MCU market grew
36.5% in 2010 and 12% in 2011. A typical home in a developed country is likely
to have only four general-purpose microprocessors but around three dozen
microcontrollers. A typical mid-range automobile has as many as 30 or more
microcontrollers. They can also be found in many electrical devices such as
washing machines, microwave ovens, and telephones.


A PIC 18F8720 microcontroller in an 80-pin TQFP package.

Embedded design:
A microcontroller can be considered a self-contained system with a processor,
memory and peripherals and can be used as an embedded system. The majority of
microcontrollers in use today are embedded in other machinery, such as
automobiles, telephones, appliances, and peripherals for computer systems. While
some embedded systems are very sophisticated, many have minimal requirements
for memory and program length, with no operating system, and low software
complexity. Typical input and output devices include switches, relays, solenoids,
LEDs, small or custom LCD displays, radio frequency devices, and sensors for
data such as temperature, humidity, light level etc. Embedded systems usually have
no keyboard, screen, disks, printers, or other recognizable I/O devices of a personal
computer, and may lack human interaction devices of any kind.
`
39

Interrupts:
Microcontrollers must provide real time (predictable, though not necessarily fast)
response to events in the embedded system they are controlling. When certain
events occur, an interrupt system can signal the processor to suspend processing
the current instruction sequence and to begin an interrupt service routine (ISR, or
"interrupt handler"). The ISR will perform any processing required based on the
source of the interrupt, before returning to the original instruction sequence.
Possible interrupt sources are device dependent, and often include events such as
an internal timer overflow, completing an analog to digital conversion, a logic
level change on an input such as from a button being pressed, and data received on
a communication link. Where power consumption is important as in battery
operated devices, interrupts may also wake a microcontroller from a low power
sleep state where the processor is halted until required to do something by a
peripheral event.
Programs:
Typically microcontroller programs must fit in the available on-chip program
memory, since it would be costly to provide a system with external, expandable,
memory. Compilers and assemblers are used to convert high-level language and
assembler language codes into a compact machine code for storage in the
microcontroller's memory. Depending on the device, the program memory may be
permanent, read-only memory that can only be programmed at the factory, or
program memory that may be field-alterable flash or erasable read-only memory.
Manufacturers have often produced special versions of their microcontrollers in
order to help the hardware and software development of the target system.
Originally these included EPROM versions that have a "window" on the top of the
device through which program memory can be erased by ultraviolet light, ready for
reprogramming after a programming ("burn") and test cycle. Since 1998, EPROM
versions are rare and have been replaced by EEPROM and flash, which are easier
to use (can be erased electronically) and cheaper to manufacture.
Other versions may be available where the ROM is accessed as an external device
rather than as internal memory, however these are becoming increasingly rare due
to the widespread availability of cheap microcontroller programmers.
The use of field-programmable devices on a microcontroller may allow field
update of the firmware or permit late factory revisions to products that have been
`
40

assembled but not yet shipped. Programmable memory also reduces the lead time
required for deployment of a new product.
Where hundreds of thousands of identical devices are required, using parts
programmed at the time of manufacture can be an economical option. These "mask
programmed" parts have the program laid down in the same way as the logic of the
chip, at the same time.
A customizable microcontroller incorporates a block of digital logic that can be
personalized in order to provide additional processing capability, peripherals and
interfaces that are adapted to the requirements of the application. For example, the
AT91CAP from Atmel has a block of logic that can be customized during
manufacture according to user requirements.
Other microcontroller features:
Microcontrollers usually contain from several to dozens of general purpose
input/output pins (GPIO). GPIO pins are software configurable to either an input or
an output state. When GPIO pins are configured to an input state, they are often
used to read sensors or external signals. Configured to the output state, GPIO pins
can drive external devices such as LEDs or motors.
Many embedded systems need to read sensors that produce analog signals. This is
the purpose of the analog-to-digital converter (ADC). Since processors are built to
interpret and process digital data, i.e. 1s and 0s, they are not able to do anything
with the analog signals that may be sent to it by a device. So the analog to digital
converter is used to convert the incoming data into a form that the processor can
recognize. A less common feature on some microcontrollers is a digital-to-analog
converter (DAC) that allows the processor to output analog signals or voltage
levels.
In addition to the converters, many embedded microprocessors include a variety of
timers as well. One of the most common types of timers is the Programmable
Interval Timer (PIT). A PIT may either count down from some value to zero, or up
to the capacity of the count register, overflowing to zero. Once it reaches zero, it
sends an interrupt to the processor indicating that it has finished counting. This is
useful for devices such as thermostats, which periodically test the temperature
around them to see if they need to turn the air conditioner on, the heater on, etc.
`
41

A dedicated Pulse Width Modulation (PWM) block makes it possible for the CPU
to control power converters, resistive loads, motors, etc., without using lots of CPU
resources in tight timer loops.
Universal Asynchronous Receiver/Transmitter (UART) block makes it possible to
receive and transmit data over a serial line with very little load on the CPU.
Dedicated on-chip hardware also often includes capabilities to communicate with
other devices (chips) in digital formats such as IC and Serial Peripheral Interface
(SPI).
Higher integration:
Micro-controllers may not implement an external address or data bus as they
integrate RAM and non-volatile memory on the same chip as the CPU. Using
fewer pins, the chip can be placed in a much smaller, cheaper package.
Integrating the memory and other peripherals on a single chip and testing them as a
unit increases the cost of that chip, but often results in decreased net cost of the
embedded system as a whole. Even if the cost of a CPU that has integrated
peripherals is slightly more than the cost of a CPU and external peripherals, having
fewer chips typically allows a smaller and cheaper circuit board, and reduces the
labor required to assemble and test the circuit board, in addition to tending to
decrease the defect rate for the finished assembly.
A micro-controller is a single integrated circuit, commonly with the following
features:
central processing unit - ranging from small and simple 4-bit processors to
complex 32- or 64-bit processors
volatile memory (RAM) for data storage
ROM, EPROM, EEPROM or Flash memory for program and operating
parameter storage
discrete input and output bits, allowing control or detection of the logic state
of an individual package pin
serial input/output such as serial ports (UARTs)
other serial communications interfaces like IC, Serial Peripheral Interface
and Controller Area Network for system interconnect
peripherals such as timers, event counters, PWM generators, and watchdog
clock generator - often an oscillator for a quartz timing crystal, resonator or
RC circuit
`
42

many include analog-to-digital converters, some include digital-to-analog
converters
in-circuit programming and debugging support
This integration drastically reduces the number of chips and the amount of wiring
and circuit board space that would be needed to produce equivalent systems using
separate chips. Furthermore, on low pin count devices in particular, each pin may
interface to several internal peripherals, with the pin function selected by software.
This allows a part to be used in a wider variety of applications than if pins had
dedicated functions. Micro-controllers have proved to be highly popular in
embedded systems since their introduction in the 1970s.
Some microcontrollers use a Harvard architecture: separate memory buses for
instructions and data, allowing accesses to take place concurrently. Where a
Harvard architecture is used, instruction words for the processor may be a different
bit size than the length of internal memory and registers; for example: 12-bit
instructions used with 8-bit data registers.
The decision of which peripheral to integrate is often difficult. The microcontroller
vendors often trade operating frequencies and system design flexibility against
time-to-market requirements from their customers and overall lower system cost.
Manufacturers have to balance the need to minimize the chip size against
additional functionality.
Microcontroller architectures vary widely. Some designs include general-purpose
microprocessor cores, with one or more ROM, RAM, or I/O functions integrated
onto the package. Other designs are purpose built for control applications. A
micro-controller instruction set usually has many instructions intended for bit-wise
operations to make control programs more compact For example, a general
purpose processor might require several instructions to test a bit in a register and
branch if the bit is set, where a micro-controller could have a single instruction to
provide that commonly required function.
Microcontrollers typically do not have a math coprocessor, so floating point
arithmetic is performed by software.



`
43












CHAPTER 03
CIRCUIT DIAGRAM AND WORKING













`
44

3.1 CIRCUIT DIAGRAM:




Traffic light controller using microcontroller



`
45

3.2 WORKING:

This circuit is self explanatory by its name, and can be used to control traffic in
public places, or to demonstrate traffic rules in traffic-parks. IC2, which is heart of
the circuit, is a decade counter. In this counter for every pulse fed to pin-14,
potential keeps shifting from D1 to D9 in cyclic order. IC1 is used as a pulse
generator and generates pulses in regular configurable intervals. These intervals
can be changed by varying VR1. The circuit is designed in such a way that out of
nine pulses, relay RL1 remains triggered for 4 pulses, relay RL2 for 1 pulse and
relay RL3 for remaining 4 pulses. Since D1-D4 provide current to T1, T1 is on
whenever there is potential on any diode D1 to D4, which keeps relay RL1
triggered. Similarly other diodes are responsible for RL2 and RL3 triggering. Red,
Yellow and Green lamps can be connected to the relays RL1, RL2 and RL3
respectively to complete your mini traffic light controller.

Microcontroller based Traffic light systems was one of the basic project that one
can do with a microcontroller to understand its concepts and working.In this post i
would like to share the hardware and program code of a Traffic light controller
with you all.Here in the above circuit you can see that we are using a seven
segment to display as a counter and three LED's to perform the traffic lights
operation.The crystal we are using is of 4MHz crystal and the Microcontroller was
AT89C52.

The LED's was connected in a common anode mode so that the Microcontroller
was used as a sink here.The Red color was made to flash for 10 seconds and
yellow, green were assigned glow for five seconds each.The resistor values for
LED's should be of 470 ohm and to the 7 segment should be around 1K




`
46

3.3 PROGRAMING:


#define r4led P1.4
#define y4led P1.2
#define g4led P1.3

void init(void);
void delay(unsigned int);

void init(void)
{
g4led = 1;
y4led = 0;
r4led = 0;
}

void delay(unsigned int n)
{
unsigned int i;
`
47

unsigned int j;
for(i=0;i<n;i++)
{
for(j=0;j<1275;j++)
{
}
}
}

void main(void)
{
init();

while(1)
{
g4led = 1; //green led on for 13 sec
y4led = 0;
r4led = 0;
delay(1300); //1300 * 10 msec = 13 sec

`
48

g4led = 0; //green led off and yellow led on for 1 sec
y4led = 1;
r4led = 0;
delay(100); //100*10msec = 1 sec

g4led = 0; //yellow led off and red led on for 13 sec
y4led = 0;
r4led = 1;
delay(1300);

g4led = 0; //red led off and yellow led on for 1 sec
y4led = 1;
r4led = 0;
delay(100);

}
}



`
49








CHAPTER 04
CONCLUSION AND BIBLIOGRAPHY











`
50

4.1 CONCLUSION:

From the design and construction of a traffic light controller, carried out in the
course of this project, it is obvious that such a system which is used to reduce the
human stress of standing under favourable or unfavourable weather conditions
and controlling the movement of vehicles at as well as pedestrians, can be
developed by indigenous human resources. This would reduce the spending of
huge sums of money that could have been spent on the maintenance of manpower
or importation of expatriates to carryout and maintain the installation, since it can
be conducted internally. Generally, this research work is aimed at producing an
indigenous traffic control system, which is easy to maintain, affordable and
efficient.


4.2 FUTURE ASPECTS:

1. Further studies should be carried out in the area of microprocessor-based
traffic control system. This will add a lot of functionality and flexibility to
the system.
2 . Because of the epileptic nature of our power supply system, it is necessary
to carry out further research on solar-powered traffic control system.







`
51

4.3 BIBLIOGRAPHY:



R.S. Sedha Electronics


https://www.google.co.in

You might also like