77478929-Report

47
TRAFFIC LIGHT CONTROLLER USING VHDL CHAPTER-1 INTRODUCTION Transportation research’s goal is to optimize transportation flow of people and goods. As the number of road users constantly increases while resources provided by current Infrastructures are limited, intelligent control of traffic will become a very important issue. Traffic in the urban areas system regularized by traffic lights, which is in many cases contribute to the unnecessary long waiting times for cars if not efficiently configured. The conventional traffic light control methods include fix-time control, time of day control, vehicle actuated control, semi-actuated control, green wave control, area static control and area dynamic control. However, there is no system meeting the adaptive characteristic. This is because the traffic control system is non-linear, fuzzy and nondeterministic, and thus traditional methods of modeling and control cannot work very well. In order to solve the above mentioned problem, there are many researchers gropes have performed a lot of researches. In recent years the application of image processing techniques in automatic traffic monitoring and control has been investigated to optimize methodologies for traffic. Traditionally, the traffic problems has been managed by using the Trial-And-Error method. For example an expertise or team decided on traffic parameters and depending on the resulting traffic behavior some feedback corrections will be done. This philosophy hasn’t changed so much in past decades, except for the use of simulators instead of real traffic tests as feedback source. Recently some micro-simulators – based on Dept of ECE, SJBIT Page 1

Transcript of 77478929-Report

TRAFFIC LIGHT CONTROLLER USING VHDL

CHAPTER-1

INTRODUCTION

Transportation research’s goal is to optimize transportation flow of people and goods. As the number of roadusers constantly increases while resources provided by currentInfrastructures are limited, intelligent control of traffic will become a very important issue. Traffic in the urban areassystem regularized by traffic lights, which is in many cases contribute to the unnecessary long waiting times for cars if not efficiently configured.

The conventional traffic light control methods include fix-time control, time of day control, vehicle actuated control, semi-actuated control, green wave control, area static control and area dynamic control. However, there is no system meeting the adaptive characteristic. This is because the traffic control system is non-linear, fuzzy and nondeterministic, and thus traditional methods of modeling andcontrol cannot work very well.

In order to solve the above mentioned problem,there are many researchers gropes have performed a lot ofresearches. In recent years the application of imageprocessing techniques in automatic traffic monitoring andcontrol has been investigated to optimize methodologies fortraffic. Traditionally, the traffic problems has been managedby using the Trial-And-Error method. For example an expertiseor team decided on traffic parameters and depending on theresulting traffic behavior some feedback corrections will bedone. This philosophy hasn’t changed so much in past decades,except for the use of simulators instead of real traffic testsas feedback source. Recently some micro-simulators – based on

Dept of ECE, SJBIT Page 1

TRAFFIC LIGHT CONTROLLER USING VHDL

the vision of traffic as a collection of independent vehicles– have been proved to be very accurate.

Traffic optimization comprises a set of differentproblems, from which one of the most relevant ones is thetraffic light cycles optimization. This paper aim to proposean intelligent traffic light additional component that is amonitoring system to improve traffic light configuration. Itwill be in the intelligent traffic light system. Thus, anintelligent traffic light system will be composed of twocomponents(or subsystems): a monitoring system and a controlsystem will able to integrated together to aid the trafficlight system to take theintelligent decisions efficiently.

This research will be investigating on theadditional component (monitoring system) by using smallassociative memory. This system will be able to determinethree street cases (empty street case, normal street case andcrowded street case). The input of this system will be asequence of images of vehicles of the intersection to bemonitored. Technically, the proposed approach has two phases:training phase and recognition phase by use one video camerato every street in the intersection. These cameras fixed in asuitable position regardless camera distance from the streetzebra crossing to obtain the best possible view.

CHAPTER-2

TYPES OF TRAFFIC LIGHT MODEL This subsection provide a survey of theliterature related to traffic light systems, highlighting mostof the traffic light models (i.e., queue traffic light, fuzzytraffic light, Petri-net traffic light and LED traffic light)that were developed to improve traffic light efficiency.

Dept of ECE, SJBIT Page 2

TRAFFIC LIGHT CONTROLLER USING VHDL

2.1. Queue traffic light model

The queue traffic light model was developed intraffic engineering studies. Vehicles arrive at anintersection controlled by a traffic light and form a queue.Many researchers evaluated the queue lengths in each laneusing different techniques depending on street width and thenumber of vehicles that are expected at a given time of day.In this model, traffic light efficiency is effected whenunexpected events happen (traffic accidents) causingdisruption to the flow of vehicles. For example, Fathy andSiyal (1995) proposed a queue detection algorithm thatconsists of motion detection and vehicle detection operation.Both are based on extracting the edges of the scene to reducethe effects of variations in lighting conditions.Jin andOzguner described (1999) a combination of multidestinationrouting and real time traffic light control based on a conceptof cost-to-go to different destinations. This traffic lightmodel is also a decentralized control approach.

A general formulation for delays on a roadsection was developed by De Schutter (1999). He discussed howoptimal and suboptimal traffic light switching schemes can bedetermined. First, they constructed a model that described theevolution of queue length (as continuous variables) in eachlane.Next, he showed how optimal and suboptimal traffic lightswitching schemes (with possibly variable cycle lengths) canbe determined. Xiaohua and Yangzhou (2003) introduced a hybridoptimization system. They used the average queue length overall queues as an objective function to find an optimal trafficlight switching scheme [57]. Leeuwaarden (2006) derived aprobability generation function of both the queue length anddelay from which the whole queue length and delay distributioncould be obtained. This allowed for the evaluation ofperformance characteristics other than the mean, such as thevariance and percentiles of distribution.

A non-cooperative approach, which gives rise to anon-cooperative game, was studied by Alvarez and coworkers

Dept of ECE, SJBIT Page 3

TRAFFIC LIGHT CONTROLLER USING VHDL

(2008). In this model, signalized intersections wereconsidered as finite controlled Markov chains and a solutionwas sought to optimize the congestion into an avenue. Using agame theory method, they considered each intersection as anon-cooperative game where each player tries to minimize itsqueue.

