Real Life Traffic Signal Question

Engineer83

Member
Join Date
Mar 2007
Location
Wisconsin
Posts
3
Hello,

I have looked through some of the posts on traffic signals. I see they are a sore topic for homework assignments. However, this one is a real life issue at a construction site that I am on right now. We have a long single lane access drive which we want to control the traffic with (2) Red/Green Traffic Lights. We purchased a micro PLC hoping to utilize a simple program to control the lights.

We are going to pull a Hot to each lamp. Each lamp will be connected to a relay output on the controller. We want a 20 Sec - Red/Red, a 60 Sec Green/Red, 20 Sec Red/RED, and 60 Sec Red/Green sequence. We just want this to loop. If the power goes out, I want to press a function key to begin the sequence though. I also put in a status screen to show which lights are active. The bulbs are linked to the relay outputs.

I attached my attempt at this. I want to warn you guys it is rough at best because I design feeders and branch circuits otherwise (haha). It is my first attempt at PLCs in quite awhile. I used cascading timers to try to get the sequence. I am wondering if the expert PLC programmers have any thoughts on this attempt.

Your help would be greatly appreciated.

Traffic.JPG
 
It would probably be easier to follow if you just use a single timer that resets itself after 160 seconds. Then use "Greater Than" (or "Greater Than or Equal To") and "Less Than" (or "Less Than or Equal To") functions to control the relays.

In one direction the red light is on while the timer accumulator is between zero and 100 seconds and the green light is on while the timer is between 100 and 160 seconds.

In the other direction the red light is on from zero to 20 seconds and also from 80 to 160 seconds while the green light is on from 20 to 80 seconds.
 
I would use two tables. I would have a light table that has all the valid light combinations. The other table would have the duration for the light combination. I would change the preset time of the one timer based on the value in the duraction table. The index would be incremented when the timer times out and the new light combination would be copied to the outputs and the new duration loaded into the timer. Better yet would be to let the timer free run and subtract the old duraction from the timer and then compare the timer value with the next duration. What I don't like about Steves continous timer is that if you want to just add time to one combination of lights you must add the same amount to all the other entries. The index would be used to index to the light table and the whole word copied to the outputs. One can turn on and off lights are different points in the program but this is error prone that changing all the bits at once.

Tables can can easily be extended and the indexes can be manipulated so light patters can be skipped if no cars are waiting. One does need to check that the index is reset to zero when it is incremented past the end of the table.
 
Please seek legal advice before proceeding. A large bridge contractor is located a few miles from my home and a similar proposal was made to me. We were informed that such a controller would not meet the Indiana traffic signal specifications.

Food for thought:

What happens if a momentary power outage resets all your timers?
 
Good question.

cdisher said:
What happens if a momentary power outage resets all your timers?
That is why all the outputs are written at the same time and there is only one timer. In my example the timer would just keep the current light combination on until it eventually times out or the fail safe blinking red light circuit takes over. In reality I wouldn't trust a PLC or even a microcontroler. I would have a custom made embedded FPGA or ROM based circuit that can handle all the fault conditions.
 
I appreciate the quick replies from everyone. The drive would be private property and is really long. There is relatively little chance of a car vs. car accident because if it did fail they would be driving head to head with more than adequate braking distance. The problem now is that they end up driving in reverse to let the other through, etc.

Here is the latest attempt using a single timer and functions to control the relays as Steve suggested.

traffic2.JPG
 
You have two rungs driving the NorthRed output and the second one will overwrite the first. You need to combine the comparison logic into one rung.
 
Yes, what LD said. Here is a timing diagram. Looks like you have the times correct, except put all of north Red on one ladder rung.
Traffic_Light_Timing_Diagram.JPG
 
Here I go being simple again.

Peronally not sure the first rung does anything special i.e. is needed but did not look at it too hard

Since this is a single lane with traffic only allowed one direction at a time.
Why not wire the North Red and South Green to one output and South Red and North Green to a second output. You can use separate outputs for each but they can be branched together on one rung in the program so when one Red is on the other Green is on.

For a 1/10 second timer use a preset value of say 3000, then just use the necessary Greater than or Equal to and Less than or equal to instruction to alternate the 2 outputs. If this GE may want to look at the Range instructions.

In this case the North Red and South Green would be on 150 secs then it alternate to North Green and South Red for 150 secs, you can adjust the time as wanted.

I am thinking 3 rungs for the basic operation.
 
Ron,

Perhaps you are forgetting the "travel time". If you do as you said, then there is no "delayed green" in each direction to allow any traveling car time to clear the lane. Then a car could be in the lane when the light turns green on the opposite end, and if a car also starts on that end, they will meet somewhere, one having to back up. That is what Engineer83 is trying to avoid.

These darn traffic lights are so complicated...No wonder that we all spend half our lives sitting at red lights! I hope that eventually traffic lights will become smarter, with infrared detectors or long range heat sensors to find when the other travel direction is empty of traffic as far as the eye can see.

For the typical traffic light, traffic counters for each direction would be a great time saver. As the vehicles pass under the light, a sensor counts the number of vehicles that had been waiting. The other direction is also counted. The direction with the most cars waiting gets its "green" time increased by 3 seconds for the next cycle (up to a maximum value), while the other direction gets decreased (down to a minimum value). This would be a continuous adjustment processs, so that traffic flow is maximized within reason. Many traffic lights already have vehicle sensors embedded in the pavement. Too bad they are not used to count the traffic.

Now I think most light cycle times are based on time-of-day, requiring a traffic engineer to decide how long for each time period. This method is too imprecise and does not maximize flow based on actual conditions (no feedback to the system). Traffic lights have to be one of the last pieces of equipment to have closed-loop controls.
 
Last edited:
Your right do need a delay factor i.e. both reds will need to be on at same time twice during the cycle. Use 4 outputs with one timer and overlap the timing ranges; probably what you were saying before.

May be easier and cheaper to go to www.trafficlights.com
 
Engineer,

For the North Red on Rung 5, should not your "Less Than 200" comparison statement be on a parallel branch, so that EITHER (Less than 200), OR (Between 800 and 1600) will turn on North Red?

Ron, interesting traffic light controller at trafficlights.com. You will have to keep that one in mind for the next student wanting a traffic light program!
 
Last edited:

Similar Topics

Hi , I was travelling home yesterday, and near where I live is a 4 way crossroads, with traffic lights. Unluckily for me, a car had broken down...
Replies
17
Views
7,664
Hi, I am trying to figure out what Pollution Degree our control panels must meet. FYI, this is one of the informations that MUST be labelled in...
Replies
0
Views
1,481
I have been tasked with reverse engineering a large oven control system. The controller is a DC Omron controller. My first two very high level...
Replies
14
Views
4,112
I am getting conflicting answers on this... I would like to use a 1768-ENBT as a rack adaptor for a distributed rack of 1769 I/O. I searched the...
Replies
6
Views
3,193
Hi Iam using monitouch hmi(V9 soft) with omron plc cj2m (CX programmer). In this I want to read a data from hmi to plc. The data was like...
Replies
0
Views
74
Back
Top Bottom