microcontoler based traffic controler report

Upload: patelnew

Post on 02-Jun-2018

227 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    1/43

    Table of Contents

    1.Introduction

    2. Literature survey

    3.Formation of the Problem

    4.System specification

    5.Design of solution

    6.Implementation7.Results and Discussions

    8.System testing

    9.Conclusion and future scope

    10.References

    List of Figures

    Figure 2.1 A typical embedded system block diagramFigure 2.2 The structure of a GSM networkFigure 4.1: AT89C51 Pin DiagramFigure 4.2 Oscillator and timing circuitFigure 4.3 SMOD RegisterFigure 4.4 TCON RegisterFigure 4.5 TMOD RegisterFigure 4.6 IE RegisterFigure 4.7 IP Register

    Figure 4.8 PSW RegisterFigure 4.9 PORT3 Alternate UseFigure 4.10 Data framingFigure 4.11 Data transferFigure 4.12 SCON RegisterFigure 4.13 UART modes

    Figure 4.14Voltage levels for RS232 and TTL

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    2/43

    ABSTRACT

    TITLE:

    MICROCONTROLER BASED TRAFFIC LIGHT CONTROL SYSTEM

    AIM:

    The main objective of this project is to control the traffic lights based on

    the density of the vehicles.

    DESCRIPTION:

    In this system IR sensors are used to measure the density of the vehicles which

    are fixed within a fixed distance. All the sensors are interfaced with the microcontroller

    which in turn controls the traffic signal system according to density detected by the

    sensors.

    If the traffic density is high on particular side more priority is given for that side.

    The sensors continuously keep sensing density on all sides and the green signal is given

    to the side on priority basis, where the sensors detect high density. The side with next

    priority level follows the first priority level.

    By using this system traffic can be cleared without irregularities and time delays

    even though there is no traffic on the other side can be avoided.

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    3/43

    SOFTWARE:

    Embedded C.

    TOOLS USED:

    KEIL uvision2 IDE

    HARDWARE:

    1. PCB for micro controllers

    2. 8051 controller,

    3. DB9 Connectors

    4. IR sensor pairs

    5. Red, green LEDs

    6. 11.0592 MHz quartz crystal,

    7. Resistors, Capacitors

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    4/43

    BLOCK DIAGRAM

    89C51

    Stepdown

    BridgeRectifier

    FilterCircuit

    Regulator

    IR - E

    Power supply to all sections

    LCD

    - Traffic signallights

    -

    -

    Key board

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    5/43

    CHAPTER 1

    Introduction

    1.1 Overview

    The overview of this project is to implement Density based traffic controlling system using IRtechnology and 89S52 controller. 89S52 is very efficient architecture which can be used for lowend security systems and IR is widely adapted technology for communication.

    1.2Purpose

    Purpose of the current work is to study and analyse the counting and controlling system by using8051 controller.

    1.3 Scope

    Current work focuses on how to use effectively IR and 8051 controllers for digital securitysystems.

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    6/43

    CHAPTER 2

    Literature survey

    2.1 Embedded Systems

    An embedded system is a special-purpose computer system designed to perform one or a few dedicatedfunctions, often with real-time computing constraints. It is usually embedded as part of a complete deviceincluding hardware and mechanical parts. In contrast, a general-purpose computer, such as a personalcomputer, can do many different tasks depending on programming. Embedded systems control many ofthe common devices in use today.

    Since the embedded system is dedicated to specific tasks, design engineers can optimize it, reducing thesize and cost of the product, or increasing the reliability and performance. Some embedded systems aremass-produced, benefiting from economics of scale. Physically, embedded systems range from portabledevices such as digital watches and mp4 players, to large stationary installations like traffic lights, factorycontrollers, or the systems controlling nuclear power stations. Complexity varies from low, with a singlemicrocontroller chip, to very high with multiple units, peripherals and networks mounted inside a largechassis or enclosure.

    In general, "embedded system" is not an exactly defined term, as many systems have some element of programmability. For example, handheld computers share some elements with embedded systems suchas the operating systems and microprocessors which power them but are not truly embedded systems,

    because they allow different applications to be loaded and peripherals to be connected

    2.2 Characteristics

    1. Embedded systems are designed to do some specific task, rather than be a general-purposecomputer for multiple tasks. Some also have real-time performance constraints that must be met,for reasons such as safety and usability; others may have low or no performance requirements,allowing the system hardware to be simplified to reduce costs.

    2. Embedded systems are not always standalone devices. Many embedded systems consist of small,computerized parts within a larger device that serves a more general purpose. For example, thefeatures an embedded system for tuning the strings, but the overall purpose of the Robot Guitar is,of course, to play music. Similarly, an embedded system in automobiles provides a specificfunction as a subsystem of the car itself.

    3. The program instructions written for embedded systems are referred to as firmware, and arestored in read-only memory or flash memory chips. They run with limited computer hardwareresources: little memory, small or non-existent keyboard and/or screen.

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    7/43

    Figure 2.1 A typical embedded system block diagram

    2.3 Micro Controllers

    The micro controller, nowadays, is an indispensable device for electrical/electronic engineers

    and also for technicians in the area, because of its versatility and its enormous application. .Born

    of parallel developments in computer architecture and integrated circuit fabrication ,the

    microprocessor or computer on chip first becomes a commercial reality in 1971.with the

    introduction of the 4 bit 4004 by a small, unknown company by the name of Intel corporation.

    Other, well established, semiconductor firms soon followed Intels pioneering technology so by the late 1970s we could choose from a half dozen or so micro processor typThe 1970ssaw the growth of the number of personal computer users from a Handful of hobbyists and

    hackers to millions of business, industrial, governmental, defense, and educational and private

    users now enjoying the advantages of inexpensive computing.

    A bye product of microprocessor development was the micro controller. The same fabrication

    techniques and programming concepts that make possible general-purpose microprocessor alsoyielded the micro controller.

    Among the applications of a micro controller we can mention industrial automation,

    mobile telephones, radios, microwave ovens and VCRs. Besides, the present trend in digital

    electronics is toward restricting to micro controllers and chips that concentrate a great quantity of

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    8/43

    logical circuits, like PLDs (Programmable Logic Devices) and GALs (Gate Array Logic). In

    dedicated systems, the micro controller is the best solution, because it is cheap and easy to

    manage.

    2.6 Communication:

    Communication refers to the sending, receiving and processing of information by electric

    means. As such, it started with wire telegraphy in the early 80s, developing with telephony and radio

    some decades later. Radio communication became the most widely used and refined through the

    invention of and use of transistor, integrated circuit, and other semi-conductor devices. Most recently,

    the use of satellites and fiber optics has made communication even more wide spread, with an

    increasing emphasis on computer and other data communications.

    A modern communications system is first concerned with the sorting, processing and storing of

    information before its transmission. The actual transmission then follows, with further processing and

    the filtering of noise. Finally we have reception, which may include processing steps such as decoding,

    storage and interpretation. In this context, forms of communications include radio, telephony and

    telegraphy, broadcast, point to point and mobile communications (commercial and military), computercommunications, radar, radio telemetry and radio aids to navigation. It is also important to consider the

    human factors influencing a particular system, since they can always affect its design, planning and use.

    Wireless communication has become an important feature for commercial products and a

    popular research topic within the last ten years. There are now more mobile phone subscriptions than

    wired-line subscriptions. Lately, one area of commercial interest has been low-cost, low-power, and

    short-distance wireless communication used for personal wireless networks." Technology advancementsare providing smaller and more cost effective devices for integrating computational processing, wireless

    communication, and a host of other functionalities. These embedded communications devices will be

    integrated into applications ranging from homeland security to industry automation and monitoring.

    They will also enable custom tailored engineering solutions, creating a revolutionary way of

    disseminating and processing information. With new technologies and devices come new business

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    9/43

    activities, and the need for employees in these technological areas. Engineers who have knowledge of

    embedded systems and wireless communications will be in high demand. Unfortunately, there are few

    adorable environments available for development and classroom use, so students often do not learn

    about these technologies during hands-on lab exercises. The communication mediums were twisted

    pair, optical fiber, infrared, and generally wireless radio.

    2.7 IR Remote Theory

    The cheapest way to remotely control a device within a visible range is via Infra-Red light. Almost allaudio and video equipment can be controlled this way nowadays. Due to this wide spread use therequired components are quite cheap, thus making it ideal for us hobbyists to use IR control for our ownprojects.

    IR sensor is the combination of IR LED with PHOTO DIODE. After this combination we are connectingthe DARLINGTON PAIR TRANSISTOR. End of the IR sensor we have to connect a NOT gate for theinverting purpose means low input have corresponding low output. At last this entire connector isconnected to any one external interrupt to generating the interruption of the main program.

    Infra-Red actually is normal light with a particular colour. We humans can't see this

    colour because its wave length of 950nm is below the visible spectrum. That's one of the reasons

    why IR is chosen for remote control purposes, we want to use it but we're not interested in seeing

    it. Another reason is because IR LEDs are quite easy to make, and therefore can be very cheap.

    IR LED wave length range 1.6m to 2.4m. Materials used for IR LED are InSB, Ge,Si, GaAs, CdSe .

    These IR s are not visible range for observation purpose we have to connect LED s are not.

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    10/43

    CHAPTER 3

    Problem formulation

    The problem with the traffic system is that for every minute the vehicles at the 4-way road will be heavy and the traffic lights shall be changed to each side for some fixed time. Even thoughthere are no vehicles at particular side, the traffic signals will glow for given fixed time.Due tothat there is time waste process. Due to this other side vehicles have to wait for the time tocomplete the process. So to reduce the wastage of time, we can implement the system thatcontrols the traffic based on the heavy flow of vehicles at any particular side. With this system,we shall count the number of vehicles at each side at the junction and give th path to the

    particular side which has heavy flow of vehicles and keep remaining stop position. So that forthis to count the number of vehicles at side of the junction, we shall use IR technology.

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    11/43

    CHAPTER 4

    System Specification

    4.1 89S52 Micro Controller

    Features:

    Compatible with MCS-51 Products

    8K Bytes of In-System Programmable (ISP) Flash Memory

    Endurance: 1000 Write/Erase Cycles

    4.0V to 5.5V Operating Range

    Fully Static Operation: 0 Hz to 33 MHz

    Three-level Program Memory Lock

    256 x 8-bit Internal RAM

    32 Programmable I/O Lines

    Three 16-bit Timer/Counters

    Eight Interrupt Sources

    Full Duplex UART Serial Channel

    Low-power Idle and Power-down Modes

    Interrupt Recovery from Power-down Mode

    Watchdog Timer

    Dual Data Pointer

    Power-off Flag

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    12/43

    Description

    The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of in-

    system programmable Flash memory. The device is manufactured using Atmels high -density nonvolatile

    memory technology and is compatible with the industry- standard 80C51 instruction set and pin out.

    The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional

    nonvolatile memory programmer. By combining a versatile 8-bit CPU with in-system programmable

    Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcontroller which provides a highly-

    flexible and cost-effective solution to many embedded control applications.

    The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32

    I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, a six-vector two-level

    interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the

    AT89S52 is designed with static logic for operation down to zero frequency and supports two software

    selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters,

    serial port, and interrupt system to continue functioning. The Power-down mode saves the RAM

    contents but freezes the oscillator, disabling all other chip functions until the next interrupt or hardware

    reset.

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    13/43

    CONTRAST CONTROL:

    To have a clear view of the characters on the LCD, contrast should be adjusted. To adjust the

    contrast, the voltage should be varied. For this, a preset is used which can behave like a variable

    voltage device. As the voltage of this preset is varied, the contrast of the LCD can be adjusted.

    Potentiometer

    Variable resistors used as potentiometers have all three terminals connected.

    This arrangement is normally used to vary voltage , for example to set the switching point of a

    circuit with a sensor, or control the volume (loudness) in an amplifier circuit. If the terminals at

    the ends of the track are connected across the power supply, then the wiper terminal will provide

    a voltage which can be varied from zero up to the maximum of the supply.

    Presets

    These are miniature versions of the standard variable resistor. They are designed to be mounted

    directly onto the circuit board and adjusted only when the circuit is built. For example to set the

    frequency of an alarm tone or the sensitivity of a light-sensitive circuit. A small screwdriver or

    similar tool is required to adjust presets.

    Presets are much cheaper than standard variable resistors so they are sometimes used in projects

    where a standard variable resistor would normally be used.

    Multiturn presets are used where very precise adjustments must be made. The screw must be

    turned many times (10+) to move the slider from one end of the track to the other, giving very

    fine control.

    Potentiometer Symbol

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    14/43

    LCD INTERFACING WITH THE MICROCONTROLLER:

    Preset Symbol

    Vcc

    Gnd

    PRESET

    (CONTRAST CONTROL)

    Vcc FOR BACKLIGHTPURPOSE

    P2.0

    P2.1

    P2.2

    4 (RS) 1

    5 (R/W) 2

    6(EN) 3

    LCD

    Gnd

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    15/43

    Infrared LED (IR LED)

    IR sensor is the combination of IR LED with PHOTO DIODE. After this combination

    we are connecting the DARLINGTON PAIR TRANSISTOR. End of the IR sensor we have toconnect a NOT gate for the inverting purpose means low input have corresponding low

    outputInfra-Red actually is normal light with a particular colour. We humans can't see this

    colour because its wave length of 950nm is below the visible spectrum. That's one of the reasons

    why IR is chosen for remote control purposes, we want to use it but we're not interested in seeing

    it. Another reason is because IR LEDs are quite easy to make, and therefore can be very cheap.

    Although we humans can't see the Infra-Red light emitted from a remote control doesn't

    mean we can't make it visible. A video camera or digital photo camera can "see" the Infra-Red

    light as you can see in this picture. If you own a web cam, point your remote to it, press any

    button and you'll see the LED flicker. They do dozens of different jobs and are found in all kinds of

    devices. Among other things, they form the numbers on digital clocks, transmit information from

    remote controls, light up watches and tell you when your appliances are turned on. Collected

    together, they can form images on a jumbo television screen or illuminate a traffic light.

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    16/43

    FIG.3.1 IR LED USED IN REMOTE CONTROL

    DARLINGTON PAIR:

    An emitter follower offers high impedance of 500Kohms. For applications requiring still higher input

    impedance, we may use what is called Darlington in place of conventional transistor. This Darlington pair

    basically consists of two transistors cascaded in cc configuration. In the figure shown below the input

    impedance of the second transistor

    Constitutes the load impedance of the first.

    We thus conclude that in comparison with a conventional single transistor emitter follower has in higher

    current gain, higher input impedance and almost the same voltage gain lower out put impedances.

    Fig: Darlington Pair

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    17/43

    Modulation

    Modulation is the answer to make our signal stand out above the noise. With modulation wemake the IR light source blink in a particular frequency. The IR receiver will be tuned to thatfrequency, so it can ignore everything else.

    You can think of this blinking as attracting the receiver's attention. We humans also notice the blinking of yellow lights at construction sites instantly, even in bright daylight.

    In the picture above you can see a modulated signal driving the IR LED of the transmitter on theleft side. The detected signal is coming out of the receiver at the other side.

    In serial communication we usually speak of 'marks' and 'spaces'. The 'space' is the defaultsignal, which is the off state in the transmitter case. No light is emitted during the 'space' state.During the 'mark' state of the signal the IR light is pulsed on and off at a particular frequency.Frequencies between 30kHz and 60kHz are commonly used in consumer electronics.At the receiver side a 'space' is represented by a high level of the receiver's output. A 'mark' isthen automatically represented by a low level.

    Please note that the 'marks' and 'spaces' are not the 1-s and 0-s we want to transmit. The realrelationship between the 'marks' and 'spaces' and the 1-s and 0-s depends on the protocol that's

    being used. More information about that can be found on the pages that describe the protocols.

    TRANSMITTER:

    In the picture below we can see a modulated signal driving the IR LED of the transmitter

    on the left side. The detected signal is coming out of the receiver at the other side.

    :

    FIG.3.2 IR TRANSMITTER

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    18/43

    The transmitter usually is a battery powered handset. It should consume as little power as

    possible, and the IR signal should also be as strong as possible to achieve an acceptable control

    distance. Preferably it should be shock proof as well.

    Many chips are designed to be used as IR transmitters. The older chips were dedicated to

    only one of the many protocols that were invented. Nowadays very low power microcontrollers

    are used in IR transmitters for the simple reason that they are more flexible in their use. When no

    button is pressed they are in a very low power sleep mode, in which hardly any current is

    consumed. The processor when wakes up to transmit the appropriate IR command only a key is

    pressed

    FIG.3.3 TRANSISTOR CIRCUIT USED TO DRIVE IR LED

    Quartz crystals are seldom used in such handsets. They are very fragile and tend to break

    easily when the handset is dropped. Ceramic resonators are much more suitable here, because

    they can withstand larger physical shocks. The fact that they are a little less accurate is notimportant.

    The current through the LED (or LEDs) can vary from 100mA to well over 1A! In order

    to get an acceptable control distance the LED currents have to be as high as possible. A trade-off

    should be made between LED parameters, battery lifetime and maximum control distance. LED

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    19/43

    currents can be that high because the pulses driving the LEDs are very short. Average power

    dissipation of the LED should not exceed the maximum value though. You should also see to it

    that the maximum peek current for the LED is not exceeded. All these parameters can be found

    in the LED's data sheet.

    A simple transistor circuit can be used to drive the LED. A transistor with a suitable h fe

    and switching speed should be selected for this purpose. The resistor values can simply be

    calculated using Ohm's law. Remember that the nominal voltage drop over an IR LED is

    approximately 1.1V. The normal driver, described above, has one disadvantage. As the battery

    voltage drops, the current through the LED will decrease as well. This will result in a shorter

    control distance that can be covered.

    An emitter follower circuit can avoid this. The 2 diodes in series will limit the pulses on the base

    of the transistor to 1.2V. The base-emitter voltage of the transistor subtracts 0.6V from that,

    resulting in constant amplitude of 0.6V at the emitter. This constant amplitude across a constant

    resistor results in current pulses of a constant magnitude. Calculating the current through the

    LED is simply applying ohm law.

    PHOTODIODES:

    Unfortunately for us there are many more sources of Infrared light. The sun is the brightest

    source of all, but there are many others, like: light bulbs, candles, central heating system, and even our

    body radiates Infrared light. In fact everything that radiates heat, also radiates Infrared light. Therefore

    we have to take some precautions to guarantee that our IR message gets across to the receiver with out

    errors.

    Photodiodes are used for the detection of optical power (UV, Visible, and IR) and for the

    conversion of optical power to electrical power. The photodiode spectral response can be measured in X-

    ray, UV, visible, or IR. X-ray photodiodes are optimized for X-ray, gamma ray, and beta radiation

    detection.

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    20/43

    UV enhanced photodiodes are optimized for the UV and blue spectral regions, Photodiodes are a two-

    electrode, radiation-sensitive junction formed in a semiconductor material in which the reverse current

    varies with illumination. Photodiodes are used for the detection of optical power and for the conversion

    of optical power to electrical power. Photodiodes can be PN, PIN, or avalanche. PN photodiodes feature

    a two-electrode, radiation-sensitive PN junction formed in a semiconductor material in which the

    reverse current varies with illumination. PIN photodiodes are diodes with a large intrinsic region

    sandwiched between P-doped and N-doped semiconducting regions. Photons absorbed in this region

    create electron-hole pairs that are then separated by an electric field, thus generating an electric current

    in a load circuit

    REGULATED POWER SUPPLY:

    The power supplies are designed to convert high voltage AC mains electricity to a suitable low

    voltage supply for electronic circuits and other devices. A RPS (Regulated Power Supply ) is the Power

    Supply with Rectification, Filtering and Regulation being done on the AC mains to get a Regulated power

    supply for Microcontroller and for the other devices being interfaced to it.

    A power supply can by broken down into a series of blocks, each of which performs a

    particular function. A d.c power supply which maintains the output voltage constant irrespective of a.cmains fluctuations or load variations is known as Regulated D.C Power Supply

    For example a 5V regulated power supply system as shown below:

    http://photodiode.globalspec.com/Industrial-Directory/photodiodeshttp://photodiode.globalspec.com/Industrial-Directory/photodiodes
  • 8/10/2019 Microcontoler Based Traffic Controler Report

    21/43

    Transformer:

    A transformer is an electrical device which is used to convert electrical power from one

    Electrical circuit to another without change in frequency.

    Transformers convert AC electricity from one voltage to another with little loss of

    power. Transformers work only with AC and this is one of the reasons why mains electricity is

    AC. Step-up transformers increase in output voltage, step-down transformers decrease in output

    voltage. Most power supplies use a step-down transformer to reduce the dangerously high mains

    voltage to a safer low voltage. The input coil is called the primary and the output coil is called

    the secondary. There is no electrical connection between the two coils; instead they are linked by

    an alternating magnetic field created in the soft-iron core of the transformer. The two lines in the

    middle of the circuit symbol represent the core. Transformers waste very little power so the

    power out is (almost) equal to the power in. Note that as voltage is stepped down current is

    stepped up. The ratio of the number of turns on each coil, called the turns ratio, determine

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    22/43

    ratio of the voltages. A step-down transformer has a large number of turns on its primary (input)

    coil which is connected to the high voltage mains supply, and a small number of turns on its

    secondary (output) coil to give a low output voltage.

    An Electrical Transformer

    Turns ratio = Vp/ V S = Np/N S

    Power Out= Power In

    VS X I S=V P X I P

    Vp = primary (input) voltage

    Np = number of turns on primary coil

    Ip = primary (input) current

    RECTIFIER:

    A circuit which is used to convert ac to dc is known as RECTIFIER. The process of conversion ac to

    dc is called rectification

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    23/43

    TYPES OF RECTIFIERS:

    Half wave Rectifier

    Full wave Rectifier

    1. Centre tap full wave rectifier.

    2. Bridge type full bridge rectifier.

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    24/43

    Comparison of rectifier circuits:

    Parameter

    Type of Rectifier

    Half wave Full wave Bridge

    Number of diodes 1 2 4

    PIV of diodes Vm 2Vm Vm

    D.C output voltage Vm/z 2Vm/ 2Vm/

    Vdc at no-load 0.318Vm 0.636Vm 0.636Vm

    Ripple factor 1.21 0.482 0.482

    Ripple frequency f 2f 2f

    Rectification efficiency 0.406 0.812 0.812

    Transformer UtilizationFactor(TUF)

    0.287 0.693 0.812

    RMS voltage Vrms Vm/2 Vm/ 2 Vm/2

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    25/43

    Full-wave Rectifier:

    From the above comparison we came to know that full wave bridge rectifier as

    more advantages than the other two rectifiers. So, in our project we are using full wave bridge rectifier

    circuit.

    Bridge Rectifier:

    A bridge rectifier makes use of four diodes in a bridge arrangement to achieve full-

    wave rectification. This is a widely used configuration, both with individual diodes wired as

    shown and with single component bridges where the diode bridge is wired internally.

    A bridge rectifier makes use of four diodes in a bridge arrangement as shown in fig (a) to achievefull-wave rectification. This is a widely used configuration, both with individual diodes wired as shown

    and with single component bridges where the diode bridge is wired internally.

    Fig (A)

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    26/43

    Operation: During positive half cycle of secondary, the diodes D2 and D3 are in forward biased while

    D1 and D4 are in reverse biased as shown in the fig(b). The current flow direction is shown in the fig (b)

    with dotted arrows.

    Fig (B)

    During negative half cycle of secondary voltage, the diodes D1 and D4 are in forward biased

    while D2 and D3 are in reverse biased as shown in the fig(c). The current flow direction is shown in the

    fig (c) with dotted arrows.

    Fig(C)

    Filter:

    A Filter is a device which removes the ac component of rectifier output but allows the dc

    component to reach the load.

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    27/43

    Capacitor Filter:

    We have seen that the ripple content in the rectified output of half wave rectifier is 121% orthat of full-wave or bridge rectifier or bridge rectifier is 48% such high percentages of ripples is not

    acceptable for most of the applications. Ripples can be removed by one of the following methods of

    filtering.

    (a) A capacitor, in parallel to the load, provides an easier by pass for the ripples voltage though it due

    to low impedance. At ripple frequency and leave the D.C. to appear at the load.

    (b) An inductor, in series with the load, prevents the passage of the ripple current (due to high

    impedance at ripple frequency) while allowing the dc (due to low resistance to dc).

    (c) Various combinations of capacitor and inductor, such as L-section filter section filter, multiple

    section filter etc. which make use of both the properties mentioned in (a) and (b) above. Two cases of

    capacitor filter, one applied on half wave rectifier and another with full wave rectifier.

    Filtering 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 capacitor charges quickly near the peak of the varying DC, and then discharges as it suppliescurrent to the output. Filtering significantly increases the average DC voltage to almost the peak value

    (1.4 RMS value).

    To calculate the value of capacitor(C),

    C = *3*f*r*Rl Where,

    f = supply frequency,

    r = ripple factor,Rl = load resistance

    Note : In our circuit we are using 1000F hence large value of capacitor is placed to

    reduce ripples and to improve the DC component.

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    28/43

    Regulator:

    Voltage regulator ICs is available with fixed (typically 5, 12 and 15V) or variable output

    voltages. The maximum current they can pass also rates them. 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

    regulators ICs have 3 leads and look like power transistors, such as the 7805 +5V 1A regulator shown on

    the right. The LM7805 is simple to use. You simply connect the positive lead of your unregulated DC

    power supply (anything from 9VDC to 24VDC) to the Input pin, connect the negative lead to the

    Common pin and then when you turn on the power, you get a 5 volt supply from the output pin.

    Fig 6.1.6 A Three Terminal Voltage Regulator

    78XX:

    The Bay Linear LM78XX is integrated linear positive regulator with three terminals. The LM78XX

    offer several fixed output voltages making them useful in wide range of applications. When used as a

    zener diode/resistor combination replacement, the LM78XX usually results in an effective output

    impedance improvement of two orders of magnitude, lower quiescent current. The LM78XX is available

    in the TO-252, TO-220 & TO-263packages,

    Features:

    Output Current of 1.5A

    Output Voltage Tolerance of 5%

    Interna l thermal overload protection

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    29/43

    Internal Short -Circuit Limited

    Output Voltage 5.0V, 6V, 8V, 9V, 10V, 12V, 15V, 18V, 24V .

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    30/43

    CHAPTER 5

    System Design

    Designing of this system is possible when you select the specific controller to suite.For this weselected 89S52 controller.With the help of 89S52 controller traffic control system can beimplemented successfully with the help IR technology.To the controller we connected IRtransmitter and receiver circuit.Instead of IR transmitter and receiver we can go with photo diodeand photo transmitters also.Here we are using four IR pairs for each side.

    Whenever vehicles reach the junction on each side, then IR detects the vehicle by sendingsignal to controller and the controller will counts the count of vehicles. And calculate the

    mximum count from them and give the path to side which has maximum count by glowing greenLED and other three sides red LED shall be glow.

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    31/43

    5.1 Hardware Design:

    5.1.1 Schematic

    VCC

    R5R

    J3

    CON8

    12345678

    U5

    LM7805/TO

    1

    3

    2VIN

    G N D

    VOUT

    C2

    CAP

    D4DIODE

    U1

    AT89S52

    5678

    9

    1011121314151617

    18

    19

    20

    40

    3938373635343332

    31

    3029

    2827262524232221

    1234

    P1.4P1.5P1.6P1.7

    RST

    P3.0/RXDP3.1/TXDP3.2/INT0P3.3/INT1P3.4/T0P3.5/T1P3.6/WRP3.7/RD

    XTAL2

    XTAL1

    GND

    VCC

    P0.0/AD0P0.1/AD1P0.2/AD2P0.3/AD3P0.4/AD4P0.5/AD5P0.6/AD6P0.7/AD7

    EA/VPP

    ALE/PROGPSEN

    P2.7/A15P2.6/A14P2.5/A13P2.4/A12P2.3/A11P2.2/A10

    P2.1/A9P2.0/A8

    P1.0P1.1P1.2P1.3

    SW1

    J2

    CON8

    12345678

    C5

    CAP

    VCC

    J4

    CON8

    12345678

    D1DIODE

    R4R

    J3

    LCD

    1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6

    g n d

    v c c

    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

    C4

    CAP

    C1C

    P2

    CONNECTOR DB9

    594837261

    C6

    CAP

    VCC

    RXD

    R6

    POT

    J2

    CON8

    12345678

    D6DIODE

    TXD

    TXD

    C7CAP

    U6t/f (4pin)

    1 2

    3 4

    1 2

    3 4

    C3

    CAP

    D2DIODE

    A

    1 1Thursday, July 15, 2010

    Title

    Size Document Number Rev

    Date: Sheet of

    Y1CRYSTAL

    D5LED

    RXD

    J7

    CON2

    1 2

    +5V

    C9

    C

    = 1000UF/25V

    U3

    MAX232

    13

    45

    2

    6

    12

    9

    11

    10

    13

    8

    14

    7

    C1+C1-

    C2+C2-

    V+

    V-

    R1OUT

    R2OUT

    T1IN

    T2IN

    R1IN

    R2IN

    T1OUT

    T2OUT

    C8104

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    32/43

    5.1.2. Schematic Description

    The main aim of this power supply is to convert the 230V AC into 5V DC in order to give supply

    for the TTL. 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.

    Let us see the pin connections of each and every device with the microcontroller in detail.

    Power Supply:

    In this process we are using a step down transformer, a bridge rectifier, a smoothing circuit and

    the RPS.

    At the primary of the transformer we are giving the 230V AC supply. The secondary is connected

    to the opposite terminals of the Bridge rectifier as the input. From other set of opposite terminals we

    are taking the output to the rectifier.

    The bridge rectifier converts the AC coming from the secondary of the transformer into

    pulsating DC. The output of this rectifier is further given to the smoother circuit which is capacitor in our

    project. The smoothing circuit eliminates the ripples from the pulsating DC and gives the pure DC to the

    RPS to get a constant output DC voltage. The RPS regulates the voltage as per our requirement.

    Microcontroller:

    The microcontroller AT89S52 with Pull up resistors at Port0 and crystal oscillator of 11.0592MHz crystal in conjunction with couple of capacitors of is placed at 18 th & 19 th pins of 89S51 to make it

    work (execute) properly.

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    33/43

    IR Module:

    The IR transmitter and receiver are input and output devices. This is connected to the port P2 of

    the Microcontroller.

    LCD:

    The LCD data lines are connected to port 0 of the microcontroller in the schematic and the

    control signals like RS, EN are connected to pin2,3 of port 1.

    LEDs :

    Here the LEDs are connected to one of microcontroller port by using resistor.

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    34/43

    5.2.SOFTWARE Components

    5.2.1. ABOUT SOFTWARE

    Software used is:

    *Keil software for C programming

    *Express PCB for lay out design

    *Express SCH for schematic design

    KEIL Vision3

    Vision3 is an IDE (Integrated Development Environment) that helps you write, compile, and

    debug embedded programs. It encapsulates the following components:

    A project manager.

    A make facility.

    Tool configuration.

    Editor.

    A powerful debugger.

    This software is used for execution of microcontroller programs.

    Keil development tools for the MC architecture support every level of software developer from

    the professional applications engineer to the student just learning about embedded software

    development.

    The industry-standard keil C compilers, macro assemblers, debuggers,real, time Kernels, Single-board

    computers and emulators support all avr derive--atives and help you to get more projects completed on

    schedule. The keil software development tools are designed to solve the complex problems facing

    embedded software developers.

    When starting a new project, simply select the microcontroller you the device database and

    the vision IDE sets all compiler, assembler, linker, and memory options for you.

    Numerous example programs are included to help you get started with the most popular

    embedded avr devices.

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    35/43

    The keil Vision debugger accurately simulates on-chip peripherals(PC, CAN, UART,

    SPI,Interrupts,I/O ports, A/D converter, D/A converter and PWM modules)of your avr device. Simulation

    helps you understand h/w configurations and avoids time wasted on setup problems. Additionally,

    with simulation, you can write and test applications before target h/w is available.

    When you are ready to begin testing your s/w application with target h/w, use the MON51,

    MON390, MONADI, or flash MON51 target monitors, the ISD51 In-System Debugger, or the ULINK USB-

    JTAG adapter to download and test program code on your target system.

    Express PCB Express PCB is a Circuit Design Software and PCB manufacturing service. One can learn

    almost everything you need to know about Express PCB from the help topics included with the programs

    given.

    Details: Express PCB, Version 5.6.0

    Express SCH The Express SCH schematic design program is very easy to use. This software enables

    the user to draw the Schematics with drag and drop options. A Quick Start Guide is provided by which

    the user can learn how to use it.

    Details: Express SCH, Version 5.6.0

    EMBEDDED C: The programming Language used here in this project is an Embedded C Language. This

    Embedded C Language is different from the generic C language in few things like

    a) Data types

    b) Access over the architecture addresses.

    The Embedded C Programming Language forms the user friendly language with access over Port

    addresses, SFR Register addresses etc.

    Signed char:

    o Used to represent the or + values.

    o As a result, we have only 7 bits for the magnitude of the signed number, giving us values from -

    128 to +127.

    Embedded C Data types:

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    36/43

    Data Types Size in Bits Data Range/Usage

    unsigned char 8-bit 0-255

    signed char 8-bit -128 to +127

    unsigned int 16-bit 0 to 65535

    signed int 16-bit -32,768 to +32,767

    sbit 1-bit SFR bit addressable only

    Bit 1-bit RAM bit addressable only

    sfr 8-bit RAM addresses 80-FFH only

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    37/43

    CHAPTER 6

    Implementation

    The applications as discussed in the design are implemented and the source code related to thecurrent work is pasted in the appendix.

    SOFTWARE

    Vision3

    Vision3 is an IDE (Integrated Development Environment) that helps you write, compile, and debug

    embedded programs. It encapsulates the following components:

    A project manager.

    A make facility.

    Tool configuration.

    Editor.

    A powerful debugger.

    To help you get started, several example programs (located in the \C51\Examples , \C251\Examples ,

    \C166\Examples , and \ARM\...\Examples ) are provided.

    HELLO is a simple program that prints the string "Hello World" using the Serial Interface.

    Building an Application in Vision2:

    To build (compile, assemble, and link) an application in Vision2, you must:

    1. Select Project - (for example, 166\EXAMPLES\HELLO\HELLO.UV2).

    2. Select Project - Rebuild all target files or Build target.

    Vision2 compiles, assembles, and links the files in your project.

    Creating Your Own Application in Vision2

    To create a new project in Vision2, you must :

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    38/43

    1. Select Project - New Project.

    2. Select a directory and enter the name of the project file.

    3. Select Project - Select Device and select an 8051, 251, or C16x/ST10 device from the Device

    Database.

    4. Create source files to add to the project.

    5. Select Project - Targets, Groups, Files, Add/Files, select Source Group1, and add the source files

    to the project.

    6. Select Project - Options and set the tool options. Note when you select the target device from

    the Device Database all special options are set automatically. You typically only need to

    configure the memory map of your target hardware. Default memory model settings are

    optimal for most applications.

    7. Select Project - Rebuild all target files or Build target.

    Debugging an Application in Vision2

    To debug an application created using Vision2, you must:

    1. Select Debug - Start/Stop Debug Session.

    2. Use the Step toolbar buttons to single-step through your program. You may enter G, main in the

    Output Window to execute to the main C function.

    3. Open the Serial Window using the Serial #1 button on the toolbar.

    Debug your program using standard options like Step, Go, Break, and so on.

    Starting Vision2 and creating a Project

    Vision2 is a standard Windows application and started by clicking on the program icon. To

    create a new project file select from the Vision2 menu

    Project New Project. This opens a standard Windows dialog that asks you for the ne w project file

    name.

    We suggest that you use a separate folder for each project. You can simply use the icon Create

    New Folder in this dialog to get a new empty folder. Then select this folder and enter the file name for

    the new project, i.e. Project1.

    Vision2 creates a new project file with the name PROJECT1.UV2 which contains a default target

    and file group name. You can see these names in the Project

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    39/43

    Window Files.

    Now use from the menu Project Select Device for Target and select a CPU for your project. The

    Select Device dialog box shows the Vision2 device database. Just select the microcontroller you use.

    We are using for our examples the Philips 80C51RD+ CPU. This selection sets necessary tool options for

    the 80C51RD+ device and simplifies in this way the tool Configuration

    Building Projects and Creating a HEX Files

    Typical, the tool settings under Options Target are all you need to start a new application. You

    may translate all source files and line the application with a click on the Build Target toolbar icon. When

    you build an application with syntax errors, Vision2 will display errors and warning messages in the

    Output

    Window Build page. A double click on a message line opens the source file on the correct location in a

    Vision2 editor window.

    Once you have successfully generated your application you can start debugging.

    After you have tested your application, it is required to create an Intel HEX file to download the

    software into an EPROM programmer or simulator. Vision2 creates HEX files with each build process

    when Create HEX files under Options for Target Output is enabled. You may start your PROM

    programming utility after the make process when you specify the program under the option Run User

    Program #1.

    CPU Simulation

    Vision2 simulates up to 16 Mbytes of memory from which areas can be mapped for read,

    write, or code execution access. The Vision2 simulator traps and reports illegal memory accesses being

    done.

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    40/43

    In addition to memory mapping, the simulator also provides support for the integrated peripherals of

    the various 8051 derivatives. The on-chip peripherals of the CPU you have selected are configured from

    the Device

    Database selection

    You have made when you create your project target. Refer to page 58 for more Information

    about selecting a device. You may select and display the on-chip peripheral components using the

    Debug menu. You can also change the aspects of each peripheral using the controls in the dialog boxes.

    Start Debugging

    You start the debug mode of Vision2 with the Debug Start/Stop Debug Session command.

    Depending on the Options for Target Debug Configuration, Vision2 will load the application program

    and run the startup code Vision2 saves the editor screen layout and restores the screen layout of the

    last debug session. If the program execution stops, Vision2 opens an editor window with the source

    text or shows CPU instructions in the disassembly window. The next executable statement is marked

    with a yellow arrow. During debugging, most editor features are still available.

    For example, you can use the find command or correct program errors. Program source text of

    your application is shown in the same windows. The Vision2 debug mode differs from the edit mode in

    the following aspects:

    _ The Debug Menu and Debug Commands described on page 28 are Available. The additional debug

    windows are discussed in the following.

    _ The project structure or tool parameters cannot be modified. All build Commands are disabled.

    Disassembly Window

    The Disassembly window shows your target program as mixed source and assembly program or

    just assembly code. A trace history of previously executed instructions may be displayed with Debug

    View Trace Records. To enable the trace history, set Debug Enable/Disable Trace Recording.

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    41/43

    If you select the Disassembly Window as the active window all program step commands work on CPU

    instruction level rather than program source lines. You can select a text line and set or modify code

    breakpoints using toolbar buttons or the context menu commands.

    You may use the dialog Debug Inline Assembly to modify the CPU instructions. That allowsyou to correct mistakes or to make temporary changes to the target program you are debugging

    CHAPTER 7

    System Testing

    Density based traffic control system is a system which shall be able to count the vehiclesat each side of the junction road when vehicles are reached near to that junction. Afterconnecting the circuit and writing the code, then test it by sensing the IR sensor dated term usedto describe an opto-electronic means of sensing something, most commonly a photodetector ofsome type.The system can be tested with the use of KEIL compiler.This one we are using towrite programs for 8051 controller.After writing programs using 8051 programmer we can dumpcode in to the controller. Now develop the system by using IR transmitter and receiver, we canuse photo diode and photo transistors.To test the board,First of all write a program in terms oflike first enable LCD.To activate LCD send proper commands to it and after that configure

    baudrate,parity and number of bits for the serial port. After initializing all the devices connectedto the controller,

    While testing keep the transmitter & receiver aligned in a straight position facing each otherabout a distance more than 2 meter but not less than that.If the transmitter and receiver are not ina aligned position data communication is not possible.Connect the output of IR receiver to thecontroller port pin.If there is no intruder the output pin will show low value.If there is anyintroduce it will show high value.In program monitor for high value and when you the value ishigh sens a message to a number indicating that intruder detected.

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    42/43

    CHAPTER 8

    Results and Evaluation

    This chpater lists down the results realized from the practical work and examines whetherideas/solution approaches recommended in research are met by the practical implementation. Forthis project the main communication is by using IR technology.

  • 8/10/2019 Microcontoler Based Traffic Controler Report

    43/43

    CHAPTER 9

    Conclusion

    The controller we used having the following featurtes like 8 bit 8051 architecture in a tiny 40 pin

    DIP package,128B RAM and 4kB on-chip Flash Program Memory. For low end applications this

    controller is very easy to use and at the same time IR also widely accepted protocol for mobile

    communication.By using IR technology and 8051 architecture based microcontroller we

    implemented electronic based traffic density control system.