Helbing and Mazloumian (2009) discussed elementsof signal control based on the minimization of overall traveltimes or vehicle queues. They found different operationregimes, some of which involve a “slower-is-faster effect”,where delayed switching reduced the average travel time. Theseoperation regimes characterized different ways of organizingtraffic flows in urban road networks. Besides the optimize-one-phase approach, they discussed the procedure andadvantages of optimizing multiple phases as well. To improvethe service of vehicle platoons and support the self-organization of “green waves”, considering the price ofstopping newly arriving vehicles was proposed.

2.2. Knowledge based traffic light models

Knowledge based systems are artificialintelligent tools that work in a narrow domain to provideintelligent decisions with justification. Knowledge isacquired and represented using various knowledgerepresentation rules, frames and scripts. Many researchershave used knowledge based systems to developed traffic lightsystems. For example, Findler and coworkers (1997) described adistributed, knowledge-based system for real-time and traffic-adaptive control of traffic signals. The first of a two-stagelearning process optimizes the control of steady-state trafficat a single intersection and over a network of streets. Thesecond stage of learning deals with predictive/reactive

Dept of ECE, SJBIT Page 4

TRAFFIC LIGHT CONTROLLER USING VHDL

control in responding to sudden changes in trafficpatterns.Wen (2008) proposed a framework for a dynamic andautomatic traffic light control expert system. The modeladopts inter-arrival time and interdeparture time to simulatethe arrival and leaving number of cars on roads. This modelused a knowledge base system and rules. Depending on thetraffic light data, which are collected by a RFID reader, thismodel makes decisions that are needed to control theintersections.

Other researchers have developed fuzzy controlsystems, which are mathematical systems that analyze analoginput values in terms of logical variables that take oncontinuous values between 0 and 1 based on fuzzy logic. Thistype of control system consists of three components. First,fuzzy elements have degrees of membership. Second a membershipfunction is created, which is a curve that defines how eachpoint in the input space is mapped to a membership value (ordegree of membership) between 0 and 1. Third, if-then rulesare applied, which are used to formulate the conditionalstatements that comprise fuzzy logic. In general, manytheoretical papers on control of traffic systems using fuzzystatements have been published. For example, Kaur and Konga(1994), described the design of a fuzzy traffic lightcontroller at the intersection of two streets that changescycle time depending upon the densities of cars behind greenand red lights and the current cycle time. A fuzzy model ofthe system has been built and tested to predict the behaviorof the model under different traffic conditions.

A realistic approach to fuzzy control of urban roadtraffic lights was described by Hoyer and Jumar (1994a).Fuzzyapplication is encouraging since the design procedure ofvehicle actuated traffic light systems is very transparent,and an adaptation to the changing situations of traffic iseasy to Accomplish.Khalid and coworkers (2004) proposed afuzzy traffic light controller to be used at a complex trafficjunction. The proposed fuzzy traffic light controller iscapable of communicating with neighboring junctions and

Dept of ECE, SJBIT Page 5

TRAFFIC LIGHT CONTROLLER USING VHDL

manages phase sequences and phase lengths adaptively. Averageflow density, average delay time and link overflow of theintersections are used as performance indices for comparisonpurposes. GiYoung and coworkers (2001) created an optimaltraffic signal using fuzzy control. Electro sensitive trafficlights have better efficiency than fixed preset traffic signalcycles because they are able to extend or shorten the signalcycle when the number of vehicles increases or decreasessuddenly. They used fuzzy membership function values between 0and 1 that estimate the uncertain length of a vehicle, vehiclespeed and width of a road. They stored different kinds ofconditions such as car type, speed, delay in starting time andthe volume of cars in traffic.

A traffic light controller based on fuzzy logicwas proposed by Kulkarni and Waingankar (2006) to be used foroptimum control of fluctuating traffic volumes, such as oversaturated or unusual road conditions. The rules of a fuzzylogic controller are formulated by following the sameprotocols that a human operator would use to control the timeintervals of the traffic light. The length of the currentgreen phase is extended or terminated depending upon the'arrival'; i.e. the number of vehicles approaching the greenphase, and the 'queue' that corresponds to the number ofqueuing vehicles in red phases.Pedraza and coworkers (2008)detailed the design of a traffic system model for vehiclesthat examined the traffic traveling through a series oftraffic lights on a main road. The adaptive network-basedfuzzy inference system was used to synchronize the time ofduration and phase angle of the traffic lights, and alsomaintain the maximum possible velocity of the vehiclestraveling on the road.

A complex adaptive system (CAS) is a network ofcommunicating, intelligent agents where each agent adapts itsbehavior in order to collaborate with other agents to achieveoverall system goals. The overall system often exhibitsemergent behavior that cannot be achieved by any proper subsetof agents alone. The classifier event action block can

Dept of ECE, SJBIT Page 6

TRAFFIC LIGHT CONTROLLER USING VHDL

implement both crisp and fuzzy rules. This system uses onenetwork of traffic light controller agents at eachintersection. Each traffic controller agent uses a fuzzyclassifier block to make decisions about traffic light timingin order to minimize local vehicle wait time.

Hong and coworkers (2001) presented conceptsthat described a main urgent phase and minor urgent phase. Thetraffic data are acquired from the detectors in theintersections and lanes. Based on the concepts of main andminor urgent phases, a set of novel fuzzy control rules isdeveloped to control the phases and delay of traffic lightsaccording to the dynamic characters of some correlativetraffic intersections.

An electro sensitive traffic light, using asmart agent algorithm to reduce traffic congestion and trafficaccidents, was proposed by Hong and coworkers (2007).Specifically, they designed and implemented a system to createoptimum traffic signals in congested conditions using smartagent algorithms. This approach antecedently created anoptimal traffic cycle of passenger car units at the bottomtraffic intersection. Mistakes were possible due to differentcar lengths, car speeds, and the length of the intersection.Therefore, this approach consequently reduced car waitingtimes and start-up delay times using fuzzy control of feedbackdata.

An application of diffuse systems in trafficlights for the road control of urban transit was proposed byLopez and coworkers and Alejandro and coworkers (2007). Givenvehicular problems of the city, it was intended to look foroptions to make vehicular traffic more agile. With this inmind, three proposals for diffuse control design wereformulated. The first proposal was the control of two trafficlights for cars placed in a crossing of a few streets. Thefunctioning of the traffic light was typical (green-amber-red). The system included sensors entrusted to indicate thepace of arrival of the cars and the length of the trail of

Dept of ECE, SJBIT Page 7

TRAFFIC LIGHT CONTROLLER USING VHDL

