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,[Link],meaning
thatthelightstogostraightarealwaysgreenunlesstherearecarsontheintersectingstreetor
[Link]
picture:
N
Sensors
TrafficLights
MainStreet
Sensor
Asshownabove,thestreetintersectingthemainstreethastwosensorsoneach
[Link]
[Link],
fourforleftturnoneachstreetforeachdirectionandsixsensorstocontroltheselights.
LogicofTheTrafficLightController
[Link]
[Link]
thestraightlightsonthemainstreetarealwaysgreenunlessthereisacarontheintersecting
[Link]
street,thenthestraightlightsonthemainstreetwilltransitiontoyellowandthenredafter
waitingforfortysecondsandthestraightlightsontheintersectingstreetforeachdirectionwill
[Link]
lightonthemainstreetwillturngreenafterthestraightlightontheintersectingstreet
[Link],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)
[Link],allotherlightsarered.
[Link]
ontheintersectingstreetonalanegoingstraight,thesensortriggersandthecounterstarts
counting.Whenthecountreaches40s,thestatetransferstoS1andthelightsonthemain
streettransitionfromgreentoredandthelightsgoingstraightontheintersectingstreet
becomegreenthusitisnotedasSouthGreenStraight(SGST)andNorthGreenStraight(NGST)
[Link],thecounterrefreshes
[Link]
therearetwocarsontheintersectingstreet,onegoingstraightandoneturningleftthenthe
[Link],carsgoingstraightwillbepassedfirstandthenthecarsturning
leftwillgoafter40s,thusthisphenomenonisnotedasSouthGreenStraight(SGST)andNorth
GreenStraight(NGST),thenwaitfor40s(40s)inthestatediagram,thenturnthesouthand
northstraightlightsredandturnthesouthandnorthleftturnlightsgreenthusnotedasSouth
GreenLeft(SGL)andNorthGreenLeft(NGL)[Link]
similartowhathasbeenexplainedabove.
VHDLCode
TwoVHDLprogramswereusedinthisproject.OnenamedVGA_Control.Thisprogramis
theoutputprogramthatcontrolsthescreen.Thesecondprogramcalledmake_imageisan
inputprogramtotheVGA_Controlprogram.Inthisprojectwehavemodifiedthemake_image
[Link].
BothVHDLcodesareattachedseparatelywiththesynthesisanalysisprovidedbytheRTL
viewerofQuartusII.
ControlSwitches
[Link]
assignments:
SensoronthewestsideofmainstreetturningleftPIN_N26(SW2)
SensorontheeastsideofmainstreetturningleftPIN_N25(SW1)
SensoronthenorthsideofintersectingstreetgoingstraightPIN_V2(SW15)
SensoronthenorthsideofintersectingstreetturningleftPIN_V1(SW14)
SensoronthesouthsideofintersectingstreetgoingstraightPIN_U4(SW17)
SensoronthesouthsideofintersectingstreetturningleftPIN_U3(SW16)
Conclusions
[Link]
longandsomewhatpainfulandstressful,howevertwoweeksofworkpaidofattheendwhen
weweresuccessfullyabletoimplementthestatemachineandoutputtheresultsonascreen.