N.k.singh

Embed Size (px)

Citation preview

  • 8/4/2019 N.k.singh

    1/11

    MICROPROCESSEOR

    [2010]

    TOPIC:- Microprossor based traffic lightcontroller using 8085

    SUBMITTED BY:-PRAVEEN KUMARSECTION-E6803B40Reg.10809901

    SUBMITTED TO:-Er. SHEVTA SHARMA

  • 8/4/2019 N.k.singh

    2/11

    ACKNOWLEDGEMENT

    History of all great works is to witness that no great work

    has ever done with others.

    The active or passive support of a person surrounding andone close quarter. Thus it is not hard to conclude

    how active assistance from senior could positively

    impact the execution of my term paper project. I am

    highly thankful to specially our teacherEr. SHEVTA

    SHARMAfor the active guidance throughout thecompletion of project.

    Last but not least, i would like to extend my appreciation to

    those who could not be mentioned here but have

    played their role to inspire me behind the curtain.

  • 8/4/2019 N.k.singh

    3/11

    INTRODUCTION:-

    Many traffic light systemsoperate on a timingmechanism that changes thelights after a given interval. Anintelligent traffic light systemsenses the presence or absenceof vehicles and reactsaccordingly. The idea behind

    intelligent traffic systems is thatdrivers will not spendunnecessary time waiting forthe traffic lights to change. Anintelligent traffic system detectstraffic in many different waysThe older system uses weight asa triggermechanism . Current trafficsystems react to motion totrigger the light changes. Once

    the infrared object detectorpicks up the presence of a car, aswitch causes the lights tochange. In order to accomplishthis, algorithms are used togovern the actions of the trafficsystem. While there are manydifferentprogramming languages today,some programming conceptsare

    universal in Boolean Logic. Weneed to understand the functionof traffic signals so that we canimprove driving habits bycontrolling the speed in order toreduce the number of associated traffic accidents. Themore number of drivers who

    know about the operation oftraffic signals, the less

    frustrated they are going to bewhile waiting for the lights tochange. The main aim indesigning and developing of theIntelligent Traffic SignalSimulator is to reduce thewaiting time of each lane of thecars and also to maximize thetotal number of cars that cancross an intersection given themathematical function to

    calculate the waiting time. Thetraffic signal system consists ofthree important parts. The firstpart is the controller, whichrepresents the brain of thetraffic system. It consists of acomputerthat controls the selection andtiming of traffic movements inaccordance to the varyingdemands of traffic signal as

    registered to the controller unitby sensors . The second part isthe signal visualization or insimple words is signal face.Signal faces are part of a signalhead provided for controllingtraffic in a single direction andconsist of one or more signalsections. These usuallycomprise of solid red, yellow,and green lights. The third part

    is the detector or sensor. Thesensor or detector is a device toindicate the presence ofvehicles. One of thetechnologies, which are usedtoday, consists of wire loopsplaced in the pavement at

  • 8/4/2019 N.k.singh

    4/11

    intersections. They are activatedby thechange of electrical inductancecaused by a vehicle passingover or standing over the wire

    loop. Recent technologyutilization is video detection. Acamera feeds a small computerthat can "see" if a vehicle ispresent.

    AIM:The main aim of this project is todesign a Traffic light controller using8085 microprocessor.

    The 8085 Microprocessor isa popular Microprocessor used inIndustries for various applications.Such as traffic light control,temperature control, stepper motorcontrol, etc. In this project, thetraffic lights are interfaced toMicroprocessor system through buffer and ports of programmable peripheral Interface 8255. So the

    traffic lights can be automaticallyswitched ON/OFF in desiredsequence. The Interface board hasbeen designed to work with parallelport of Microprocessor system.

    The hardware of the system consistsof two parts. The first part isMicroprocessor based system with8085. Microprocessor as CPU andthe peripheral devices like EPROM,RAM, Keyboard & Display

    Controller 8279, Programmable asPeripheral Interface 8255, 26 pinparallel port connector, 21 keys Hexakey pad and six number of sevensegment LEDs.

    The second part is the traffic lightcontroller interface board, which

    consist of 36 LEDs in which 20LEDs are used for vehicle trafficand they are connected to 20 portlines of 8255 through Buffer.Remaining LEDs are used for

    pedestrian traffic. The traffic lightinterface board is connected to Mainboard using 26 core flat cables to 26- pin Port connector. The LEDs canbe switched ON/OFF in the specifiedsequence by the Microprocessor.

    Experimental setup: -

    In order to implement the IntelligentTraffic Signal Simulator, one needs tosetup and assemble the hardwarecomponents and write a program tocontrol the intelligent traffic signalsimulator. The layout of the IntelligentTraffic Signal Simulator is displayed inFigure 1. The blocks, which are labeledN1, N2, N3, E1, E2, E3, S1 and W1 are

    the infrared object detectors.

    Hardware components:-

  • 8/4/2019 N.k.singh

    5/11

    The traffic light system consists of fourimportant components: the controllerwhich is the brain to the system, thesensors which detect the presence ofvehicles, the light emitting diodes.

    (LED) which act as the actuator and thecountdown timers which is displayed inLab VIEW. BASIC STAMP 2 (BS2) isused as the microcontroller of the trafficsignal. The BS2, which needs to be plugged to the Board of Education(BoE), is directly attached to thecomputer in order to program it. Thewiring for the output and input signals isdone from this board. Figure 2 shows theBoard of Education to which a 9V DC

    power is supplied. There is also a DB9connector, that is connected to the COM port of computer using RS-232 serialcable, for BS2 programming and serialcommunication during runtime.Next to the BS2, there is a breadboard.The breadboard has many strips ofcopper, which run underneath the boardin a horizontal fashion. These stripsconnect the sockets to each other. As forthe infrared object detector, SHARPGP2D15 is used. The sensor task is todetect the presence of vehicles. It isfunctioning continuously by giving alogic 0 when there are no vehicles andlogic 1 when there are vehicles present.Therefore, they can detect the length ofthe queue depending on where they are placed. Each detector has a JSTconnector housing slot and threecrimped wires to use in the JSTconnector. The connectors are pluggedinto the appropriate housing slot and intothe detector. The light emitting diodesare used in order to show the traffic lightchanging according to the program. TheLED light will change according tooutput by the microcontroller. In eachlane, there are three LEDs according totraffic lights colors which consist of red,

    yellow and green. Moreover, twoinverters were used in order to connectthe output of green and red LEDstogether. Therefore, when the greenLED is ON then the red LED will be

    OFF and vice-versa. Figure 3 shows theconnection of the input and output portsto sensors and LEDs. The BS2microcontroller has 16 Input and Output ports. The ports were divided into 8input and 8 output ports. The output ports, which are from P0 to P7, giveeither logic 0 or 1 to the LEDs.Meanwhile, the input ports, which arefrom P8 to P15, receive input signalfrom the sensors.

    Software simulation: -

    After the hardware had been setup, a program written in the BASIC programming language in the BASICSTAMP editor is downloaded into themicrocontroller. The simulation of thealgorithm of the traffic signal systemwas done using MATLAB software.Furthermore, the countdown timer

    interfacing according to the trafficsystem using Lab VIEW software iscreated using the BNC Adapter and heData Acquisition Card (DAQ) device.The Lab VIEW programming is done inthe diagram using graphical source code.In the block diagram the program runsfrom left to right. If the green light in thetraffic model does not illuminate, thesystem goes into default since there is noinput into the system. The signal from

    the sensor is acquired through the DAQ,which is connected, to the computer.

  • 8/4/2019 N.k.singh

    6/11

    Fig. 1: Intelligent traffic signalsimulator layout

    Fig. 2: Board of Education

    Fig. 3: Connection of the input andoutput ports to

    sensors and LEDs

    Fig. 4: Traffic signal sequence

    Implementation: -

    A single 3-lamp traffic light isconsidered as a finite state machine. Ithas three states, Red, Yellow, and Green,which are also the outputs. A single

    input for the traffic light is defined, withvalues 0 for no change and 1 for change.This input is connected to the output of acountdown timer, which outputs a 1when it reaches zero. Thus for a singlelight, we can draw the state transitiondiagram as shown in Fig. 4. A singletraffic light is not very useful. In reality,lights are installed in pairs, with twopairs per intersection. Therefore, in thesimulation one pair of lights was used to

    control traffic in the north-southdirection, while the other pair controlsthe east-west direction. Furthermore, thetwo pairs of lights must be synchronized;therefore countdown timers areconnected to the lights in pairs. Since thelights that make up a pair mirror eachother, they are considered as a single

  • 8/4/2019 N.k.singh

    7/11

    light. But since the opposite pairs mustbe in sync, we must group their differentoutputs together. Thus there are 3 3 =9 possible outputs. Each combinedoutput describes the color of the north-

    south light along with the color of theeast-west light.

    In order for the Traffic Signal Simulatorto work intelligently, mathematicalfunctions that can calculate the timeneeded for the green signal to illuminate based on the length of queue aredeveloped. The length of queue isdetected through the infrared objectdetectors by the presence of vehicles.

    The timing for the green signal toilluminate is given by:

    where d is the distance between onesensor to another sensor in (m), v1 is theaverage speed of the first car movingfrom stationary at the moment the signalturned green in (m/s), aa is the averageacceleration of a car from stationary

    position to the next car position in(m/s2), vs is the average speed of a carmoving from standstill after traffic lightturns green in (m/s), z is a variable,which gives two values only: 0 whenthere is no sensor triggered and 1 if thereis at least one sensorv triggered, D12 isthe total time delay given by:D12 t1 ( nt1)t2where t1 is the value of the first timedelay in (s), nt

    equals to the number of sensorstriggered, and t2 is thesecond time delay for each lane in (s).The first step in the simulatorimplementation is to install the hardwarecomponents. The connection of the BS2,infrared object detector, light emittingdiode (LED), AND gate and inverter

    gate should be wired correctly. Then theprogram codes that had been developedsimultaneously are downloaded to theBS2. In each lane, three infrared objectdetectors have

    installed. Therefore, the program willcheck first the condition of the sensors,whether they are triggered

    Fig. 5: Front panel of counters

    Fig. 6: Default situation

  • 8/4/2019 N.k.singh

    8/11

    Fig. 7: Situation where only 1 sensor istriggered

    or not. The total number of sensorstriggered will be used in the

    mathematical function to calculate theappropriate timing for the green signal toilluminate. After the green signalfinishes the illumination timing, theyellow signal will illuminate for 2seconds and then finally the red signalwill illuminate. After that, the trafficsignal will wait for 1 second before itgoes to the next lane condition

    DIAGRAM:-

    8085CPU

    Latch 8255PPI

    26pinportconn

    ector

    26pinportconn

    ector

    Buffer

    AD0-AD

    7

    A0-A

    7

    26 pinFRCcable

    D0

    -D7

    SystemBus

    EPROM

    RAM

    8279keyboar

    dDisplayControll

    er

    Anodedriver

    DecoderKeyboard Cathode

    Display

    StopPW

    StopPW

    Stop PN Stop PNStopPE

    StopPE

    GoPW

    Stop PS

    Go PS

    Stop PS

    Go PS

    GoPE

    GoPW

    Go PN Go PN GoPE

    NORTH

    SOUTH

    EAST

    WEST

    StopW

    WarningW

    GoW

    FRW

    FLW

    STW

    Stop NWarning N

    Go NFR N

    FL NST N

    Stop S

    Warning SGo S

    FR SST SFL S

    StopE

    War

    ningE

    FRE

    FLE

    STE

  • 8/4/2019 N.k.singh

    9/11

    Requirement:-

    Design a traffic light sequence simulatorusing the MC68HC11 microcontrollerand glue logic on your FPGA board. Thetraffic lights are to be built with coloredLEDs. Light patterns and delay times areto be read from a table, while the outputis to be sent tosix LEDs by the:a) Parallel I/O Port Bb) Serial Peripheral Interface (SPI)

    Types of System:-

    The different types of system used forsolving traffic congestion problems are:1. Fuzzy Expert System2. Artificial Neural Network3. An Intelligence Decision-makingsystem for Urban Traffic-Control(IDUTC)

    Discussion:-

    Microcontrollers are often used forlogic-timer control. A traffic lightcontroller is asimple example. The light patterns are

    flashed on for a specified time using theparallel or serial port. The time delayscan be generated using either software(delay loops) or hardware (timerfacilities). For this particular example,the software method is quiteappropriate. During lunchtime, there has been excessive congestion in front of

    Platt Dining Hall. Students headed northand south bound in front of Platt havenearly collided withunicyclists headedeast or west reading books or jugglingswords. No serious injuries have yet

    occurred, but parents have been callingthe President demanding action. He hasdirected Physical Plant to install asystem of traffic lights at the intersectioncontrollingeast/west traffic and north/south traffic.1Lights A control east/west traffic whilelights B control north/south traffic.

    Microprocessor-Based

    Systems ;-

    Your controller should be built with asequence descriptor and an interpreter.In this waythe control sequence may be changed atany time to better accommodate trafficconditions.The sequence descriptor is an entry in atable containing the light pattern andduration. In order to have a variable

    length table, a null entry (pattern of 0and duration of 0 sec) can be designatedas the end of the table, for this will neverbe part of the sequence.The interpreter is a program that readsvalues from the sequence descriptortable. The interpreter sends light patternsfor the specified durations. Theinterpreter should have a delaysubroutine to waste exactly 1 second.The delay time read from the table is

    used to count out the number of timesthe 1 second delay subroutine isexecuted. Your delays should meet a +/-5% tolerance.For the experiment, the followingsequence descriptor is suggested:PatternNorth-South East-West

  • 8/4/2019 N.k.singh

    10/11

    Durationred green 15red yellow 3green red 10yellow red 2

    null null 0Write your code in assembly languageusing a text editor and assemble it usingthe AS11program. Experiment with the l flag toproduce a listing of the code showing theopcodes alongside your assemblylanguage statements.Listing handyduring debug is often useful. Downloadthe .s19 output file to the EVB to testyour program.

    Use good coding practice on yourassembly language programs. Commentyour code thoroughly. Use EQUstatements to define port addresses.Control the North-Southlights with datacoming over Port B and control the East-WEstlights with data coming over the SPI.When the SPI is used, you will need an8-bit serialinparallel-out shift register to capture thedata. You can build such a shift registeron your FPGA. You are free to useeither Verilog or schematic entry. The programming ritual for the SPI isreviewed below. You should carefullystudy the 68HC11 reference manual formore information or look at some of theexamples in otherHC11 books.1) Configure the data direction registerfor port D (DDRD)2) Configure the control register (SPCR)3) Read the status register to clear anyflag that is set (SPSR)4) Write a pattern to the data I/O register(SPDR)5) Repeat steps 3 and 4 as neededRemember that bit 5 of the DDRD mustbe high or SSbar must be tied high with

    an external resistor to avoid looking forerrors when MISO is not used.When connecting to the Berg strip fromthe HC11 board, be very careful not toshort adjacent pins with wires or careless

    handling of a probe. This is a likelycause of damage to many boards in thepast. It is very difficult to debug your project when you do not know if thefailure is coming from your code or froma damaged board.

    CONCLUSION

    An intelligent traffic light systemhad successfully been designed

    and developed. The sensorswere interfaced with Lab VIEWintegrated system. Thisinterface is synchronized withthe whole process of the trafficsystem. This prototype caneasily be implemented in reallife situations.Increasing the number ofsensors to detect the presenceof vehicles can further enhance

    the design of the traffic lightsystem. Another room ofimprovement is to have theinfrared sensors replaced withan imaging system/camerasystem so that it has a widerange of detection capabilities,which can be enhanced andventured into a perfect trafficsystem.

    PROCEDURE:-

  • 8/4/2019 N.k.singh

    11/11

    1. Connect power supply 5V & GNDto both microprocessor trainer kit &Traffic light controller interfacing kit.2. Connect data bus between

    microprocessor trainer kit & Trafficlight controller interfacing kit.3. Enter the program to controlTraffic light.4. Execute the program by typing GOE000:0B80 ENTER.5. Observe the LEDs on traffic lightcontroller PCB.