cars at a certain moment. The principal street had one sensorand the lateral street had another sensor. Second, theproposal had, as a basic principle, the modification of thetraffic light timing around a predetermined nominal value.Such a nominal value was calculated based on normal trafficconditions in a determinate cross road, using standard traffictheory and criteria. The objective of the fuzzy controller wasto dynamically adjust the timing of each light stage tosupport variations in vehicular load, such as during rushhours. Finally, the third proposal was to optimize the flow ofvehicles in the street. This was carried out by defining thetimes that each light of the traffic light remained lit. Thisproposal has a fuzzy inference system (FIS) control where theinput variables for the control are car density and waitingtimes.

The weakness of all these approaches is the factthat the systems use expert system technology but do notprovide any guarantee about the quality of the rules; i.e., anexpert system/rule based approach is not ideal for problemsthat require considerable knowledge. In addition, easilycreating and modifying rules can destroy any system. Aknowledgeable user can add no value rules or rules thatconflict with existing ones.

2.3. Traffic light models based on wirelesscommunication

Wireless communication is the transfer ofinformation over a distance without the use ofenhancedelectrical conductors or wires. The distances involvedmay be short (a few meters, as in television remote control)or long (thousands or millions of kilometers for radiocommunications). There are many problems with systems that usewireless communication. One of the problems is the alreadylimited spectrum available for communications. Another problemis splitting up the environment into a number of small cells,which increases the overall accessible bandwidth of theDept of ECE, SJBIT Page 8

TRAFFIC LIGHT CONTROLLER USING VHDL

communication system, but also increases the cost as more cellsites are required. Some form of encryption is required forcommunications to avoid interception of data transmitted overthe network by devices not taking part in the communications.In addition to security considerations from external devicesaccessing the network, interfering signals can be generated byother devices in the environment. These devices cantemporarily disrupt a communication link through the noisethat they generate.Other researchers used a wireless sensor network to developsuch a system. For example, Ibrahim etal. (2005) developedsoftware planning tools for wireless LAN link optimization asan intelligent traffic light system control. This software wasbased on the combination of Mat Lab and MapInfo software,which gives grouping parameters to build up the softwaredevelopment.

The traffic light site selections mustinclude line-of-sight (LOS) field strength predictions foreither point to point or point to multipoint situations.Migueletal. (2006) proposed the use of a wireless sensor network toenable car drivers to have more energy efficient city drivingvia finding an interaction communication between drivers andtraffic lights.Gradinescu etal.(2007) presented an adaptivetraffic light system based on wireless communication betweenvehicles and fixed controller nodes deployed in intersections.A smart transport and road communications model was presentedby Kun-chan et al. (2007) based on a wireless mesh networkarchitecture, connecting a hierarchy of several thousanddevices, from individual traffic light controllers to regionalcomputers and the central traffic management centre (TMC),that placed stringent requirements on the reliability andlatency of the data exchanges.

Dept of ECE, SJBIT Page 9

TRAFFIC LIGHT CONTROLLER USING VHDL

Tubaishat etal. (2008) studied theperformance with one sensor and two sensors and designedcorresponding controllers. In the case of one sensor, twomodels were developed: the first one detected passing vehiclesonly; whereas, the second one detected vehicles that passedthe sensor or stopped at it. In both methods, the change ofthe sensor location was relative to traffic light location.They then used two sensors to calculate the number of vehicleswaiting or approaching a traffic light. They tested differentdistances between the two sensors. Researches who use wirelesssensor networks face serious challenges, such as the problemof providing power to such sensors, in addition to thedifficulty of determining the distance between the sensors inthe case of needing more than one sensor.

2.4. LED traffic light models

Light-emitting diodes (LEDs) are semiconductordevices that are capable of fast switching ON and OFF. Thismeans LEDs can be used for communication purposes. In additionto the normal function of being an indication and illuminationdevice, LED traffic lights can also be used astransmitters.Although, research on wireless opticalcommunication using LED traffic lights has been performed,this type of system would require replacement of all trafficlights. In addition, receivers (e.g., cameras) would need tobe located in the front of vehicles. Ibrahim and Beasley(1998) discussed the technical aspects of LED traffic lightsand provided estimates on expected savings if all the trafficlights were to be replaced by LEDs.Akanegawa et al. (2001)proposed a traffic information system using LED trafficlights, focusing on light visibility and power used fortraffic control, the number and location of traffic lights,and movement toward use of LED traffic lights. Finally, Wadaet al. (2005) proposed a parallel wireless opticalcommunication system for road-tovehicle communication thatuses a LED traffic light as a transmitter and a high-speedcamera as a receiver. The proposed system enables multi-channeling in a two dimension arrangement and spatial dividing

Dept of ECE, SJBIT Page 10

TRAFFIC LIGHT CONTROLLER USING VHDL

ability. LED transmitters arranged in the shape of a plane aremodulated individually and a camera is used as a receiver fordemodulating the signals by using image processing techniques.

2.5. Traffic light models using an extension neuralnetwork (ENN)

The extension neural network (ENN) consists ofextension theory and a neural network that uses a modifiedextension distance (ED) to measure the similarity between dataand a cluster center. ENN is another traffic light controlsystem developed to deal with object recognition in outdoorenvironments.In outdoor environments, lighting conditionscannot be controlled or predicted, objects can be partiallyoccluded, and their position and orientation is not known apriori. The chosen objects are traffic or road signs, due toease of sign maintenance and inventory in highways and cities,driver support systems and intelligent autonomous vehicles. Agenetic algorithm is used for the detection step, allowinginvariance localization to changes in position, scale,rotation, weather conditions, partial occlusion, and thepresence of other objects of the same color. A neural networkcan achieveclassification.

Kuie etal. (2008) and chao et al. (2009) havepresented an intelligent traffic light control method based onextension theory for crossroads. First, the number of passingvehicles and maximum passing time of one vehicle within thegreen light time period are measured in the main-line and sub-line of a selected crossroad. Then, the measured data areadopted to construct the extended matter-element model andaccordingly the correlation degrees are calculated forrecognizing the traffic flow of a standard crossroad. Someexperimental results were obtained to verify the effectiveness

Dept of ECE, SJBIT Page 11

TRAFFIC LIGHT CONTROLLER USING VHDL

