tlc using vhdl

30
TRAFFIC LIGHT CONTROLLER USING VHDL Dept of ECE, JJTU Page 1 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 the vision of traffic as a collection of independent vehicles – have been proved to be very accurate. Traffic optimization comprises a set of different problems, from which one of the most relevant ones is the traffic light cycles optimization. This paper aim to propose an intelligent traffic light additional component that is a monitoring system to improve traffic light configuration. It will be in the intelligent traffic light system. Thus, an intelligent traffic light system will be composed of two components(or subsystems): a monitoring system and a control system will able to integrated together to aid the traffic light system to take the intelligent decisions efficiently. This research will be investigating on the additional component (monitoring system) by using small associative memory. This system will be able to determine three street cases (empty street case, normal street case and crowded street case). The input of this system will be a sequence of images of vehicles of the intersection to be monitored. Technically, the proposed approach has two phases: training phase and recognition phase by use one video camera to every street in the intersection. These cameras fixed in a suitable position regardless camera distance from the street zebra crossing to obtain the best possible view.

Upload: narencool05

Post on 16-Apr-2015

67 views

Category:

Documents


2 download

DESCRIPTION

full report

TRANSCRIPT

Page 1: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 1

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 the vision of traffic as a collection of independent vehicles – have been proved to be very accurate. Traffic optimization comprises a set of different problems, from which one of the most relevant ones is the traffic light cycles optimization. This paper aim to propose an intelligent traffic light additional component that is a monitoring system to improve traffic light configuration. It will be in the intelligent traffic light system. Thus, an intelligent traffic light system will be composed of two components(or subsystems): a monitoring system and a control system will able to integrated together to aid the traffic light system to take the intelligent decisions efficiently. This research will be investigating on the additional component (monitoring system) by using small associative memory. This system will be able to determine three street cases (empty street case, normal street case and crowded street case). The input of this system will be a sequence of images of vehicles of the intersection to be monitored. Technically, the proposed approach has two phases: training phase and recognition phase by use one video camera to every street in the intersection. These cameras fixed in a suitable position regardless camera distance from the street zebra crossing to obtain the best possible view.

Page 2: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 2

CHAPTER-2

TYPES OF TRAFFIC LIGHT MODEL

This subsection provide a survey of the literature related to traffic light systems, highlighting most of the traffic light models (i.e., queue traffic light, fuzzy traffic light, Petri- net traffic light and LED traffic light) that were developed to improve traffic light efficiency.

2.1. Queue traffic light model The queue traffic light model was developed in traffic engineering studies. Vehicles arrive at an intersection controlled by a traffic light and form a queue. Many researchers evaluated the queue lengths in each lane using different techniques depending on street width and the number of vehicles that are expected at a given time of day. In this model, traffic light efficiency is effected when unexpected events happen (traffic accidents) causing disruption to the flow of vehicles. For example, Fathy and Siyal (1995) proposed a queue detection algorithm that consists of motion detection and vehicle detection operation. Both are based on extracting the edges of the scene to reduce the effects of variations in lighting conditions.Jin and Ozguner described (1999) a combination of multidestination routing and real time traffic light control based on a concept of cost-to-go to different destinations. This traffic light model is also a decentralized control approach. A general formulation for delays on a road section was developed by De Schutter (1999). He discussed how optimal and suboptimal traffic light switching schemes can be determined. First, they constructed a model that described the evolution of queue length (as continuous variables) in each lane.Next, he showed how optimal and suboptimal traffic light switching schemes (with possibly variable cycle lengths) can be determined. Xiaohua and Yangzhou (2003) introduced a hybrid optimization system. They used the average queue length over all queues as an objective function to find an optimal traffic light switching scheme [57]. Leeuwaarden (2006) derived a probability generation function of both the queue length and delay from which the whole queue length and delay distribution could be obtained. This allowed for the evaluation of performance characteristics other than the mean, such as the variance and percentiles of distribution. A non-cooperative approach, which gives rise to a non-cooperative game, was studied by Alvarez and coworkers (2008). In this model, signalized intersections were considered as finite controlled Markov chains and a solution was sought to optimize the congestion into an avenue. Using a game theory method, they considered each intersection as a non-cooperative game where each player tries to minimize its queue. Helbing and Mazloumian (2009) discussed elements of signal control based on the minimization of overall travel times or vehicle queues. They found different operation regimes, some of which involve a “slower-is-faster effect”, where delayed switching reduced the average travel time. These operation regimes characterized different ways of organizing traffic flows in urban road networks. Besides the optimize-one-phase approach, they discussed the procedure and advantages of optimizing multiple phases as well. To improve the service of vehicle platoons and support the self-organization of “green waves”, considering the price of stopping newly arriving vehicles was proposed.

