0% found this document useful (0 votes)
3K views

Traffic Light Controller Using Verilog

This document summarizes a student project to design a simple traffic light controller. The objective was to program an Altera DE2 education board to display traffic lights on a connected screen. The design used VHDL code to implement a state machine logic to control 8 traffic lights and switch lights according to signals from 6 sensors. The project involved designing state diagrams, writing VHDL code, and using the board's switches as sensors to control light displays on the screen. The student was able to successfully implement the traffic light controller design.

Uploaded by

Duncan King
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3K views

Traffic Light Controller Using Verilog

This document summarizes a student project to design a simple traffic light controller. The objective was to program an Altera DE2 education board to display traffic lights on a connected screen. The design used VHDL code to implement a state machine logic to control 8 traffic lights and switch lights according to signals from 6 sensors. The project involved designing state diagrams, writing VHDL code, and using the board's switches as sensors to control light displays on the screen. The student was able to successfully implement the traffic light controller design.

Uploaded by

Duncan King
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Final Project Report: Simple Traffic Light Controller

Author: Aziz Yuldashev


Report Due Date: 03/16/11
Course: ECEGR 401- VHDL
Instructor: Dr. Margarita Takach
Department of Electrical and Computer Engineering
SeattleUniversity

Objective

Inthisprojectthemainobjectivewastodesignasimpletrafficlightcontrollerand

illustrateitsoperationbyprogrammingAlteraDE2Cyncloneserieseducationboard,which
displayedtrafficlightsonascreenconnectedthoughaserialoutput.

EquipmentandTools

Inthisprojectthefollowingequipmentandtoolswereused:
Tools:

VHDL

QuartusIIcompilerdesignedbyAltera

Equipment:

AlteraDE2DevelopmentandEducationBoard

NeccomputerscreenofMultiSyncXV15+series

EquipmentSetUp

Thediagrambelowillustratesthesetupoftheequipmentusedinthisproject:

SerialOutputtoScreen

Screen

AlteraDE2
EducationBoard

NecMuliSyncXV15+

ComputerWith

Power

QuartusSiftware

DesignProcedure

Theideawastoimplementatrafficlightcontrollerforanintersectionwitheightlights.
Eachstreethasonelanewhichthendividesintotwolanes:onetoturnleftonlyandtheother
togostraightortoturnright,attheintersection.Oneofthestreetsisamainstreet,meaning
thatthelightstogostraightarealwaysgreenunlesstherearecarsontheintersectingstreetor
acaronthemainstreetappearsontheleftonlylane.Thediagrambelowbestillustratesthis
picture:
N

Sensors

TrafficLights

MainStreet

Sensor

Asshownabove,thestreetintersectingthemainstreethastwosensorsoneach
direction.Onsensorforaleftturnandonesensorforarightturncontrolthelightstogether
withaleftturnsensoronthemainstreetforeachdirection.Thusthereareeighttrafficlights,
fourforleftturnoneachstreetforeachdirectionandsixsensorstocontroltheselights.
LogicofTheTrafficLightController
Thelogicofthetrafficlightcontrollerisverysimple.Allithastodoisswitchlights
accordingtotheloworhighsignalcomingfromsensors.Theinitialstateofthecontrolisthat
thestraightlightsonthemainstreetarealwaysgreenunlessthereisacarontheintersecting
streettryingtostraightorturningleft.Soifthereisacargoingstraightontheintersecting
street,thenthestraightlightsonthemainstreetwilltransitiontoyellowandthenredafter

waitingforfortysecondsandthestraightlightsontheintersectingstreetforeachdirectionwill
turngreenwhileallotherlightsremainred.Theafterwaitingforfortysecondsthelightstraight
lightonthemainstreetwillturngreenafterthestraightlightontheintersectingstreet
transitionsfromgreentoyellowandthentored.So,thesamelogicappliestoothercases.
Beforeturningthislogicintocodeitwasidealandhelpfultohaveastatediagram
describingeachcasesforthetrafficlightcontroller.
S4

Carsonthemain
S4
WGL|EGL
Streetturningleft
WGL|EGL

andcarsonthe
40s
otherstreetgoing
SGST|NGST

straightandturning
40s
Carsonthemain
leftafter40s
SGL|NGL
Streetturningleft

after40s

After40s

S3
SGST|NGST
40s
SGL|NGL

After40s

Carsontheintersectingstreet
goingstraightandturningleft
after40s

Carontheintersectingstreet

turningleftandafter40s

S0
WGST|EGST

S2
SGL|NGL

After40s

Carontheintersectingstreet
goingstraightandafter40s

S1
SGST|NGST

Thestatediagramaboveshowsthegenerallogicofthecontroller.SoatS0theonly
lightsthataregreenareWestGreenStraight(WGST)lightsandEastGreenStraight(EGST)
lights.Notethatthisstatediagramonlyshowsthelightsthataregreen,allotherlightsarered.
Inadditioneachstatehassubstatesthatcontrolthetimingofthetransitions.Whenacarstops
ontheintersectingstreetonalanegoingstraight,thesensortriggersandthecounterstarts
counting.Whenthecountreaches40s,thestatetransferstoS1andthelightsonthemain
streettransitionfromgreentoredandthelightsgoingstraightontheintersectingstreet
becomegreenthusitisnotedasSouthGreenStraight(SGST)andNorthGreenStraight(NGST)
inthestatediagram.Whenthelighthitsgreenontheintersectingstreet,thecounterrefreshes
andstartscountingfromzero.Whenthecountreaches40sthestatetransitionstoS0.When

therearetwocarsontheintersectingstreet,onegoingstraightandoneturningleftthenthe
newstatebecomesS3.Here,carsgoingstraightwillbepassedfirstandthenthecarsturning
leftwillgoafter40s,thusthisphenomenonisnotedasSouthGreenStraight(SGST)andNorth
GreenStraight(NGST),thenwaitfor40s(40s)inthestatediagram,thenturnthesouthand
northstraightlightsredandturnthesouthandnorthleftturnlightsgreenthusnotedasSouth
GreenLeft(SGL)andNorthGreenLeft(NGL)inthestatediagram.Sotherestofthelogicis
similartowhathasbeenexplainedabove.

VHDLCode
TwoVHDLprogramswereusedinthisproject.OnenamedVGA_Control.Thisprogramis
theoutputprogramthatcontrolsthescreen.Thesecondprogramcalledmake_imageisan
inputprogramtotheVGA_Controlprogram.Inthisprojectwehavemodifiedthemake_image
programprovidedtousbyDr.M.Takach.
BothVHDLcodesareattachedseparatelywiththesynthesisanalysisprovidedbytheRTL
viewerofQuartusII.

ControlSwitches
SixswitchesontheAlteraboardactassensorsforthisproject.Herearetheswitch
assignments:
SensoronthewestsideofmainstreetturningleftPIN_N26(SW2)
SensorontheeastsideofmainstreetturningleftPIN_N25(SW1)
SensoronthenorthsideofintersectingstreetgoingstraightPIN_V2(SW15)
SensoronthenorthsideofintersectingstreetturningleftPIN_V1(SW14)

SensoronthesouthsideofintersectingstreetgoingstraightPIN_U4(SW17)
SensoronthesouthsideofintersectingstreetturningleftPIN_U3(SW16)

Conclusions
InthisprojectwehavedesignedatrafficlightcontrollerusingVHDL.Theprocesswas
longandsomewhatpainfulandstressful,howevertwoweeksofworkpaidofattheendwhen
weweresuccessfullyabletoimplementthestatemachineandoutputtheresultsonascreen.

You might also like