of the proposed intelligent traffic flow control method. Thediagnostic results indicated that the proposed estimatedmethod can discriminate the traffic flow of a standardcrossroad rapidly and accurately and These researchers,however, did not take into account unexpected situations thatmay cause disruption in the flow of vehicles, where the ENN isused for estimation. Also, the ENN tends to be slower to trainthan other types of networks (e.g., a single layer neuralnetwork) for two reasons. First, a large number of iterationsare needed to finish learning all the prototypes. Second, thelarge amount of data needs large networks. Therefore, thenetwork size should be as small as possible to allow forefficient computations. Sometimes, reducing the size of thesedata sets leads to ignoring some factors that could improvethe estimation process for the flow of vehicles.

2.6. Agent based traffic light models

A number of researchers turned to developingagent based traffic light models. For example, an agent basedapproach for traffic light control was adopted by Hirankittiand Krohkaew (2007). According to this approach, the systemconsists of agents and their world. In the traffic context,the world consists of cars, road networks and traffic lights.Each of these agents controls all traffic lights at a roadjunction by an observe-think- act cycle. That is, the agentcontinuously observes the current traffic conditions bycollecting traffic data, and then the data is used forreasoning with the traffic-lightcontrol rules by the agent’sinference engine to determine how a signal will be changed oneach traffic light near each junction. Use of inference enginetechniques requires the use of a knowledge base.

Therefore, using a large knowledge base will havean effect on the efficiency of the traffic light systembecause of storage space and the time it would take fordecision-making, in addition to the quality of rules fordecision-making. Although, a penalty for converting

Dept of ECE, SJBIT Page 12

TRAFFIC LIGHT CONTROLLER USING VHDL

electronic signals to optical signals (to realize opticalinterconnects) and vice-versa must be paid, because of theclear differences between the speed of the data communicationand processor speed, many researchers have continued interestin the marriage between photonics and electronics. Forexample, an agent based traffic lights logic algorithm,developed by Krajzewicz et al. (2005) used the length of a jamin front of a traffic light as input along with informationfrom the optical information system (OIS) sensors. Thisresearch observes the incoming lanes and measures the jamlengths on these lanes. If at one of these lanes the jam getslonger, this lane gets a green for a longer time.

2.7. Reinforcement learning traffic light models

Researchers have used reinforcement learningto improve traffic light configurations, which is a sub-areaof machine learning concerned with how an agent ought to takeactions in an environment to maximize some notion of long-termreward. For example, Wiering et al. (2004) studied simulationand optimization of traffic light controllers in a city andpresented an adaptive optimization algorithm based onreinforcement learning. They implemented a traffic lightsimulator to experiment with different infrastructures and tocompare different traffic light controllers.Nijhuis et al.(2005) described an existing approach of reinforcementlearning applied to the optimization of traffic lightconfigurations.

This approach used implicit cooperation betweentraffic lights while letting cars take into account thetraffic situation of the road ahead.These two researches useddifferent knowledge representation, dependent on thereinforcement learning machine. Also, the action valuefunction, which is difficult to analyze especially in a caseof a large domain, was different. The rules are usually mucheasier to interpret unless there are too many of them. Anotherdisadvantage of these two approaches was the necessity oftuning parameters, which meant the choice of these parameters

Dept of ECE, SJBIT Page 13

TRAFFIC LIGHT CONTROLLER USING VHDL

had a high impact on the results. Finally, due to necessaryexploration (exploring the environment), the algorithm'sperformance is less stable.

2.8. Genetic algorithm traffic light models

A genetic algorithm (GA) is an evolutionaryalgorithm. GAs have been presented since the early 1960s andthey apply the rules of nature, such as evolution occursthrough selection of the fittest individuals and individualscan represent solutions to a mathematical problem. Someresearchers have used GAs to improve traffic lightconfigurations. For example, Sanchez et al. (2008) presented anew architecture for the optimization of traffic light cyclesin a traffic network. The model is based on three basic designitems: the use of genetic algorithms as an optimizationtechnique, the use of cellular automata simulators within theevaluation function, and the use of a cluster as a parallelexecution environment for this architecture.Although, a greatadvantage of GAs is the fact that they find a solution throughevolution, this is also the greatest disadvantage. Evolutionis inductive. In nature, life does not necessarily evolvetowards a good solution; it can evolve away from badcircumstances. This can potentially cause a species to evolveinto an evolutionary dead end.

CHAPTER-3

Electronic design with FPGAs

In most digital designs, the circuitry can be classified bythe following categories:

Dept of ECE, SJBIT Page 14

TRAFFIC LIGHT CONTROLLER USING VHDL

• Standard products. These products provide a functionalitywhich is not associated with a specific application area butcommon to a broad range of devices. Typical parts in thiscategory are processors and memories.

• Application Specific Standard Products or ASSPs. Theseproducts provide functionality which is not associated with aspecific implementation, but common to an application area.Typical parts in this category are MPEG decoders.

• Custom Logic. This logic is associated with a specificapplication and is the essence of what distincts oneproduct from another. Often this is glue logic, connectingstandard products or ASSPs with each other.

There are several options on how to implement customlogic, FPGAs being one amongst them.

2.1 FPGAs [Field Programmable Gate Array]

FPGA is the abbreviation of Field Programmable Gate

Array. This denotes an integrated circuit which is

programmed in the field, i.e. by the system manufacturer.

FPGAs can be characterized by the following items:

• High production cost

• Low design density

- Programmable fabric adds significant overhead

• No NRE and Re-Spin cost

Dept of ECE, SJBIT Page 15

TRAFFIC LIGHT CONTROLLER USING VHDL

• Low development effort

- Low dead-time

- simplified timing

- No test vectors

- Relaxed verification

- Physical design is “hands-off”

Dept of ECE, SJBIT Page 16

TRAFFIC LIGHT CONTROLLER USING VHDL

CHAPTER-4

DESIGN DESCRIPTION

Traffic Light controller is implemented on FPGA and verified using Traffic Light Interface Module. There are simple rules for traffic lights on one node, and complex ways of regulating a whole infrastructure of them. It is necessary to adjust general algorithms.

4.1 Design Description:-

Initially all Red Lights will be “ON” (South, west, North, East, Pedestrian)

Green Lights of will be “ON”, Right, Left & Straight paths are free for Traffic.

Yellow Phase is split as yellow1 & yellow2. In yellow1 phase yellow lights will be on and