Page 3: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 3

2.2. Knowledge based traffic light models Knowledge based systems are artificial intelligent tools that work in a narrow domain to provide intelligent decisions with justification. Knowledge is acquired and represented using various knowledge representation rules, frames and scripts. Many researchers have used knowledge based systems to developed traffic light systems. For example, Findler and coworkers (1997) described a distributed, knowledge-based system for real-time and traffic-adaptive control of traffic signals. The first of a two-stage learning process optimizes the control of steady-state traffic at a single intersection and over a network of streets. The second stage of learning deals with predictive/reactive control in responding to sudden changes in traffic patterns.Wen (2008) proposed a framework for a dynamic and automatic traffic light control expert system. The model adopts inter-arrival time and interdeparture time to simulate the arrival and leaving number of cars on roads. This model used a knowledge base system and rules. Depending on the traffic light data, which are collected by a RFID reader, this model makes decisions that are needed to control the intersections. Other researchers have developed fuzzy control systems, which are mathematical systems that analyze analog input values in terms of logical variables that take on continuous values between 0 and 1 based on fuzzy logic. This type of control system consists of three components. First, fuzzy elements have degrees of membership. Second a membership function is created, which is a curve that defines how each point in the input space is mapped to a membership value (or degree of membership) between 0 and 1. Third, if-then rules are applied, which are used to formulate the conditional statements that comprise fuzzy logic. In general, many theoretical papers on control of traffic systems using fuzzy statements have been published. For example, Kaur and Konga (1994), described the design of a fuzzy traffic light controller at the intersection of two streets that changes cycle time depending upon the densities of cars behind green and red lights and the current cycle time. A fuzzy model of the system has been built and tested to predict the behavior of the model under different traffic conditions. A realistic approach to fuzzy control of urban road traffic lights was described by oyer and Jumar (1994a).Fuzzy application is encouraging since the design procedure of vehicle actuated traffic light systems is very transparent, and an adaptation to the changing situations of traffic is easy to Accomplish.Khalid and coworkers (2004) proposed a fuzzy traffic light controller to be used at a complex traffic junction. The proposed fuzzy traffic light controller is capable of communicating with neighboring junctions and manages phase sequences and phase lengths adaptively. Average flow density, average delay time and linkoverflow of the intersections are used as performance indices for comparison purposes. GiYoung and coworkers (2001) created an optimal traffic signal using fuzzy control. Electro sensitive traffic lights have better efficiency than fixed preset traffic signal cycles because they are able to extend or shorten the signal cycle when the number of vehicles increases or decreases suddenly. They used fuzzy membership function values between 0 and 1 that estimate the uncertain length of a vehicle, vehicle speed and width of a road. They stored different kinds of conditions such as car type, speed, delay in starting time and the volume of cars in traffic. A traffic light controller based on fuzzy logic was proposed by Kulkarni and Waingankar (2006) to be used for optimum control of fluctuating traffic volumes, such as over saturated or unusual road conditions. The rules of a fuzzy logic controller are formulated by following the same protocols that a human operator would use to control the time intervals

Page 4: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 4

