Digital Design for a traffic light controller

Status
Not open for further replies.

metalmisers

Junior Member level 2
Joined
Mar 4, 2012
Messages
22
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,457
Greetings.

I am trying to design a traffic light controller using logic gates. I will be using a red LED and a green LED. First the red LED stays on for 15 seconds and then turns off after which the green LED turns on for 60 seconds and repeats itself. Then the process starts repeating itself. Since I have been using D flip-flops there are about 150 states so that requires 8 D type flip flops and the state table is huge. Anybody has an idea how i can do this easily without going into so many states?

Thanks.
 



The green LED turns on for 60 seconds, then goes off, then back on again for 60 seconds?
 

Nope, First the red led turns on for 15 seconds while the green led is off. Then the red LED turns off and the green led turns on for 60 seconds. Then it repeats from the beginning.
 

Sounds to me as though a 3-bit counter would do the job.

1) Clock the counter every 15 seconds
2) detect a count of 5 and do an immediate reset (or detect 4 and reset on next clock)
3) feed the red LED from bit 2 of the counter, so red LED is only on for a count of 4
4) feed the green LED via an inverter from bit 2 of the counter

If this does not do what you want, then maybe you should post a timing diagram. Your description is unclear.

Warning - I have not actually tried this circuit, only imagined it in my head - I could be wrong.
 

The 4017 IC (decade counter) is suited for this role.

It has ten outputs. Each output goes high, in rotation, as clock pulses arrive.

You would drive it with pulses at a clock period of 15 sec.
 

Nope, First the red led turns on for 15 seconds while the green led is off. Then the red LED turns off and the green led turns on for 60 seconds. Then it repeats from the beginning.

According to workflow as described, a 5 stages state machine could do that:

 
How would i draw a state table from this state diagram? My head is really confused right now, could you just possibly send a hint?
 

I just draw the above diagram for modeling purpose.

Due to its simplicity, a counter Modulo 5 ( 0-4 ) could do that. Once you specified working behavior for each light on an inverted logic for another, in fact you would deal with a single variable.

You probably is aware that a real word traffic light is not so simple.



+++
 

Counter designs begin with a clock frequency that determines the counter resolution. in this case 15 seconds or 4ppm. Clocks this slow can be derived using binary counters such as CD4020, Then you only have to count 4 states such as with a Johnson counter CD4017 using 4 of 10 states and gating state 0 then combining 1,2,3 YOu could go faster such as 5 seconds and insert yellow for 5 as the clock resolution. and using more bits in gating the states required.

Of course real light signals are programmable with 1 second resolution with any cycle duration and repetitive rate and a backup method with external sync.
 

Use microcontroller....
 

Yup, the binary counter is much useful for me if i want a precise 15 second time, but i got to manage that with a 555 timer. The rest was the transition from state diagram to the state table, thanks a lot anyway.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…