respective left & pedestrian paths are free for traffic. In Yellow2 Phase only yellow lights will be “ON” Same flow is repeated for all four paths. (South, west,

north, east).

Abbreviation used:-

Dept of ECE, SJBIT Page 17

TRAFFIC LIGHT CONTROLLER USING VHDL

South and West

PSG – Pedestrian South Green PWR – Pedestrian West Red

PSR – Pedestrian South Red PWG – Pedestrian West Green

RS – Right South RW – Right West

LS – Left South LW – Left West

SS – Straight South SW– South West

YS – Yellow South YW– Yellow West

REDS – Red South REDW– Red West

North and East

PNR- Pedestrian North red PEG – Pedestrian East green

PNG – Pedestrian North green PER – Pedestrian Ease Red

RN – Right North RE – Right East

LN – Left North LE – Left East

Dept of ECE, SJBIT Page 18

TRAFFIC LIGHT CONTROLLER USING VHDL

SN – Straight North SE– Straight East

YN - Yellow North YE – Yellow East

REDN – Red North REDE– Red East

4.2. Flowchart:-

Dept of ECE, SJBIT Page 19

TRAFFIC LIGHT CONTROLLER USING VHDL

4.3 Experimental Set up:-

Figure 1: Traffic Light Interface to SPARTAN-3FPGA

Dept of ECE, SJBIT Page 20

TRAFFIC LIGHT CONTROLLER USING VHDL

CHAPTER-5

WORKING PRINCIPLE

Traffic light Controller (TLC)

As mentioned earlier, digital controllersare good examples of circuits that can be effeciently implemented when modeled as state machines. In the present example, we want to design aTLC with the characteristics summarized in the table of figure 8.10, that is:

Three modes of operation: Regular, Test, and Standby.

1.Regular mode : four states, each with an independent, programmable time, passed to the circuit by means of a CONSTANT.

2.Test mode : allows all pre-programmed times to be overwritten (by a manual switch) with a small value, such that the system can be easily tested during maintenance (1 second per state). This value should also be programmable and passed to the circuit using a CONSTANT.

Dept of ECE, SJBIT Page 21

TRAFFIC LIGHT CONTROLLER USING VHDL

3.Standby mode : if set (by a sensor accusing malfunctioning, for example, or a manual switch) the system should activate the yellow lights in both directions and remain so while the standby signal is active.

Assume that a 60 Hz clock (obtained from the power line itself ) is available.

CHAPTER-6

VHDL Code for Traffic Light Controller

6.1.SOURCE CODE

library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;---- Uncomment the following library declaration if instantiating---- any Xilinx primitives in this code.---- library UNISIM;

Dept of ECE, SJBIT Page 22

TRAFFIC LIGHT CONTROLLER USING VHDL

---- use UNISIM.VComponents.all;

entity traffic_fsm isPort ( clk,rst : in std_logic;ls,lw,ln,le: out std_logic;ss,sw,sn,se : out std_logic;rs,rw,rn,re : out std_logic;red_s,red_w,red_n,red_e : out std_logic;ys,yw,yn,ye : out std_logic;ps_r,pw_r,pn_r,pe_r : out std_logic;ps_g,pw_g,pn_g,pe_g : out std_logic);end traffic_fsm;

