Projects / Traffic light with flip-flops

Traffic light with flip-flops

Intermediate2 hGuided buildReviewed

Build it step by step

0 of 7 done
  1. Draw the state diagram

    Four states and the lamps for each.

  2. Build the clock

    555 and the timing parts.

  3. CD4017

    Add the counter

    Watch Q0 to Q3 light in turn.

  4. Wire the reset

    Q4 to reset.

  5. 74HC32

    Add the OR gates

    Red and amber outputs.

  6. 15.0 mA

    Fit the lamps

    LEDs with 330 Ω.

  7. Change the speed

    Swap the timing capacitor.

In short

How do you build a traffic light with flip-flops?

A counter and gates step through red, red-amber, green and amber with no code, a hardware state machine. You need CD4017 Counter, NE555 Timer IC, 74HC32 quad OR gate, LED 5 mm red, LED 5 mm yellow, LED 5 mm green, Resistor 330 Ω × 3, Resistor 10 kΩ × 2, Electrolytic capacitor 10 µF, Electrolytic Capacitor 100 µF, Breadboard 830 Tie Points, Jumper wires male to male (40 pcs, 20 cm) and Breadboard power supply module (MB102). It takes 7 steps and about 120 minutes.

Level
Intermediate
Time
About 120 min
Parts
13

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
555 pins 8 and 45 VPower and reset
555 pin 1GroundGround
555 pin 710 kΩ to 5 V, and 10 kΩ to pins 2 and 6Timing
555 pins 2 and 6100 µF to groundTiming capacitor
555 pin 3CD4017 pin 14 (clock)Slow clock about every second
CD4017 pin 10 (Q4)CD4017 pin 15 (reset)Wraps after four states
CD4017 pin 3 (Q0) and pin 2 (Q1)74HC32 pins 1 and 2Red is state 0 or 1
74HC32 pin 3330 Ω to red LED to groundRed lamp
CD4017 pin 2 (Q1) and pin 7 (Q3)74HC32 pins 4 and 5Amber is state 1 or 3
74HC32 pin 6330 Ω to yellow LED to groundAmber lamp
CD4017 pin 4 (Q2)330 Ω to green LED to groundGreen is state 2
Power pinsCD4017 pin 16 and 74HC32 pin 14 to 5 V, CD4017 pin 8 and 74HC32 pin 7 to ground, CD4017 pin 13 to groundChip supply

No code needed

A state machine remembers where it is and moves to the next state on each clock; a ring counter such as the CD4017 is the simplest memory, with one output high at a time, so Q0 to Q3 are the four states of a UK-style traffic light: red, red and amber, green, amber. Red is lit in states 0 and 1, so an OR gate joins those two outputs; amber is lit in states 1 and 3 so another gate joins those; green is state 2 and needs no gate. When the counter reaches state 4, the Q4 output is wired back to reset, so it starts again at state 0. The 555 clock with 10 kΩ, 10 kΩ and 100 µF ticks about once every 2 seconds, so change the capacitor to 10 µF for a faster demo. Draw the state diagram and a truth table before building; they give the wiring. Use a 5 V supply module on the breadboard, check chip pin numbers carefully, and unused inputs on the OR gate must be tied to ground; if the lights misbehave, the first things to check are the reset wire and the supply.

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
State 0Red only
State 1Red and amber
State 2Green only
State 3Amber only, then back to red

If it does not work

Stuck on one state

Check the clock output and the supply.

Never returns to red

Check Q4 to reset wire.

Wrong lamp

Check the OR gate inputs.

Too fast

Use a larger timing capacitor.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the traffic light with flip-flops?

CD4017 Counter, NE555 Timer IC, 74HC32 quad OR gate, LED 5 mm red, LED 5 mm yellow, LED 5 mm green, Resistor 330 Ω × 3, Resistor 10 kΩ × 2, Electrolytic capacitor 10 µF, Electrolytic Capacitor 100 µF, Breadboard 830 Tie Points, Jumper wires male to male (40 pcs, 20 cm) and Breadboard power supply module (MB102).

How long does the traffic light with flip-flops take to build?

About 120 minutes for a intermediate maker, in 7 steps.

How do I know the traffic light with flip-flops works?

State 0: Red only. State 1: Red and amber. State 2: Green only.

Stuck on one state: what should I check?

Check the clock output and the supply.

Never returns to red: what should I check?

Check Q4 to reset wire.

Wrong lamp: what should I check?

Check the OR gate inputs.

Too fast: what should I check?

Use a larger timing capacitor.