of the traffic light. The length of the current green phase is extended or terminated depending upon the 'arrival'; i.e. the number of vehicles approaching the green phase, and the 'queue' that corresponds to the number of queuing vehicles in red phases.Pedraza and coworkers (2008) detailed the design of a traffic system model for vehicles that examined the traffic traveling through a series of traffic lights on a main road. The adaptive network-based fuzzy inference system was used to synchronize the time of duration and phase angle of the traffic lights, and also maintain the maximum possible velocity of the vehicles traveling on the road. A complex adaptive system (CAS) is a network of communicating, intelligent agents where each agent adapts its behavior in order to collaborate with other agents to achieve overall system goals. The overall system often exhibits emergent behavior that cannot be achieved by any proper subset of agents alone. The classifier event action block can implement both crisp and fuzzy rules. This system uses one network of traffic light controller agents at each intersection. Each traffic controller agent uses a fuzzy classifier block to make decisions about traffic light timing in order to minimize local vehicle wait time. Hong and coworkers (2001) presented concepts that described a main urgent phase and minor urgent phase. The traffic data are acquired from the detectors in the intersections and lanes. Based on the concepts of main and minor urgent phases, a set of novel fuzzy control rules is developed to control the phases and delay of traffic lights according to the dynamic characters of some correlative traffic intersections. An electro sensitive traffic light, using a smart agent algorithm to reduce traffic congestion and traffic accidents, was proposed by Hong and coworkers (2007). Specifically, they designed and implemented a system to create optimum traffic signals in congested conditions using smart agent algorithms. This approach antecedently created an optimal traffic cycle of passenger car units at the bottom traffic intersection. Mistakes were possible due to different car lengths, car speeds, and the length of the intersection. Therefore,this approach consequently reduced car waiting times and start-up delay times using fuzzycontrol of feedback data. An application of diffuse systems in traffic lights for the road control of urban transit was proposed by Lopez and coworkers and Alejandro and coworkers (2007). Given vehicular problems of the city, it was intended to look for options to make vehicular traffic more agile. With this in mind, three proposals for diffuse control design were formulated. The first proposal was the control of two traffic lights for cars placed in a crossing of a few streets. The functioning of the traffic light was typical (green-amber-red). The system included sensors entrusted to indicate the pace of arrival of the cars and the length of the trail of cars at a certain moment. The principal street had one sensor and the lateral street had another sensor. Second, the proposal had, as a basic principle, the modification of the traffic light timing around a predetermined nominal value. Such a nominal value was calculated based on normal traffic conditions in a determinate cross road, using standard traffic theory and criteria. The objective of the fuzzy controller was to dynamically adjust the timing of each light stage to support variations in vehicular load, such as during rush hours. Finally, the third proposal was to optimize the flow of vehicles in the street. This was carried out by defining the times that each light of the traffic light remained lit. This proposal has a fuzzy inference system (FIS) control where the input variables for the control are car density and waiting times.

Page 5: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 5

The weakness of all these approaches is the fact that the systems use expert system technology but do not provide any guarantee about the quality of the rules; i.e., an expert system/rule based approach is not ideal for problems that require considerable knowledge. In addition, easily creating and modifying rules can destroy any system. A knowledgeable user can add no value rules or rules that conflict with existing ones.

2.3. Traffic light models based on wireless communication Wireless communication is the transfer of information over a distance without the use of enhancedelectrical conductors or wires. The distances involved may be short (a few meters, as in television remote control) or long (thousands or millions of kilometers for radio communications). There are many problems with systems that use wireless communication. One of the problems is the already limited spectrum available for communications. Another problem is splitting up the environment into a number of small cells, which increases the overall accessible bandwidth of the communication system, but also increases the cost as more cell sites are required. Some form of encryption is required for communications to avoid interception of data transmitted over the network by devices not taking part in the communications. In addition to security considerations from external devices accessing the network, interfering signals can be generated by other devices in the environment. These devices can temporarily disrupt a communication link through the noise that they generate. Other researchers used a wireless sensor network to develop such a system. For example, Ibrahim etal. (2005) developed software planning tools for wireless LAN link optimization as an intelligent traffic light system control. This software was based on the combination of Matlab and MapInfo software, which gives grouping parameters to build up the software development. The traffic light site selections must include line-of-sight (LOS) field strength predictions for either point to point or point to multipoint situations.Miguel etal. (2006) proposed the use of a wireless sensor network to enable car drivers to have more energy efficient city driving via finding an interaction communication between drivers and traffic lights.Gradinescu etal.(2007) presented an adaptive traffic light system based on wireless communication between vehicles and fixed controller nodes deployed in intersections. A smart transport and road communications model was presented by Kun-chan et al. (2007) based on a wireless mesh network architecture, connecting a hierarchy of several thousand devices, from individual traffic light controllers to regional computers and the central traffic management centre (TMC), that placed stringent requirements on the reliability and latency of the data exchanges. Tubaishat etal. (2008) studied the performance with one sensor and two sensors and designed corresponding controllers. In the case of one sensor, two models were developed: the first one detected passing vehicles only; whereas, the second one detected vehicles that passed the sensor or stopped at it. In both methods, the change of the sensor location was relative to traffic light location. They then used two sensors to calculate the number of vehicles waiting or approaching a traffic light. They tested different distances between the two sensors. Researches who use wireless sensor networks face serious challenges, such as the problem of providing power to such sensors, in addition to the difficulty of determining the distance between the sensors in the case of needing more than one sensor.