architecture Behavioral of traffic_fsm istype state is (start,south_g,south_orange,south_r,west_g,west_orange,west_r,east_g,east_orange,east_r,north_g,north_orange,north_r);signal ps , ns : state;signal div : std_logic_vector(30 downto 0);signal clk_s : std_logic;signal cnt : std_logic_vector(3 downto 0) ;beginprocess(clk,rst)beginif(rst = '1') thendiv <= (others => '0');elsif(clk'event and clk = '1') thendiv <= div + 1;end if;end process;clk_s <= div(21);process(clk_s ,rst)Dept of ECE, SJBIT Page 23

TRAFFIC LIGHT CONTROLLER USING VHDL

beginif(rst = '1') thencnt <= (others => '0');elsif(clk_s'event and clk_s = '0') thencnt <= cnt + 1;end if;end process;process(clk_s,rst)beginif (rst = '1')thenps <= start;elsif(clk_s'event and clk_s = '1') thenps <= ns;end if;end process;

process(ps)begincase ps iswhen start =>ns <= south_g;when south_g =>if(cnt = 10)thenns <= south_orange;elsens <= south_g;end if;when south_orange =>if(cnt = 14) thenns <= south_r;elsens <= south_orange;end if;when south_r =>Dept of ECE, SJBIT Page 24

TRAFFIC LIGHT CONTROLLER USING VHDL

if(cnt = 15)thenns <= west_g;elsens <= south_r;end if;when west_g =>if(cnt = 10) thenns <= west_orange;elsens <= west_g;end if;when west_orange =>if(cnt = 14) thenns <= west_r;elsens <= west_orange;end if;when west_r =>if(cnt = 15 )thenns <= north_g;elsens <= west_r;end if;when north_g =>if(cnt = 10)thenns <= north_orange;elsens <= north_g;end if;when north_orange =>if(cnt = 14)thenns <= north_r;elsens <= north_orange;Dept of ECE, SJBIT Page 25

TRAFFIC LIGHT CONTROLLER USING VHDL

end if;when north_r =>if(cnt = 15)thenns <= east_g;elsens <= north_r;end if;when east_g =>if(cnt = 10)thenns <= east_orange;elsens <= east_g;end if;when east_orange =>if(cnt = 14)thenns <= east_r;elsens <= east_orange;end if;when east_r =>if(cnt = 15)thenns <= south_g;elsens <= east_r;end if;when others =>ns <= start;end case;end process;process(ps)beginred_s <= '0';red_w <= '0';red_n <= '0';Dept of ECE, SJBIT Page 26

TRAFFIC LIGHT CONTROLLER USING VHDL

red_e <= '0';rs <= '0';rw <= '0';rn <= '0';re <= '0';ss <= '0';sw <= '0';sn <= '0';se <= '0';ls <= '0';lw <= '0';ln <= '0';le <= '0';ps_g <= '0';pw_g <= '0';pn_g <= '0';pe_g <= '0';ys <= '0';yw <= '0';yn <= '0';ye <= '0';ps_r <= '0';pw_r <= '0';pn_r <= '0';pe_r <= '0';case ps iswhen start =>red_s <= '1';red_w <= '1';red_n <= '1';red_e <= '1';when south_g =>ls <= '1';rs <= '1';Dept of ECE, SJBIT Page 27

TRAFFIC LIGHT CONTROLLER USING VHDL

ss <= '1';le <= '1';red_w <= '1';red_n <= '1';red_e <= '1';ps_r <= '1';pw_r <= '1';pn_r <= '1';pe_r <= '1';when south_orange =>pn_g <= '1';le <= '1';ls <= '1';ys <= '1';red_w <= '1';red_n <= '1';red_e <= '1';ps_r <= '1';pw_r <= '1';pe_r <= '1';when south_r =>ls <= '1';red_w <= '1';red_n <= '1';red_e <= '1';ps_r <= '1';pw_r <= '1';pn_r <= '1';pe_r <= '1';when west_g =>lw <= '1';ls <= '1';rw <= '1';sw <= '1';Dept of ECE, SJBIT Page 28

TRAFFIC LIGHT CONTROLLER USING VHDL

red_s <= '1';red_n <= '1';red_e <= '1';ps_r <= '1';pw_r <= '1';pn_r <= '1';pe_r <= '1';when west_orange =>lw <= '1';ls <= '1';pe_g <= '1';yw <= '1';red_s <= '1';red_n <= '1';red_e <= '1';ps_r <= '1';pw_r <= '1';pn_r <= '1';when west_r =>lw <= '1';red_s <= '1';red_n <= '1';red_e <= '1';ps_r <= '1';pw_r <= '1';pn_r <= '1';pe_r <= '1';when north_g =>ln <= '1';rn <= '1';sn <= '1';lw <= '1';red_s <= '1';red_w < = '1';Dept of ECE, SJBIT Page 29

TRAFFIC LIGHT CONTROLLER USING VHDL

red_e <= '1';ps_r <= '1';pw_r <= '1';pn_r <= '1';pe_r <= '1';when north_orange =>ln <= '1';lw <= '1';ps_g <= '1';yn <= '1';red_s <= '1';red_w <= '1';red_e <= '1';pw_r <= '1';pn_r <= '1';pe_r <= '1';when north_r =>ln <= '1';red_s <= '1';red_w <= '1';red_e <= '1';ps_r <= '1';pw_r <= '1';pn_r <= '1';pe_r <= '1';when east_g =>re <= '1';se <= '1';le <= '1';ln <= '1';red_s <= '1';red_w <= '1';red_n <= '1';ps_r <= '1';Dept of ECE, SJBIT Page 30

TRAFFIC LIGHT CONTROLLER USING VHDL

pw_r <= '1';pn_r <= '1';pe_r <= '1';when east_orange =>ln <= '1';le <= '1';pw_g <= '1';ye <= '1';red_s <= '1';red_w <= '1';red_n <= '1';ps_r <= '1';pn_r <= '1';pe_r <= '1';when east_r =>le <= '1';red_s <= '1';red_w <= '1';red_n <= '1';ps_r <= '1';pw_r <= '1';pn_r <= '1';pe_r <= '1';when others =>red_s <= '0';red_w <= '0';red_n <= '0';red_e <= '0';rs <= '0';rw <= '0';rn <= '0';re <= '0';ss <= '0';sw <= '0';Dept of ECE, SJBIT Page 31

TRAFFIC LIGHT CONTROLLER USING VHDL

sn <= '0';se <= '0';ls <= '0';lw <= '0';ln <= '0';le <= '0';ps_g <= '0';pw_g <= '0';pn_g <= '0';pe_g <= '0';ys <= '0';yw <= '0';yn <= '0';ye <= '0';ps_r <= '0';pw_r <= '0';pn_r <= '0';pe_r <= '0';end case;end process;end Behavioral;

--******************************************************

Description of above Code:-

To Start the Traffic light controller

1. Initially the Red light of all the directions is ON.2. Traffic starts from the South Direction; hence thegreen light of South direction goes ON.The signals that are ON, now are :-

ls ( left south ) –‘1’.Dept of ECE, SJBIT Page 32

TRAFFIC LIGHT CONTROLLER USING VHDL

rs ( right south ) –‘1’. ss ( straight south ) –‘1’. le ( left east ) –‘1’. red_w ( red west ) –‘1’. red_n (red north ) –‘1’. red_e (red east ) –‘1’. ps_r ( pedestrian south red) –‘1’. pw_r ( pedestrian west red) –‘1’. pn_r ( pedestrian north red) –‘1’. pe_r ( pedestrian east red) –‘1’.

Similarly when Orange light of South direction isON then the signals that are ON, now are

ls ( left south ) –‘1’. ys ( yellow south ) –‘1’. le ( left east ) –‘1’. red_w ( red west ) –‘1’. red_n (red north ) –‘1’. red_e (red east ) –‘1’. ps_r ( pedestrian south red) –‘1’. pw_r ( pedestrian west red) –‘1’. pn_r ( pedestrian north red) –‘1’. pe_r ( pedestrian east red) –‘1’.

Similarly when Red light of South direction is ONthen the signals that are ON, now are

ls ( left south ) –‘1’. red_w ( red west ) –‘1’.

Dept of ECE, SJBIT Page 33

TRAFFIC LIGHT CONTROLLER USING VHDL

red_n (red north ) –‘1’. red_e (red east ) –‘1’. ps_r ( pedestrian south red) –‘1’. pw_r ( pedestrian west red) –‘1’. pn_r ( pedestrian north red) –‘1’. pe_r ( pedestrian east red) –‘1’.

During this time all ways are Blocked for 1second except left south ( ls -‘1’ ) and so on. Afterthat it goes clockwise for all Direction (i.e.:- South then West then North then East) similarly.

6.2.OTHER CODE FOR TRAFFIC LIGHT CONTROL:-

library IEEE;

use IEEE.STD_LOGIC_1164.ALL;

use IEEE.STD_LOGIC_ARITH.ALL;

use IEEE.STD_LOGIC_UNSIGNED.ALL;

-------------------------------------------------

ENTITY tlc IS

PORT ( clk, stby, test: IN STD_LOGIC;

r1, r2, y1, y2, g1, g2: OUT STD_LOGIC);

END tlc;

-------------------------------------------------

Dept of ECE, SJBIT Page 34

TRAFFIC LIGHT CONTROLLER USING VHDL

ARCHITECTURE behavior OF tlc IS

CONSTANT timeMAX : INTEGER := 2700;

CONSTANT timeRG : INTEGER := 1800;

CONSTANT timeRY : INTEGER := 300;

CONSTANT timeGR : INTEGER := 2700;

CONSTANT timeYR : INTEGER := 300;

CONSTANT timeTEST : INTEGER := 60;

TYPE state IS (RG, RY, GR, YR, YY);

SIGNAL pr_state, nx_state: state;

SIGNAL time : INTEGER RANGE 0 TO timeMAX;

BEGIN

-------- Lower section of state machine: ----

PROCESS (clk, stby)

VARIABLE count : INTEGER RANGE 0 TO timeMAX;

BEGIN

IF (stby='1') THEN

pr_state <= YY;

count := 0;

ELSIF (clk'EVENT AND clk='1') THEN

count := count + 1;

IF (count = time) THEN

pr_state <= nx_state;

count := 0;

Dept of ECE, SJBIT Page 35

TRAFFIC LIGHT CONTROLLER USING VHDL

END IF;

END IF;

END PROCESS;

-------- Upper section of state machine: ----

PROCESS (pr_state, test)

BEGIN

CASE pr_state IS

WHEN RG =>

r1<='1'; r2<='0'; y1<='0'; y2<='0'; g1<='0'; g2<='1';

nx_state <= RY;

IF (test='0') THEN time <= timeRG;

ELSE time <= timeTEST;

END IF;

----------------------------------------------------------------------------------------------------

WHEN RY =>

r1<='1'; r2<='0'; y1<='0'; y2<='1'; g1<='0'; g2<='0';

nx_state <= GR;

IF (test='0') THEN time <= timeRY;

ELSE time <= timeTEST;

END IF;

----------------------------------------------------------------------------------------------------

WHEN GR => Dept of ECE, SJBIT Page 36

TRAFFIC LIGHT CONTROLLER USING VHDL

r1<='0'; r2<='1'; y1<='0'; y2<='0'; g1<='1'; g2<='0';

nx_state <= YR;

IF (test='0') THEN time <= timeGR;

ELSE time <= timeTEST;

END IF;

-----------------------------------------------------------------------------------------------------

WHEN YR =>

r1<='0'; r2<='1'; y1<='1'; y2<='0'; g1<='0'; g2<='0';

nx_state <= RG;

IF (test='0') THEN time <= timeYR;

ELSE time <= timeTEST;

END IF;

--------------------------------------------------------------------------------------------------------

WHEN YY =>

r1<='0'; r2<='0'; y1<='1'; y2<='1'; g1<='0'; g2<='0';

nx_state <= RY;

END CASE;

END PROCESS;

END behavior;

CHAPTER-7

Dept of ECE, SJBIT Page 37

TRAFFIC LIGHT CONTROLLER USING VHDL

APPLICATIONS

Applications of FPGAs include digital signal processing,

software-defined radio, aerospace and defense systems, ASIC

prototyping, medical imaging, computer vision, speech

recognition, cryptography, bioinformatics, computer hardware

emulation, radio astronomy, metal detection and a growing

range of other areas.

FPGAs originally began as competitors to CPLDs and

competed in a similar space, that of glue logic for PCBs. As

their size, capabilities, and speed increased, they began to

take over larger and larger functions to the state where some

are now marketed as full systems on chips (SOC). Particularly

with the introduction of dedicated multipliers into FPGA

architectures in the late 1990s, applications, which had

traditionally been the sole reserve of DSPs, began to

incorporate FPGAs instead.

FPGAs especially find applications in any area or

algorithm that can make use of the massive parallelism offered

by their architecture. One such area is code breaking, in

particular brute-force attack, of cryptographic algorithms.

FPGAs are increasingly used in conventional high

performance computing applications where computational kernels

such as FFT or Convolution are performed on the FPGA instead

of a microprocessor.Dept of ECE, SJBIT Page 38

TRAFFIC LIGHT CONTROLLER USING VHDL

The inherent parallelism of the logic resources on an

FPGA allows for considerable computational throughput even at

a low MHz clock rates. The flexibility of the FPGA allows for

even higher performance by trading off precision and range in

the number format for an increased number of parallel

arithmetic units. This has driven a new type of processing

called reconfigurable computing, where time intensive tasks

are offloaded from software to FPGAs.

The adoption of FPGAs in high performance computing is

currently limited by the complexity of FPGA design compared to

conventional software and the turn-around times of current

design tools.

Traditionally, FPGAs have been reserved for specific

vertical applications where the volume of production is small.

For these low-volume applications, the premium that companies

pay in hardware costs per unit for a programmable chip is more

affordable than the development resources spent on creating an

ASIC for a low-volume application. Today, new cost and

performance dynamics have broadened the range of viable

applications.

.

Dept of ECE, SJBIT Page 39

TRAFFIC LIGHT CONTROLLER USING VHDL

C

HAPTER-8

SOFTWARE: XILINX 9.2

Xilinx was founded in 1984 by two semiconductor

engineers, Ross Freeman and Bernard Vonderschmitt, who were

both working for integrated circuit and solid-state device

manufacturer Zilog Corp.

While working for Zilog, Freeman wanted to create chips

that acted like a blank tape, allowing users to program the

technology themselves. At the time, the concept was paradigm-

changing. "The concept required lots of transistors and, at

that time, transistors were considered extremely precious –

people thought that Ross's idea was pretty far out," said

Xilinx Fellow Bill Carter, who when hired in 1984 as the first

IC designer was the company's eighth employee.

Big semiconductor manufacturers were enjoying strong

profits by producing massive volumes of generic circuits.

Designing and manufacturing dozens of different circuits for

specific markets offered lower profit margins and required

greater manufacturing complexity. What became known as the

FPGA would allow circuits produced in quantity to be tailored

by individual market segments.

Dept of ECE, SJBIT Page 40

TRAFFIC LIGHT CONTROLLER USING VHDL

Freeman was unable to convince Zilog to invest in

creating the FPGA to chase what – at the time – was only a

$100 million market. Freeman left Zilog and teamed up with his

60-year-old ex-colleague Bernard Vonderschmitt to raise

millions in venture funding to design the first commercially

viable FPGA. The company was incorporated in 1984 and began

selling its first product by 1985.

By late 1987, the company had raised more than $18 million in

venture capital (worth approximately $33 million by today's

standards) and was generating revenues at an annualized rate

of nearly $14 million.

8.1 Technology

Xilinx designs, develops and markets programmable logic

products including integrated circuits (ICs), software design

tools, predefined system functions delivered as intellectual

property (IP) cores, design services, customer training, field

engineering and technical support.[1] Xilinx sells both FPGAs

and CPLDs programmable logic devices for electronic equipment

manufacturers in end markets such as communications,

industrial, consumer, automotive and data processing.

Xilinx's FPGAs have even been used for the ALICE (A Large

Ion Collider Experiment) at the CERN European laboratory on

Dept of ECE, SJBIT Page 41

TRAFFIC LIGHT CONTROLLER USING VHDL

the French-Swiss border to map and disentangle the

trajectories of thousands of subatomic particles.

The Virtex-II Pro, Virtex-4, Virtex-5, and Virtex-6 FPGA

families are particularly focused on system-on-chip (SoC)

designers because they include up to two embedded IBM PowerPC

cores.

They can run a regular embedded OS (such as Linux or

vxWorks) and they can implement processor peripherals in

programmable logic.

Xilinx's IP cores include IP for simple functions (BCD

encoders, counters, etc.), for domain specific cores (digital

signal processing, FFT and FIR cores) to complex systems

