gyan future 1
TRANSCRIPT
-
8/18/2019 Gyan Future 1
1/49
1.1 Overview
Traffic research has the goal to optimize traffic flow of people and goods. As the number of road users constantly increases, and resources provided by current infrastructures arelimited, intelligent control of traffic will become a very important issue in the future.
However, some limitations to the usage of intelligent traffic control exist. Avoiding traffic
jams for example is thought to be beneficial to both environment and economy, butimproved traffic-flow may also lead to an increase in demand. There are several models
for traffic simulation. n our research we focus on optimization of traffic light controllers
in a city using ! sensor and control traffic using AT"#$A %& microcontroller.
The traffic control system based on vehicle density calculation tries to reduce possibilities
of traffic jams, caused by traffic lights. The system contains three ! transmitter and ! receiver for traffic density measurement which are mounted on the either sides of roads
respectively. The ! system gets activated whenever any vehicle passes on road between
! sensors. 'hen one sensor will be () at that time density will be less when two
sensors will be () at that traffic density is medium when all * sensor will be () at thattime density will be high. "icrocontroller controls the ! system and counts number of
vehicles passing on road. +ased on vehicle density calculation, the microcontroller taes
decision and updates the traffic light delays as a result. The traffic light is situated at acertain distance from the ! system. Thus based on vehicle density calculation,
microcontroller defines different ranges for traffic light delays and update.
Also we use $ technology to give accidental information about the vehicle. 'hen
traffic accidents occur, the system immediately notifies the location of accident to
emergency personnel lie ambulance by use of $ technology. Also the system havefacility to emergency vehicle detection system lie ambulance, police etc. 'hen anemergency car comes on the signal and number of vehicles will be available in front of
the emergency vehicle. n this situation, the system will detect the emergency car, and
then signal falls !#/ to $!##) to pass the car by sending signal from emergencyvehicle to traffic light sensor system and the signal will be !#/ for other vehicles, so
number of possibility of accident reduces.
1.2 Objectives
f traffic flows were constant over time and nown in advance, then calculation of signal
timing plans to optimise a specified objective would be a relatively straightforward matter.
0. Traffic flows vary in several distinct ways that mae the control tas substantially more
complicated.
1. n particular, flows vary stochastically from moment to moment due to fluctuations in
demand and driver behaviour2 flows in urban road networs vary cyclically over time due
1
-
8/18/2019 Gyan Future 1
2/49
to upstream signals2 flows vary systematically within each day due to pea periods2 and
flows change over protracted periods of time due to developing demand for travel.
*. The affects the control of road traffic in different ways, so we will consider their
treatment separately.
3. An engineer4s main aim is to mae the technology which is simple and useful for the
purpose of 5ight 6ontrol.
1.3 Characteristics
High 7uality roduct 8)ot hobby grade9
&:%;
-
8/18/2019 Gyan Future 1
3/49
1.5 Advantages
Eollowing are the Advantages of /ensity based Traffic 5ight 6ontrol ystem, they are@-
0. (ptimum control of fluctuating traffic volumes such as over saturated or unusual load
condition.
1. t improve the vehicular through put.
*. "aximizes the traffic flow.
3. 6ontrol the time intervals of the traffic light.
3
-
8/18/2019 Gyan Future 1
4/49
Fig.2.1 Block Diagram of Density Based Trac Control
4
-
8/18/2019 Gyan Future 1
5/49
System
2.2 Description of Block Diagram
The design of the project is basically divided into three section@-
0. assive nfrared ensor 8!9
1. "icrocontroller
*. 5ight #mitting /iode 85#/9
3. ower upply
2.2.1 Passive Infrared ensor
A assive nfrared ensor is an electronic sensor that measure infrared light radiating
from objects in its field of view. They are most often used in ! based motion detectors.
2.2.1.1 Principle
All objects with a temperature above absolute zero emit heat energy in form of radiation.Fsually this radiation is invisible to the human eye because it radiates at infrared wave
lengths, but it can be detected by electronic device designed for such a purpose.
2.2.1.2 Constr!ction
"aterials commonly used in ! sensors include $allium )itride 8$a)9, 6aesium )itrate
86s)(*9, olyvinyl Elourides derivatives of henylpyridine and 6obalt hthalocyanine.
The sensor is often manufactured as part of an integrated circuit.
2.2.2 "icrocontroller
A "icrocontroller is small eGuipment on a single integrated circuit containing a processor
core, memory and programmable ;(. peripherals, program memory in the form of
ferroelectric !A", )(! Elash or (T !(" is also often included on chip, as well as atypically small amount of !A", "icrocontrollers are designed for ambeddedapplications. n contrast to the microprocessors used in personal computers or often
general purpose applications consisting of various discrete chips.
"icrocontrollers are used in automatically controlled products and devices, such as
automobile engine control systems such as automobile engine control systems,
5
-
8/18/2019 Gyan Future 1
6/49
implantable, medical devices, remote controls, office machines, appliance power tools,
toys and other embedded systems. +y reducing the size and cost compared to a designed
that use a separate microprocessors, memory and ;( devices.
2.2.3 #ight $%itting &iode '#$&(
The main role of 5#/ is to show the colour of light which indicates that when we stop,
ready and go.
2.2.4 Power !ppl)
n this process we are using a step down transformer, a bridge rectifier, a smoothing
circuit and the !.
At the primary of the transformer we are giving the 1*%D A6 supply. The secondary isconnected to the opposite terminals of the +ridge rectifier as the input. Erom other set of
opposite terminals we are taing the output to the rectifier.
The bridge rectifier converts the A6 coming from the secondary of the transformer into
pulsating /6. The output of this rectifier is further given to the smoother circuit which iscapacitor in our project. The smoothing circuit eliminates the ripples from the pulsating
/6 and gives the pure /6 to the ! to get a constant output /6 voltage. The !
regulates the voltage as per our reGuirement.
6
-
8/18/2019 Gyan Future 1
7/49
2.3 Circ!it &iagra%
V C C
R 5R
J 3
C O N 8
12345678
U 5
L M 7 8 0 5 / T O
1
3
2V I N
G N D
V O U T
C 2
C A P
D 4
D I O D E
U 1
A T 8 9 S 5 2
5678
9
1 01 11 21 31 41 51 61 7
1 8
1 9
2 0
4 0
3 93 83 73 63 53 43 33 2
3 1
3 02 9
2 82 72 62 52 42 32 2
2 1
1234
P 1 . 4
P 1 . 5P 1 . 6P 1 . 7
R S T
P 3 . 0 / R X DP 3 . 1 / T X DP 3 . 2 / I N T 0P 3 . 3 / I N T 1P 3 . 4 / T 0P 3 . 5 / T 1P 3 . 6 / W RP 3 . 7 / R D
X T A L 2
X T A L 1
G N D
V C C
P 0 . 0 / A D 0P 0 . 1 / A D 1P 0 . 2 / A D 2
P 0 . 3 / A D 3P 0 . 4 / A D 4P 0 . 5 / A D 5P 0 . 6 / A D 6P 0 . 7 / A D 7
E A / V P P
A L E / P R O GP S E N
P 2 . 7 / A 1 5P 2 . 6 / A 1 4P 2 . 5 / A 1 3P 2 . 4 / A 1 2P 2 . 3 / A 1 1P 2 . 2 / A 1 0
P 2 . 1 / A 9P 2 . 0 / A 8
P 1 . 0P 1 . 1P 1 . 2P 1 . 3
S W 1
J 2
C O N 8
12345678
C 5
C A P
V C C
J 4
C O N 8
12345678
D 1
D I O D E
R 4R
J 3
L C D
1 2 3 4 5 6 7 8 9 1 0
1 1
1 2
1 3
1 4
1 5
1 6
!
"
# $ $
3 R S
W E N
P 0
. 0
P 0
. 1
P 0
. 2
P 0
. 3
P 0
. 4
P 0
. 5
P 0
. 6
P 0
. 7
V C C
G N D
C 4
C A P
C 1
C
P 2
C O N N E C T O R D & 9
594837261
C 6
C A P
V C C
R X D
R 6
P O T
J 2
C O N 8
1234567
8
D 6
D I O D E
T X D
T X D
C 7C A P
U 6
' / ( ) 4 * + ! ,
1 2
3 4
1 2
3 4
C 3
C A P
D 2
D I O D E
- D $ - R # C "
- T + '
A
1 1T " J 1 5 2 0 1 0
T + '
S + D $ : ! ' N : ; R #
D ' < S ' (
= 1
C R = S T A L
D 5L E D
R X D
J 7
C O N 2
1 2
> 5 V
C 9
C
? 1 0 0 0 U @ / 2 5 V
U 3
M A X 2 3 2
13
45
2
6
1 2
9
1 1
1 0
1 3
8
1 4
7
C 1 >C 1
C 2 >C 2
V >
V
R 1 O U T
R 2 O U T
T 1 I N
T 2 I N
R 1 I N
R 2 I N
T 1 O U T
T 2 O U T
C 81 0 4
7
-
8/18/2019 Gyan Future 1
8/49
2.3.1 che%atic &escription
The main aim of this power supply is to convert the 1*%D A6 into :D /6 in order to give
supply for the TT5. This schematic explanation includes the detailed pin connections of every device with the microcontroller.
This schematic explanation includes the detailed pin connections of every device with the
microcontroller. 5et us see the pin connections of each and every device with the
microcontroller in detail.
2.4 *or+ing
The /ensity based traffic signal system circuit wors or operated by connecting battery or
adaptor of 01volt to the development board. After connecting the battery, switch on the
power supply, burn the program to the ATmega& microcontroller by eeping the programming switch '1 in program mode.
There are four ! sensors which connect to ort 6. ! sensors give the digital output and
5#/s are connected to ort + and ort /. 5#/s connects in the seGuence lie traffic
lights i.e. !ed, ellow and $reen. Arrange one ! sensor for each road. )ow we can see
the normal traffic system based on time basis.
)ow, if we place any obstacle infront of any ! sensor, then the system allows the trafficof that particular path by glowing $!##n light. Einally, turn off the board power supply.
8
-
8/18/2019 Gyan Future 1
9/49
3.1 Co%ponents
#ssential components for assembling $" based applications including@
0. ower supply or ower Adapter
1. Transformer
*. 6apacitor
3. 5#/
:. !esistor
?. "icrocontroller
C. /iode
&. Transistor
-
8/18/2019 Gyan Future 1
10/49
3.1.2 /ransfor%er
Transformer is a static electrical device which transfers electrical energy from one circuit
to another circuit. Transformer woring can be easily understood by its primary andsecondary windings.
,ig. 3.2- tep !p /ransfor%er
3.1.3 Capacitor
The capacitorIs function is to store electricity, or electrical energy.
The capacitor also functions as a filter, passing alternating current 8A69, and blocingdirect current 8/69.
This symbol is used to indicate a capacitor in a circuit diagram. The capacitor isconstructed with two electrode plates facing each other, but separated by an insulator.
'hen /6 voltage is applied to the capacitor, an electric charge is stored on each
electrode. 'hile the capacitor is charging up, current flows. The current will stop flowing
when the capacitor has fully charged.
10
-
8/18/2019 Gyan Future 1
11/49
,ig. 3.3- Circ!it &iagra% of Capacitor
'hen a circuit tester, such as an analog meter set to measure resistance, is connected to a
0% microfarad 8JE9 electrolytic capacitor, a current will flow, but only for a moment. oucan confirm that the meterIs needle moves off of zero, but returns to zero right away.
'hen you connect the meterIs probes to the capacitor in reverse, you will note that
current once again flows for a moment. (nce again, when the capacitor has fully charged,
the current stops flowing. o the capacitor can be used as a filter that blocs /6 current.8A K/6 cutK filter.9
However, in the case of alternating current, the current will be allowed to pass.Alternating current is similar to repeatedly switching the test meterIs probes bac and
forth on the capacitor. 6urrent flows every time the probes are switched.
The value of a capacitor 8the capacitance9, is designated in units called the Earad 8 E 9.The capacitance of a capacitor is generally very small, so units such as the microfarad
80%-?E9, nanofarad 80%-
-
8/18/2019 Gyan Future 1
12/49
3.1.4 #ight $%itting &iode '#$&(
A light-emitting diode 85#/9 is a two-lead semiconductor light source. t is a pn-
junction diode, which emits light when activated. 'hen a suitable voltage is applied tothe leads, electrons are able to recombine with electron holes within the device, releasingenergy in the form of photons. This effect is called electroluminescence, and the color of
the light 8corresponding to the energy of the photon9 is determined by the energy band
gap of the semiconductor.
An 5#/ is often small in area 8less than 0 mm19 and integrated optical components may
be used to shape its radiation pattern.
Appearing as practical electronic components in 0
-
8/18/2019 Gyan Future 1
13/49
,ig. 3.13- &iagra% of #$&
3.1.5 0esistor
The resistorIs function is to reduce the flow of electric current.
This symbol is used to indicate a resistor in a circuit diagram, nown as a
schematic. !esistance value is designated in units called the K(hm.K A 0%%% (hm resistor is typically shown as 0O-(hm 8 ilo (hm 9, and 0%%% O-(hms is written as 0"-(hm
8 megohm9.
There are two classes of resistors2 fixed resistors and the variable resistors. They are alsoclassified according to the material from which they are made. The typical resistor is
made of either carbon film or metal film. There are other types as well, but these are the
most common. The resistance value of the resistor is not the only thing to consider when
selecting a resistor for use in a circuit. The KtoleranceK and the electric power ratings of the resistor are also important. The tolerance of a resistor denotes how close it is to theactual rated resistance value. Eor example, a P:Q tolerance would indicate a resistor thatis within P:Q of the specified resistance value.
The power rating indicates how much power the resistor can safely tolerate. Rust lie youwouldnIt use a ? volt flashlight lamp to replace a burned out light in your house, you
wouldnIt use a 0;& watt resistor when you should be using a 0;1 watt resistor.
The maximum rated power of the resistor is specified in 'atts.
ower is calculated using the sGuare of the current 8 1 9 x the resistance value 8 ! 9 of the
resistor. f the maximum rating of the resistor is exceeded, it will become extremely hot,and even burn. !esistors in electronic circuits are typicaly rated 0;&', 0;3', and 0;1'.0;&' is almost always used in signal circuit applications.
'hen powering a light emitting diode, a comparatively large current flows through the
resistor, so you need to consider the power rating of the resistor you choose.
13
-
8/18/2019 Gyan Future 1
14/49
,ig. 3.- &iagra% of 0esistor
3.1. "icrocontroller 'A/%ega(
3.1..1 ,eat!res
0. 3.%D to :.:D (perating !ange
1. Eully tatic (peration@ % Hz to ** "Hz
*. Three-level rogram "emory 5oc
3. 1:? x &-bit nternal !A"
:. *1 rogrammable ;( 5ines
?. Three 0?-bit Timer;6ounters
C. #ight nterrupt ources
&. Eull /uplex FA!T erial 6hannel
-
8/18/2019 Gyan Future 1
15/49
The AT&
-
8/18/2019 Gyan Future 1
16/49
,ig. 3.- Pin Config!ration
Pin &escription
CC- in 3% provides supply voltage to the chip. The voltage source is B :D.
16
-
8/18/2019 Gyan Future 1
17/49
6&- in 1% provides ground.
Port 7- ort % is an &-bit open drain bidirectional ;( port. As an output port, each pin can
sin eight TT5 inputs. 'hen 0s are written to port % pins, the pins can be used as high
impedance inputs.
ort % can also be configured to be the multiplexed low order address;data bus during
accesses to external program and data memory. n this mode, % has internal pull ups.
ort % also receives the code bytes during Elash programming and outputs the code bytesduring program verification. #xternal pull ups are reGuired during program verification.
Port 1- ort 0 is an &-bit bidirectional ;( port with internal pull ups. The ort 0 output buffers can sin;source four TT5 inputs. 'hen 0s are written to ort 0 pins, they are
pulled high by the internal pull ups and can be used as inputs. As inputs, ort 0 pins that
are externally being pulled low will source current 859 because of the internal pull ups.
n addition, 0.% and 0.0 can be configured to be the timer;counter 1 external count
input 80.%;T19 and the timer;counter 1 trigger input 80.0;T1#=9, respectively, as shownin the following table. ort 0 also receives the low-order address bytes during Elash
programming and verification.
/able 1- PI6 Port 1 &escription
Port 2- ort 1 is an &-bit bidirectional ;( port with internal pull ups. The ort 1 output
buffers can sin;source four TT5 inputs. 'hen 0s are written to ort 1 pins, they are
pulled high by the internal pull-ups and can be used as inputs. As inputs, ort 1 pins thatare externally being pulled low will source current 859 because of the internal pull-ups.
ort 1 emits the high-order address byte during fetches from external program memoryand during accesses to external data memory that uses 0?-bit addresses 8"(D= S
/T!9. n this application, ort 1 uses strong internal pull-ups when emitting 0s. /uring
17
-
8/18/2019 Gyan Future 1
18/49
accesses to external data memory that uses &-bit addresses 8"(D= S !9, ort 1 emits
the contents of the 1 pecial Eunction !egister.
ort 1 also receives the high-order address bits and some control signals during Elash
programming and verification.
Port 3- ort * is an &-bit bidirectional ;( port with internal pull-ups. The ort * output
buffers can sin;source four TT5 inputs. 'hen 0s are written to ort * pins, they are
pulled high by the internal pull-ups and can be used as inputs. As inputs, ort * pins thatare externally being pulled low will source current 859 because of the pull-ups.
ort * also serves the functions of various special features of the AT&
-
8/18/2019 Gyan Future 1
19/49
A#$8P0O-
Address 5atch #nable 8A5#9 is an output pulse for latching the low byte of the addressduring accesses to external memory. This pin is also the program pulse input 8!($9
during flash programming.
n normal operation, A5# is emitted at a constant rate of 0;? the oscillator freGuency and
may be used for external timing or clocing purposes. )ote, however, that one A5# pulse
is sipped during each access to external data memory.
f desired, A5# operation can be disabled by setting bit % of E! location H. 'ith the
bit set, A5# is active only during a "(D= or "(D6 instruction. (therwise, the pin is
wealy pulled high. etting the A5#-disable bit has no effect if the microcontroller is inexternal execution mode.
P$6-
rogram tore #nable 8#)9 is the read strobe to external program memory. 'hen the
AT&
-
8/18/2019 Gyan Future 1
20/49
A map of the on-chip memory area called the pecial Eunction !egister 8E!9 space is
shown in Table 0. )ote that not all of the addresses are occupied, and unoccupied
addresses may not be implemented on the chip. !ead accesses to these addresses will ingeneral return random data, and write accesses will have an indeterminate effect.
Fser software should not write 0s to these unlisted locations, since they may be used in
future products to invoe new features. n that case, the reset or inactive values of the new bits will always be %.
/i%er 2 0egisters- 6ontrol and status bits are contained in registers T16() 8shown inTable 19 and T1"(/ 8shown in Table *9 for Timer 1. The register pair 8!6A1H,
!6A159 is the 6apture;!eload registers for Timer 1 in 0?-bit capture mode or 0?-bit
auto-reload mode.
Interr!pt 0egisters- The individual interrupt enable bits are in the # register. Two
priorities can be set for each of the six interrupt sources in the register.
&!al &ata Pointer 0egisters- To facilitate accessing both internal and external datamemory, two bans of 0?-bit /ata ointer !egisters are provided@ /% at E! address
locations &1H-&*H and /0 at &3H-&:H. +it / N % in E! AF=!0 selects /% and
/ N 0 selects /0. The user should always initialize the / bit to the appropriatevalue before accessing the respective /ata ointer !egister.
Power Off ,lag- The ower (ff Elag 8(E9 is located at bit 3 86().39 in the 6()E!. (E is set to 0U during power up. t can be set and rest under software control and
is not affected by reset.
"e%or) Organi:ation
"6-:0 devices have a separate address space for rogram and /ata "emory. Fp to ?3O
bytes each of external rogram and /ata "emory can be addressed.
Progra% "e%or)
f the #A pin is connected to $)/, all program fetches are directed to external memory.(n the AT&
-
8/18/2019 Gyan Future 1
21/49
through 0EEEH are directed to internal memory and fetches to addresses 1%%%H through
EEEEH are to external memory.
&ata "e%or)
The AT&
-
8/18/2019 Gyan Future 1
22/49
Timer 0 is also 0? bits and its 0?-bit register is split into two bytes, referred to as T50
8Timer 0 low byte 9 and TH0 8 Timer 0 high byte9. These registers are accessible in the
same way as the registers of Timer %.
/i%er 2
Timer 1 is a 0?-bit Timer;6ounter that can operate as either a timer or an event counter.
The type of operation is selected by bit 6;T1 in the E! T16() 8shown in Table 19.
Timer 1 has three operating modes@ capture, auto-reload 8up or down counting9, and baudrate generator. The modes are selected by bits in T16(), as shown in Table *. Timer 1
consists of two &-bit registers, TH1 and T51. n the Timer function, the T51 register is
incremented every machine cycle. ince a machine cycle consists of 01 oscillator periods,
the count rate is 0;01 of the oscillator freGuency.
n the 6ounter function, the register is incremented in esponse to a 0-to-% transition at its
corresponding external input pin, T1. n this function, the external input is sampled during
:1 of every machine cycle. 'hen the samples show a high in one cycle and a low in
the next cycle, the count is incremented. The new count value appears in the register during *0 of the cycle following the one in which the transition was detected. ince
two machine cycles 813 oscillator periods9 are reGuired to recognize a 0-to-% transition,the maximum count rate is 0;13 of the oscillator freGuency. To ensure that a given level is
sampled at least once before it changes, the level should be held for at least one full
machine cycle.
Capt!re "ode
n the capture mode, two options are selected by bit #=#)1 in T16(). f #=#)1 N %,
Timer 1 is a 0?-bit timer or counter which upon overflow sets bit TE1 in T16(). This bit
can then be used to generate an interrupt. f #=#)1 N 0, Timer 1 performs the sameoperation, but a 0- to-% transition at external input T1#= also causes the current value in
TH1 and T51 to be captured into !6A1H and !6A15, respectively. n addition, the
transition at T1#= causes bit #=E1 in T16() to be set. The #=E1 bit, lie TE1, cangenerate an interrupt. The capture mode is illustrated in Eigure :.
A!to;reload '
-
8/18/2019 Gyan Future 1
23/49
Timer 1 can be programmed to count up or down when configured in its 0?-bit auto-
reload mode. This feature is invoed by the /6#) 8/own 6ounter #nable9 bit located in
the E! T1"(/ 8see Table 39. Fpon reset, the /6#) bit is set to % so that timer 1 willdefault to count up. 'hen /6#) is set, Timer 1 can count up or down, depending on the
value of the T1#= pin.
23
-
8/18/2019 Gyan Future 1
24/49
,ig. 3.- =loc+ &iagra% of "icrocontroller
24
-
8/18/2019 Gyan Future 1
25/49
3.1. &iode
A diode is a semiconductor device which allows current to flow through it in only one
direction. Although a transistor is also a semiconductor device, it does not operate the
way a diode does. A diode is specifically made to allow current to flow through it in onlyone direction.
ome ways in which the diode can be used are listed here.
0. A diode can be used as a rectifier that converts A6 8Alternating 6urrent9 to /68/irect 6urrent9 for a power supply device.
1. /iodes can be used to separate the signal from radio freGuencies.
*. /iodes can be used as an on;off switch that controls current.
This symbol is used to indicate a diode in a circuit diagram. The meaning of the
symbol is 8Anode9 86athode9. 6urrent flows from the anode side to the cathode side.
Although all diodes operate with the same general principle, there are different types
suited to different applications. Eor example, the following devices are best used for theapplications noted.
3.1..1 /)pes of &iodes
3.1..1.1 oltage reg!lation diode '>ener &iode(
The circuit symbol is . t is used to regulate voltage, by taing advantage of the fact
that Wener diodes tend to stabilize at a certain voltage when that voltage is applied in the
opposite direction.
3.1..1.2 #ight e%itting diode
The circuit symbol is . This type of diode emits light when current flows through itin the forward direction. 8Eorward biased.9
3.1..1.3 ariable capacitance diode
25
-
8/18/2019 Gyan Future 1
26/49
The circuit symbol is . The current does not flow when applying the voltage of the
opposite direction to the diode. n this condition, the diode has a capacitance lie thecapacitor. t is a very small capacitance. The capacitance of the diode changes when
changing voltage. 'ith the change of this capacitance, the freGuency of the oscillator can
be changed.
,ig. 3.?- /)pes of &iode
3.1. /ransistor
The transistorIs finction is to amplify an electric current. "any different inds of transistors are used in analog circuits, for different reasons. This is not the case for digital
circuits. n a digital circuit, only two values matter2 on or off. The amplification abilitiy of a transistor is not relevant in a digital circuit. n many cases, a circuit is built withintegrated circuits86s9. Transistors are often
used in digital circuits as buffers to protect 6s.
Eor example, when powering an electromagneticswitch 8called a IrelayI9, or when controlling a light
emitting diode. 8n my case.9 Two different symbols
are used for the transistor. ) type and
)) type
,ig. 3.17- /ransistor
26
-
8/18/2019 Gyan Future 1
27/49
3.1.? 0ela)
The relay taes advantage of the fact that when electricity flows through a coil, it
becomes an electromagnet. The electromagnetic coil attracts a steel plate, which isattached to a switch. o the switchIs motion 8() and (EE9 is controled by the currentflowing to the coil, or not, respectively.
A very useful feature of a relay is that it can be used to electrically isolate different parts
of a circuit. t will allow a low voltage circuit 8e.g. :D/69 to switch the power in a highvoltage circuit 8e.g. 0%% DA6 or more9.
The relay operates mechanically, so it can not operate at high speed. There are many indof relays. ou can select one according to your needs. The various things to consider when selecting a relay are its size, voltage and current capacity of the contact points,
drive voltage, impedance, number of contacts, resistance of the contacts, etc. The
resistance voltage of the contacts is the maximum voltage that can be conducted at the point of contact in the switch. 'hen the maximum is exceeded, the contacts will spar
and melt, sometimes fusing together. The relay will fail. The value is printed on the relay.
(n the left in the photograph is a small relay with a coil driving voltage of 01 D/6. t has
two electrically independant points of contact 8switches.9 Although the resistance and
permissible voltage and current at the point of contact are indistinct, thin that it willhandle several hundred mA.
The relay on the right in the photograph can be used to control a 0%% DA6 system. tsdriving voltage is * D/6, and if it is used to control an A6 system, the maximum
resistance voltage is 01: DA6, and the permissible current limit is 0A. f it is used tocontrol a /6 system, the maximum resistance voltage is /6*%D, and the permissiblecurrent limit is 1A. t has one contact only.
+oth types of relay can be mounted on the '+2 the spacing of the component leads is a
multiple of %.0 inches. t can also be mounted on the universal '+.
The physical dimensions of the relay on the left are width 0
-
8/18/2019 Gyan Future 1
28/49
,ig. 3.17- 0ela)
3.17 Oscillator
=TA50 and =TA51 are
the input and output,
respectively, of an inverting
amplifier that can beconfigured for use as an on-
chip oscillator, as shown in Eigure 00. #ither a Guartz crystal or ceramic resonator may be
used. To drive the device from an external cloc source, =TA51 should be leftunconnected while =TA50 is driven, as shown in Eigure 01. There are no reGuirements
on the duty cycle of the external cloc signal, since the input to the internal clocing
circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage highand low time specifications must be observed. (scillator connections
)ote@ 60, 61 N *% pE P 0% pE for 6rystals
N 3% pE P 0% pE for 6eramic !esonators
Idle "ode
n idle mode, the 6F puts itself to sleep while all the on chip peripherals remain active.
The mode is invoed by software. The content of the on-chip !A" and all the specialfunctions registers remain unchanged during this mode. The idle mode can be terminated
by any enabled interrupt or by a hardware reset. )ote that when idle mode is terminated
by a hardware reset, the device normally resumes program execution from where it leftoff, up to two machine cycles before the internal reset algorithm taes control. (n-chip
28
-
8/18/2019 Gyan Future 1
29/49
hardware inhibits access to internal !A" in this event, but access to the port pins is not
inhibited. To eliminate the possibility of an unexpected write to a port pin when idle mode
is terminated by a reset, the instruction following the one that invoes idle mode shouldnot write to a port pin or to external memory.
Power;down "ode
n the ower-down mode, the oscillator is stopped, and the instruction that invoes
ower-down is the last instruction executed. The on-chip !A" and pecial Eunction!egisters retain their values until the ower-down mode is terminated. #xit from ower-
down mode can be initiated either by a hardware reset or by an enabled external interrupt.
!eset redefines the E!s but does not change the on-chip !A". The reset should not beactivated before D66 is restored to its normal operating level and must be held active
long enough to allow the oscillator to restart and stabilize. tatus of #xternal ins during
dle and ower-down "odes
/able 4- Oscillator Power &own "ode
3.1.11 oltage 0eg!lator
C&%: is a voltage regulator integrated circuit. t is a member of C&xx series of fixed linear
voltage regulator 6s. The voltage source in a circuit may have fluctuations and would notgive the fixed voltage output. The voltage regulator 6 maintains the output voltage at a
constant value. The xx in C&xx indicates the fixed output voltage it is designed to provide.
C&%: provides B:D regulated power supply. 6apacitors of suitable values can beconnected at input and output pins depending upon the respective voltage levels.
29
-
8/18/2019 Gyan Future 1
30/49
,ig. 3.11- oltage 0eg!lator 75 ,ig. 3.12- Pin diagra% of oltage
reg!lator 75
30
-
8/18/2019 Gyan Future 1
31/49
4.1 Concept of $%bedded C
4.1.1 Introd!ction
An embedded system is some combination of computer hardware and software, either
fixed in capability or programmable, that is specifically designed for a particular function.
ndustrial machines, automobiles, medical eGuipment, cameras, household appliances,
airplanes, vending machines and toys 8as well as the more obvious cellular phone and/A9 are among the myriad possible hosts of an embedded system. #mbedded systems
that are programmable are provided with programming interfaces, and embedded systems
programming is a specialized occupation.
6ertain operating systems or language platforms are tailored for the embedded maret,
such as #mbedded Rava and 'indows = #mbedded. However, some lowend consumer
products use very inexpensive microprocessors and limited storage, with the applicationand operating system both part of a single program. The program is written permanently
into the systemIs memory in this case, rather than being loaded into !A" 8random accessmemory9 lie programs on a personal computer.
"ost 6 programmers are spoiled because they program in environments where not only is
there a standard library implementation, but there are freGuently a number of other libraries available for use. The cold fact is, that in embedded systems, there rarely are
many of the libraries that programmers have grown used to, but occasionally an
embedded system might not have a complete standard library, if there is a standard libraryat all. Eew embedded systems have capability for dynamic lining, so if standard library
functions are to be available at all, they often need to be directly lined into theexecutable. (ftentimes, because of space concerns, it is not possible to lin in an entirelibrary file, and programmers are often forced to Kbrew their ownK standard c library
implementations if they want to use them at all. 'hile some libraries are buly and not
well suited for use on microcontrollers, many development systems still include the
standard libraries which are the most common for 6 programmers.
6 remains a very popular language for microcontroller developers due to the codeefficiency and reduced overhead and development time. 6 offers lowlevel control and is
considered more readable than assembly. "any free 6 compilers are available for a wide
variety of development platforms. The compilers are part of an /#s with 6/ support, breapoints, single-stepping and an assembly window. The performance of 6 compilers
has improved considerably in recent years, and they are claimed to be more or less as
good as assembly, depending on who you as. "ost tools now offer options for
customizing the compiler optimization. Additionally, using 6 increases portability, since6 code can be compiled for different types of processors.
31
-
8/18/2019 Gyan Future 1
32/49
4.1.2 Concept of $%bedded )ste%s in @C
An embedded system is a system that connects preprogrammed software on a controller
embedded in the computer hardware. The software is installed on the controller, the brains of the electronic device. #ach embedded system is used for one specific function.
A complex device lie a /A or smart phone may have embedded devices that cancontrol several functions. However, embedded systems are not as complex or
programmable as a personal computer. 6 is one of the most commonly used programming
languages in embedded devices. #mbedded systems are used to control electronic devices
such as /D/ players, cell phones, watches and medical devices. Dideo cards and networ switches are embedded systems used in computer peripherals. The cruise control and anti-
loc braes in a car are also embedded systems. #mbedded systems are cheaper than
complex processors due to their simplicity and freGuent mass production. oftwarewritten in a language lie 6 is used to control the mechanical devices within the
embedded system.
Reasons C is Common in Embedded Systems
6 is one of the most commonly used software languages used on embedded device
controllers. (ne reason is because it is one of the few software languages that operates on
both & bit controllers and ?3 bit 6s, meaning that many computer programmers can
write 6 software for both personal computers and embedded devices. The 6 language canalso use very simple commands to control the device, freeing up the limited memory of
the device to hold many commands or parameters. 6 can be written for both
microcontrollers and digital signal processors.
C Languages Used in Embedded Systems
6 and 6XX are used freGuently in creation of embedded systems. #mbedded systems are
rarely programmed using the 6BB because embedded systems rarely have the memory
space for the complex programming used in 6BB. 6V is occasionally used on embedded5inux systems.
How C Programs Are Created and Installed on Embedded Systems
6ode is written in 6 on a programmerIs 6. 6ode is run through a compiler on the
programmerIs 6 to create a software program. The embedded system software may berun through a simulator on the programmerIs computer. The software program is copied
onto the controller using a Kprogrammer.K The controller is then tested on a Ktest bedK toensure that it wors properly.
32
-
8/18/2019 Gyan Future 1
33/49
Common Embedded Systems that Use C
+luetooth devices are programmed in 6. 6 microcontrollers such as those used in web
cameras are freGuently programmed in 6. 6 microcontrollers programmed in 6 havealso been used in 5#/ 8light emitting diodes9 devices and 56/ 8liGuid crystal display9
monitors. F+ devices are embedded devices freGuently coded in 6.
Standards or Embedded System Programming in C
The American )ational tandards nstitute 8A)9 has written standards for the 6
programming language. The nternational tandards (rganization wrote standard
(;#6
-
8/18/2019 Gyan Future 1
34/49
!rying to "onne"t to AVR Studio #
ress 0$$/ button on AD! board and clic connect as shown below.
34
-
8/18/2019 Gyan Future 1
35/49
Conne"tion established with AVR studio #
35
-
8/18/2019 Gyan Future 1
36/49
36
-
8/18/2019 Gyan Future 1
37/49
Programming the AVR
AVR Studio # Sotware $ersion
37
-
8/18/2019 Gyan Future 1
38/49
6lose the programmer screen 8not the /#9 and clic 0$$/ button on the board to start
executing your program 8few seconds delay9.
CO6C#
-
8/18/2019 Gyan Future 1
39/49
Traffic control system was developed where the traffic load is continuously measured by
sensors connected to a microcontroller based system which also performs all intersection.
6ontrol function, intersection controller of an area are interconnected with acommunication networ through which traffic load and synchronization information is
exchanged.
As a result, the duration and relative phases of each traffic light cycle change
dynamically. Eor this basic function of the system only the intersection controller are
reGuired.
39
-
8/18/2019 Gyan Future 1
40/49
,
-
8/18/2019 Gyan Future 1
41/49
0$,$0$6C$
0. Ali, AT, 6rosta, /A, Allsop, !#, Heydecer, +$, !obertson, / and Dincencio-ilva,"-A 80
-
8/18/2019 Gyan Future 1
42/49
03. $azis, /6 and otts, !+ 80
-
8/18/2019 Gyan Future 1
43/49
1&. 5o, HO and 6how, HE 81%%*9 Adaptive traffic control@ control strategy, prediction
resolution, and accuracy. Journal of Ad#anced Transportation, 38*9, *1*-3C.
1
-
8/18/2019 Gyan Future 1
44/49
30. 'ebster, ED 80
-
8/18/2019 Gyan Future 1
45/49
\
nt i,a2
T! AN%]%02
T! +N%]%%2
T! 6N%]%%2
T! /N%]%%2
'hile809
\
aN%]:%2
(!T +N%]062
(!T 6N%]002
Eor\iN%2ZN032iBB ̂
\
(!T /Na2
aNa--2
/elay_ms80%%92
f\aNN%]1E``aNN%]0E``aNN%]%E``aNN%]*E``aNN%]3E^
\
aNa-?2
45
-
8/18/2019 Gyan Future 1
46/49
^
^
(!T +N%]032
(!T 6N%]002
Eor\iN032iZN3
-
8/18/2019 Gyan Future 1
47/49
(!T /Na2
aNa--2
delay_ms80%%92
f\aNN%]1E``aNN%]0E``aNN%]%E``aNN%]*E``aNN%]3E^
\
aNa-?2
^
^
aN%]:%2
(!T +N%]602
(!T 6N%]002
Eor\iN%2iZN032iBB^
\
(!T /Na2
aNa--2
delay_ms80%%92
f\aNN%]1E``aNN%]0E``aNN%]%E``aNN%]*E``aNN%]3E^
\
aNa-?2
47
-
8/18/2019 Gyan Future 1
48/49
^
^
(!T +N%]302
(!T 6N%]002
Eor\iN032iZN3
-
8/18/2019 Gyan Future 1
49/49
(!T /Na2
aNa--2
delay_ms80%%92
f\aNN%]1E``aNN%]0E``aNN%]%E``aNN%]*E``aNN%]3E^
\
aNa-?2
^
^