Page 6: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 6

2.4. LED traffic light models Light-emitting diodes (LEDs) are semiconductor devices that are capable of fast switching ON and OFF. This means LEDs can be used for communication purposes. In addition to the normal function of being an indication and illumination device, LED traffic lights can also be used as transmitters. Although, research on wireless optical communication using LED traffic lights has been performed, this type of system would require replacement of all traffic lights. In addition, receivers (e.g., cameras) would need to be located in the front of vehicles. Ibrahim and Beasley (1998) discussed the technical aspects of LED traffic lights and provided estimates on expected savings if all the traffic lights were to be replaced by LEDs. Akanegawa et al. (2001) proposed a traffic information system using LED traffic of traffic lights, and movement toward use of LED traffic lights. Finally, Wada et al. (2005) proposed a parallel wireless optical communication system for road-tovehicle communication that uses a LED traffic light as a transmitter and a high-speed camera as a receiver. The proposed system enables multi-chaneling in a two dimension arrangement and spatial dividing ability. LED transmitters arranged in the shape of a plane are modulated individually and a camera is used as a receiver for demodulating the signals by using image processing techniques.

2.5. Traffic light models using an extension neural network (ENN)

The extension neural network (ENN) consists of extension theory and a neural network that uses a modified extension distance (ED) to measure the similarity between data and a cluster center. ENN is another traffic light control system developed to deal with object recognition in outdoor environments.In outdoor environments, lighting conditions cannot be controlled or predicted, objects can be partially occluded, and their position and orientation is not known a priori. The chosen objects are traffic or road signs, due to ease of sign maintenance and inventory in highways and cities, driver support systems and intelligent autonomous vehicles. A genetic algorithm is used for the detection step, allowing invariance localization to changes in position, scale, rotation, weather conditions, partial occlusion, and the presence of other objects of the same color. A neural network can achieve classification. Kuie etal. (2008) and chao et al. (2009) have presented an intelligent traffic light control method based on extension theory for crossroads. First, the number of passing vehicles and maximum passing time of one vehicle within the green light time period are

measured in the main-line and sub-line of a selected crossroad. Then, the measured data are adopted to construct the extended matter-element model and accordingly the correlation degrees are calculated for recognizing the traffic flow of a standard crossroad. Some experimental results were obtained to verify the effectiveness of the proposed intelligent traffic flow control method. The diagnostic results indicated that the proposed estimated method can discriminate the traffic flow of a standard crossroad rapidly and accurately and These researchers, however, did not take into account unexpected situations that may cause disruption in the flow of vehicles, where the ENN is used for estimation. Also, the ENN tends to be slower to train than other types of networks (e.g., a single layer neural network) for two reasons. First, a large number of iterations are needed to finish learning all the prototypes. Second, the large amount of data needs large networks. Therefore, the network size should be as small as possible to allow for efficient computations. Sometimes, reducing the size of these data sets leads to ignoring some factors that could improve the estimation process for the flow of vehicles.

Page 7: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 7

2.6. Agent based traffic light models A number of researchers turned to developing agent based traffic light models. For example, an agent based approach for traffic light control was adopted by Hirankitti and Krohkaew (2007). According to this approach, the system consists 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 road junction by an observe-think- act cycle. That is, the agent continuously observes the current traffic conditions by collecting traffic data, and then the data is used for reasoning with the traffic-light control rules by the agent’s inference engine to determine how a signal will be changed on each traffic light near each junction. Use of inference engine techniques requires the use of a knowledge base. Therefore, using a large knowledge base will have an effect on the efficiency of the traffic light system because of storage space and the time it would take for decision making, in addition to the quality of rules for decision-making. Although, a penalty for converting electronic signals to optical signals (to realize optical interconnects) and vice-versa must be paid, because of the clear differences between the speed of the data communication and processor speed, many researchers have continued interest in the marriage between photonics and electronics. For example, an agent based traffic lights logic algorithm, developed by Krajzewicz et al. (2005) used the length of a jam in front of a traffic light as input along with information from the optical information system (OIS) sensors. This research observes the incoming lanes and measures the jam lengths on these lanes. If at one of these lanes the jam gets longer, this lane gets a green for a longer time.