(multi-gigabit networking cores, MicroBlaze soft

microprocessor, and the compact Picoblaze microcontroller).

Xilinx also creates custom cores for a fee.

The ISE Design Suite is the central electronic design

automation (EDA) product family sold by Xilinx. The ISE Design

Suite features include design entry and synthesis supporting

Verilog or VHDL, place-and-route (PAR), completed verification

and debug using ChipScope Pro tools, and creation of the bit

files that are used to configure the chip.

Xilinx's Embedded Developer's Kit (EDK) supports the

embedded PowerPC 405 and 440 cores (in Virtex-II Pro and some

Dept of ECE, SJBIT Page 42

TRAFFIC LIGHT CONTROLLER USING VHDL

Virtex-4 and -5 chips) and the Microblaze core. Xilinx's

System Generator for DSP implements DSP designs on Xilinx

FPGAs. A freeware version of its EDA software called ISE

WebPACK is used with some of its non-high-performance chips.

Xilinx is the only (as of 2007) FPGA vendor to distribute a

native Linux freeware synthesis toolchain.

8.2 Current family lines

Xilinx has two main FPGA families: the high-performance Virtex

series and the high-volume Spartan series, with a cheaper Easy

Path option for ramping to volume production. It also

manufactures two CPLD lines, the Cool Runner and the 9500

