Variable Traffic Controller
Our project is a Traffic Controller that is sensible to traffic condition and adjust the traffic lights accordingly.
Our project tries to simulate the traffic at an intersection, and with the use of sensors (Hall Effect in our case), we adjust the traffic of the intersection base on both the waiting time at the traffic light, as well as the rate at which cars passes the particular traffic light. We decided to have 3 levels of traffic condition, which leads to a total of 6 combinations of traffic conditions. Using these we are able to generate the appropriate timing for the traffic lights.
The software consisted of three parts:
- Traffic Light: The traffic light system itself;
- Users’ Inputs: The input from the pedestrian;
- Sensors’ Inputs: The input from the sensors and the mechanism which modifies the traffic condition.
The hardware consisted of three parts as well:
- The Model: Where we simulate and test the traffic controller;
- Breadboard: The intermediate point from the STK 500 board to the model that includes extra processing for some components;
- STK 500: the board in which takes the inputs and generates the outputs accordingly.
High Level Design
For most of everyone, whenever we go out to somewhere reasonably far, we’d probably drive a car (unless you don’t have a car, and/or even a license like me (Raymond). As a driver, it’s almost certain that every time you drive, you are going to hit something: not a person, not a car, not a lamp pole or anything of that sort (hopefully), but you sure going to “hit” a traffic light.
Since it’s almost impossible to live without a car nowadays, traffic jam is always a big pain whether it’s the city or not; so we came up with the idea, designing a smart traffic control system.
The components are separated very clearly. The traffic controller runs with certain preset values, and after it begins it will adjust the traffic base on the input from either the pedestrian(s) or one or more of the four sensors. These input will lead to one of the 6 different conditions, and the traffic lights are adjusted accordingly.
The project utilizes both software and hardware to accomplish its goal. To detect the traffic we need to use both the traffic sensors and the programmed development board to read and process the sensor input, it’s important as we could not have done this without either one of them. The similar technique applies to the pedestrian inputs as well, with the exception that simple logic unit is added to save I/O ports. The traffic controller itself, on the other hand, is mostly done by the software controller in the programmed chip, it’d be very complicated to do this with pure hardware, and software is therefore the choice to go.
The most important and tricky part of the code is the traffic sensor. We have to detect a different sensor input from each direction. At the same time, the opposite directions on the same road are somewhat related to each other. Thus it’s very hard to determine what goes on when the two directions traffic are combined, and it’s tricky in terms of how to do the math and determine the traffic condition.
In our design we separate all the asynchronous inputs from the normal, or regualar, traffic light system. The two pieces are just add-on to the regular system and thus doesn’t change it functionality by much. The first part is the pedestrian inputs, we utilize the push buttons on the STK 500 board and then feed these button input to an AND gate (originally we would be using 4-inputs AND with 4 pedestrian inputs on each road, due to time limitation we are only using 2-inputs AND with 2 pedestrian inputs instead) and its output is connected to the input pin of the appropriate PORT. As a result of that we are only using 1 pin for all of the pedestrian inputs, whether it’s 4 or 2 pedestrian inputs, we can use 1 pin to detect that as either one of them will activate the same routine of modifying the traffic light.
On the other hand, since each sensor activates their own routine, they each need a specific pin to feed the input, we only use 2 per road, thus there’s only 2 inputs per road, making a total of 4 inputs, but it is very possible that there’s more sensor inputs in diffrerent designs.
After detecting the wait time and rate of traffic, the system adjust the traffic base on these values, and update the system status, there’s six different presets to select from, and the system is updated every “cycle”, which is the time it takes for the traffic lights to go back to the same state it was from.
Initially, we tried the Hall Effect sensor by connecting Vcc pin to power, Gnd pin to ground, and output pin directly to the port of the micro. The result is that when the sensor is off, the output voltage is zero; when the sensor is on, the output voltage is less than 0.1. This makes it difficult for us to use the sensor because it is logic ‘0’ when it is both on and off.
To solve this problem, we first consider a voltage amplifier that will amplify the voltage high enough to be seen as logic ‘1’ when the sensor is on. However, it is difficult for us to determine how much the voltage should be amplified so that it is reliably above the switching voltage of around 3V.
Hall Effect Switches Part Number: UGN-3030T Company: All Electronics Corp. Quantity: 3 (× 2 Switches) Price Total: $3.60 Magnets Company: Staples Inc. Quantity: 1 (× 10 Magnets) Price Total: $2.00 Orange Clear LED's Part Number: P588-ND Company: Digi-Key Corp. Quantity: 1 (× 10 LED's) Price Total: $2.80 ----------------------------------- Total Cost of Design: $2.80 + $2.00 + $3.60 = $8.40
For more detail: Variable Traffic Controller
Leave a Comment
You must be logged in to post a comment.