2.7. Reinforcement learning traffic light models Researchers have used reinforcement learning to improve traffic light configurations, which is a sub-area of machine learning concerned with how an agent ought to take actions in an environment to maximize some notion of long-term reward. For example, Wiering et al. (2004) studied simulation and optimization of traffic light controllers in a city and presented an adaptive optimization algorithm based on reinforcement learning.They implemented a traffic light simulator to experiment with different infrastructures and to compare different traffic light controllers.Nijhuis et al. (2005) described an existing approach of reinforcement learning applied to the optimization of traffic light configurations. This approach used implicit cooperation between traffic lights while letting cars take into account the traffic situation of the road ahead.These two researches used different knowledge representation, dependent on the reinforcement learning machine. Also,the action value function, which is difficult to analyze especially in a case of a large domain, was different. The rules are usually much easier to interpret unless there are too many of them. Another disadvantage of these two approaches was the necessity of tuning parameters, which meant the choice of these parameters had a high impact on the results. Finally, due to necessary exploration (exploring the environment), the algorithm's performance is less stable.

2.8. Genetic algorithm traffic light models A genetic algorithm (GA) is an evolutionary algorithm. GAs have been presented since the early 1960s and they apply the rules of nature, such as evolution occurs through selection of the fittest individuals and individuals can represent solutions to a mathematical problem.

Page 8: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 8

Some researchers have used GAs to improve traffic light configurations. For example, Sanchez et al. (2008) presented a new architecture for the optimization of traffic light cycles in a traffic network. The model is based on three basic design items: the use of genetic algorithms as an optimization technique, the use of cellular automata simulators within the evaluation function, and the use of a cluster as a parallel execution environment for this architecture.Although, a great advantage of GAs is the fact that they find a solution through evolution, this is also the greatest disadvantage. Evolution is inductive. In nature, life does not necessarily evolve towards a good solution; it can evolve away from bad circumstances. This can potentially cause a species to evolve into an evolutionary dead end.

Page 9: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 9

CHAPTER-3

Electronic design with FPGAs In most digital designs, the circuitry can be classified by the following categories:

• Standard products: These products provide a functionality which is not associated with a specific application area but common to a broad range of devices. Typical parts in this category are processors and memories.

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

• Custom Logic: This logic is associated with a specific application and is the essence what distincts one product from another. Often this is glue logic, connecting standard products or ASSPs with each other.

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

3.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 o Programmable fabric adds significant overhead

• No NRE and Re-Spin cost

• Low development effort o Low dead-time o simplified timing o No test vectors o Relaxed verification o Physical design is “hands-off”

Page 10: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 10

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.

Page 11: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 11

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).

4.2 Abbreviation used

� 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

• SN – Straight North SE – Straight East

• YN - Yellow North YE – Yellow East

• REDN – Red North REDE – Red East

Page 12: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 12

4.3 Flow Chart

Page 13: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 13

4.4 Experimental Set up

Figure : Traffic Light Interface to SPARTAN-3 FPGA

Page 14: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 14

4.5 State Transition Chart

Page 15: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 15

CHAPTER-5

WORKING PRINCIPLE

Traffic light Controller (TLC)

As mentioned earlier, digital controllers are good examples of circuits that can be effeciently implemented when modeled as state machines. In the present example, we want to design a TLC 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. 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.

