I'd love your help with implementation of traffic lights of 15 second cycle.

The red light is on for 6 seconds, then the yellow (At the same time with the red for two seconds), then the green light for 2 seconds(then it is flickering for three second- half on, and half second off), then the yellow is on for 2 seconds.

The cycle gets an input line with a time cycle of 1 second: "o" for half second and "1" for 1 second.

Given a three 16X4X1 muxes, a 4-bit-counter and no more than two logic gates.

Any suggestions? I quiet got lost with that.. How do I use this 4 bit counter (which counts modulo 4) to my question, I believe that I should send this information to the muxes.

  • \$\begingroup\$ 4 bit counter counts modulo 16 (2^4), not 4. I have not seen a mux described as "16x4x1", but if it is one with 16 data inputs, 4 selector inputs and 1 output then it can be done. \$\endgroup\$ – Pentium100 Feb 21 '12 at 12:04
  • \$\begingroup\$ @Pentium100 I can guess that is a decoder "4 to 16" with 1-bit path... something like a 74LS154 IIRC \$\endgroup\$ – Axeman Feb 21 '12 at 12:35
  • \$\begingroup\$ @Pentium100: Yes, it's the way you described it. \$\endgroup\$ – Jozef Feb 21 '12 at 13:09
  • 2
    \$\begingroup\$ @Jozef I think the issue here is that what you are asking for seems to be very arbitrary with little to no effort shown. Homework questions are fine, as long as they follow all of the standard policies that we place on questions. Generally when someone is presented with a problem we expect them to show some amount of effort, which doesn't seem to be shown here. Give us specific design problems that you are having, not a whole project. Maybe the Math site is used to arbitrary questions with no effort shown, but it is not the standard here. \$\endgroup\$ – Kellenjb Feb 21 '12 at 21:04
  • 1
    \$\begingroup\$ @Jozef If you are at the initial brainstorming stage of a project then chat is the best place for it. This question is like going to a group of mechanics and saying "I need to make a car, I have 1 motor and a transmission, I can't use anything else. I think the motor can be used to move the wheels, but I am not really sure where to go from here" \$\endgroup\$ – Kellenjb Feb 21 '12 at 21:19

I am assuming the output is 3 LEDs - if it is something that uses more current (or needs higher voltage, then you will have to buffer the outputs.

The only 16:1 mux I found was 74150, which has an inverting output. If your mux has a non-inverting output then you will have to invert the inputs :)

Anyway, set the counter up to count from 0 to 12, connect each LED to its own mux and tie the input of the mux to VCC (if you want the LED to be on during that time), ground (if you want it to be off or the 1Hz clock (if you want it to blink). This example circuit works in simulation, it should work in real life too.

The NAND gate and inverter reset the counter when it reaches 13 - as the counter is asynchronous, the reset is very fast and the time that all LEDs are off should be very short (microseconds). You should also build some reset circuitry so it resets the counter on power-on but it would require more components.

example schematic

  • \$\begingroup\$ If one wants to have signals for both directions of traffic, one could extend the circuit by adding a moderate-frequency clock (e.g. 60Hz), an xor gate, and an inverter. Feed the clock into the xor gate and the inverter. Use two sets of LED's, with cathodes wired as shown. Connect the anodes of one set to the inverted clock (via resistor), and the anodes of the other set to the non-inverted clock. A bit tricky, but a useful technique to know. \$\endgroup\$ – supercat Feb 21 '12 at 16:07

Part of your description is a bit garbled, but here is what I think you are asking: You need to control three lights. Each will go thru a separate pattern with everything repeating in 15 second periods. You have a 1 Hz square wave that is to be used as the reference clock.

You mention one implementation method using muxes and logic gates, but give no justification for why you think that is the best answer or any constraints why they need to be used, so I'll just ignore that.

The obvious answer is a microcontroller. Even the smallest cheapest of them all, the PIC 10F200 can do this. It has 4 I/O pins and can be configured to 1 input and 3 outputs, which is exactly what you need. It can also generate its own timing, so you could ignore the 1 Hz input if you wanted to and use interal timing.

In either case, this is a very simple program. Nothing changes faster than on 500 ms boundaries. Since the whole pattern repeats every 15 seconds, you have only 30 possible different states. A very simple and also robust firmware implementation is to have a table of all 30 states. Each 500 ms clock edge, the firmware advances to the next table entry and copies the 3 bit value to the output pins. This is very simple, but allows for easy modification of the display pattern as requirements evolve because only the table entries need to change. The logic stays the same. A 10F200 has 255 usable instructions, which is plenty for the simple clock edge detect, table lookup, output update, and then the table itself.


Synchronous counters almost always come with a reset line, so a 4-bit counter can count to a maximum of 16 cycles, but can count in cycles of less than that. (Hint: if you reach count #N and assert reset, the next count will be #0, so that counts from 0 to N = cycle length N+1)

Presumably your clock input is a 1HZ 50% duty cycle clock with which you could implement blinking (0.5sec on 0.5 sec off) as described.

The rest should be fairly trivial with combinational logic.

  • \$\begingroup\$ But he has strict requirements on components: for instance he can use only 2 logic gates, probably is a constraint from the assignment. \$\endgroup\$ – clabacchio Feb 21 '12 at 15:19
  • \$\begingroup\$ see Pentium100's answer: it describes a reasonable circuit that does what I suggested. \$\endgroup\$ – Jason S Feb 21 '12 at 15:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.