series. Each model series has been released in multiple

generations since its launch.

The latest Virtex-6 and Spartan-6 FPGA families are said to

consume 50 percent less power, cost 20 percent less, and have

up to twice the logic capacity of previous generations of

FPGAs.

8.2.1 Spartan Family

The Spartan series targets applications with a low-power

footprint, extreme cost sensitivity and high-volume; e.g.

Dept of ECE, SJBIT Page 43

TRAFFIC LIGHT CONTROLLER USING VHDL

displays, set-top boxes, wireless routers and other

applications.[33]

The Spartan-6 family is built on a 45-nanometer (nm), 9-metal

layer, dual-oxide process technology. The Spartan-6 was

marketed in 2009 as a low-cost solution for automotive,

wireless communications, flat-panel display and video

surveillance applications.[34]

The Spartan-3A consumes 70-90% less power in suspend mode and

40-50% less for static power compared to standard devices.

Also, the integration of dedicated DSP circuitry in the

Spartan series has inherent power advantages of approximately

25% over competing low-power FPGAs.

CHAPTER-9

CONCLUSION

This paper proposed the development of thesmart traffic controller system. The use of a

Dept of ECE, SJBIT Page 44

TRAFFIC LIGHT CONTROLLER USING VHDL

microcontroller instead of other controllers, such asthe Programmable Logic Controller (PLC), makes thesmart traffic controller hardware a low cost system.The proposed manipulation techniques to save the useof microcontroller’s pin also can be implemented. Theprogramme downloaded into the microcontroller enablesthe microcontroller to have a high accuracy timing,high independency and consistently successful inperforming data interchange with the industrialcomputer. The developed software also works well asthe interface between the traffic controller hardwarewith the traffic sensors and the traffic expert. Thesoftware can be used to perform traffic datainterchange and it enables the proposed smart trafficcontroller system to realise several traffic flowoptimization strategies at a single or networkjunctions.

Dept of ECE, SJBIT Page 45

TRAFFIC LIGHT CONTROLLER USING VHDL

BIBLIOGRAPHY:-

Akanegawa, M., Y. Tanaka and M. Nakagawa. 2001. "Basic study on traffic information system using LED traffic lights." Intelligent Transportation Systems, IEEE Transactions on 2(4):197-203.

Alejandro Lopez, J., R. Garcia, A. Garcia Blanco and I. A. Zuniga Felix. 2007. "Traffic Lights Fuzzy Control Proposals to Improve Vehicular Flow." In Electronics, Robotics and Automotive Mechanics Conference, 2007. CERMA2007.

Alvarez, I., A. Poznyak and A. Malo. 2008. "Urban trafficcontrol problem a game theory approach." In Decision and Control, 2008. CDC 2008. 47th IEEE Conference on.

Chao, Kuei-Hsiang, Ren-Hao Lee and Meng-Hui Wang. 2009. "An Intelligent Traffic Light Control Based on Extension Neural Network." In Knowledge-Based Intelligent Information and Engineering Systems.

De la Escalera, A., J. M. Armingol and M. Mata. 2003. "Traffic sign recognition and analysis for intelligent vehicles." Image and Vision Computing 21(3):247-258.

De Schutter, B. 1999. "Optimal traffic light control for a single intersection." In American Control Conference, 1999. Proceedings of the 1999.

De Schutter, Bart. 2002. "Optimizing acyclic traffic signal switching sequences through an Extended Linear Complementarity Problem formulation." European Journal ofOperational Research 139(2):400-415.

Dept of ECE, SJBIT Page 46

TRAFFIC LIGHT CONTROLLER USING VHDL

www.vhdlprojects.com

www.vhdlarchive.com

Dept of ECE, SJBIT Page 47