Page 16: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 16

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 ---- use UNISIM.VComponents.all entity traffic_fsm is Port (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 is type 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(30 downto 0); begin process(clk,rst) begin if(rst = '1') then div <= (others => '0'); elsif(clk'event and clk = '1') then div <= div + 1; end if; end process; clk_s <= div(21); process(clk_s ,rst) begin if(rst = '1') then cnt <= (others => '0'); elsif(clk_s'event and clk_s = '0') then cnt <= cnt + 1;

Page 17: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 17

end if; end process; process(clk_s,rst) begin if (rst = '1')then ps <= start; elsif(clk_s'event and clk_s = '1') then ps <= ns; end if; end process; process(ps) begin case ps is when start => ns <= south_g; when south_g => if(cnt = 10)then ns <= south_orange; else ns <= south_g; end if; when south_orange => if(cnt = 14) then ns <= south_r; else ns <= south_orange; end if; when south_r => if(cnt = 15)then ns <= west_g; else ns <= south_r; end if; when west_g => if(cnt = 10) then ns <= west_orange; else ns <= west_g; end if; when west_orange => if(cnt = 14) then ns <= west_r; else ns <= west_orange; end if; when west_r => if(cnt = 15 )then ns <= north_g; else ns <= west_r;

Page 18: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 18

end if; when north_g => if(cnt = 10)then ns <= north_orange; else ns <= north_g; end if; when north_orange => if(cnt = 14)then ns <= north_r; else ns <= north_orange; end if; when north_r => if(cnt = 15)then ns <= east_g; else ns <= north_r; end if; when east_g => if(cnt = 10)then ns <= east_orange; else ns <= east_g; end if; when east_orange => if(cnt = 14)then ns <= east_r; else ns <= east_orange; end if; when east_r => if(cnt = 15)then ns <= south_g; else ns <= east_r; end if; when others => ns <= start; end case; end process; process(ps) begin red_s <= '0'; red_w <= '0'; red_n <= '0'; red_e <= '0'; rs <= '0'; rw <= '0'; rn <= '0';

Page 19: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 19

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 is when start => red_s <= '1'; red_w <= '1'; red_n <= '1'; red_e <= '1'; when south_g => ls <= '1'; rs <= '1'; 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';

Page 20: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 20

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'; 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'; red_e <= '1'; ps_r <= '1';

Page 21: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 21

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'; 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';

Page 22: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 22

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'; 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 the green light of South direction goes ON.

The signals that are ON, now are :-

Page 23: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 23

• ls ( left south ) –‘1’.

• 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 is ON 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 Orange light of South direction is ON 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 ON then the signals that are ON, now are:

• ls ( left south ) –‘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’.

Page 24: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 24

During this time all ways are Blocked for 1 second except left south ( ls-‘1’ ) and so on. After that 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; ------------------------------------------------- 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; END IF; END IF; END PROCESS; -------- Upper section of state machine: ---- PROCESS (pr_state, test) BEGIN

Page 25: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 25

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 => 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; ------------------------------------------------------------------------------------------------------- WHEN YY => r1<='0'; r2<='0'; y1<='1'; y2<='1'; g1<='0'; g2<='0'; nx_state <= RY; END CASE; END PROCESS; END behavior;

Page 26: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 26

CHAPTER-7

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. 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.

Page 27: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 27

CHAPTER-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. 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.H Xilinx sells both FPGAs and CPLDs programmable logic devices for [1] 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 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.

Page 28: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 28

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 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. 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.

Page 29: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 29

CHAPTER-9

CONCLUSION This paper proposed the development of the smart traffic controller system. The use of a microcontroller instead of other controllers, such as the Programmable Logic Controller (PLC), makes the smart traffic controller hardware a low cost system. The proposed manipulation techniques to save the use of microcontroller’s pin also can be implemented. The programme downloaded into the microcontroller enables the microcontroller to have a high accuracy timing, high independency and consistently successful in performing data interchange with the industrial computer. The developed software also works well as the interface between the traffic controller hardware with the traffic sensors and the traffic expert. The software can be used to perform traffic data interchange and it enables the proposed smart traffic controller system to realise several traffic flow optimization strategies at a single or network junctions.

Page 30: tlc using vhdl

TRAFFIC LIGHT CONTROLLER USING VHDL

Dept of ECE, JJTU Page 30

CHAPTER 10

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. CERMA 2007.

� Alvarez, I.A.Poznyak and A.Malo. 2008." Urban traffic control 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, Bart. 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 of Operational Research 139(2):400-415.

� www.vhdlprojects.com

� www.vhdlarchive.com