Skip to content
Tactiverge

Tactiverge BuildBUILD 005

Build a Traffic Management System

A busy crossroads, a queue of buses, a pedestrian pressing the button and an ambulance on its way. Can you design lights that keep everyone safe and still keep the traffic moving?

Start buildingWatch first60 min · browser only · free

Live build-along: not scheduled yet. Everything here works on your own, any time.

Why it matters

Traffic lights are one of the most common safety-critical controllers in the world, and their timing shapes how long millions of people wait every day. They are a clear example of competing requirements: pedestrians, drivers, buses and emergency vehicles all want different things, and the controller can never trade away safety to give them it.

Your objective: Design the controller for a virtual crossroads as a state machine: choose the states and transitions, guarantee that conflicting directions are never green together, fit in pedestrian crossings, and let an emergency vehicle take priority safely.

  1. 1.

    The states

    At any moment the junction is in exactly one state, such as 'north–south green'. The controller's whole job is choosing the next one.

  2. 2.

    The clearance

    Amber and a short all-red gap give cars already in the junction time to leave before anyone else goes.

  3. 3.

    The button

    A pedestrian press is remembered until it is served, even if the person stops pressing.

  4. 4.

    The siren

    An emergency vehicle can ask for priority, but the lights still pass through amber and all-red to get there safely.

Watch (optional, short)

Hand-picked explainers from their creators. Each one has a reason to watch it. Skip them if you’d rather just build.

Introduces machines that run on states and transitions, the same idea a traffic-light controller uses.

8 min 51 s · captions on YouTube · source

Nothing loads from YouTube until you press play.

Introduces AND, OR, NOT and XOR, the building blocks behind every digital decision a computer makes.

10 min 7 s · captions on YouTube · source

Nothing loads from YouTube until you press play.

The engineering you’ll use

State machines

A system described by its states, the events that move it between them, and what it outputs in each state. Traffic lights are a textbook example.

Safety interlocks

Some combinations must never happen. Write them as logic and check them in every state, not just the ones you expect.

conflict = NS_green AND EW_green (must always be 0)

Memory (latching)

The controller needs to remember that the button was pressed. A latch holds a 1 until the crossing is served and it is reset.

Cycle and green share

The cycle time C is one full round of all phases. The fraction of time a road is green sets how many cars it can pass.

C = Σ phase times, green share = g / C

Average wait

If cars arrive at random times and queues clear quickly, the chance of meeting red is r / C and the average wait for those who do is r / 2. A 90 s cycle with 60 s of red gives an average wait of 20 s.

average wait ≈ r² / (2C)

Capacity

Queued cars leave one every 2 s once a green has been on for 2 s, and none leave on amber. So a green of g seconds lets about (g − 2) / 2 cars through on each approach.

cars per hour ≈ ((g − 2) / 2) × 3600 / C

Priority by interrupt

An ambulance's siren request interrupts the normal timetable: the controller cuts the conflicting phase short after its minimum, still runs amber and all-red, then holds the ambulance's green until it is through.

Connects to: Super-loops and finite state machines · Logic gates and Boolean algebra · Sequential logic and memory · Decisions and loops · Interrupts and event-driven code · Real-time computing on robots · Optimisation and gradient descent · Constraints, budgets and trade-offs · Robot safety and ethics · Testing and debugging

Same machine. Five ways in.

Pick the level that feels like a stretch, not a wall. You can switch any time, and your work saves to your Workshop.

◇ Explorer · Read the junction

Judge six moments at a crossroads as safe or a conflict, then say what the lights must show next at three moments in the cycle.

You’ll make: Six correct safe / conflict judgements and three correct next states.

Checked instantly on our server

1 · Safe, or a conflict?

Six moments at the same crossroads. Could any two paths cross right now?

Junction 1

WAITWAITWAITWAITNS GREENEW RED

North–south green, east–west red, pedestrians don't walk.

Junction 2

WAITWAITWAITWAITNS AMBEREW GREEN

North–south amber, east–west green, pedestrians don't walk.

Junction 3

WALKWALKWALKWALKNS REDEW RED

North–south red, east–west red, pedestrians walk.

Junction 4

WALKWALKWALKWALKNS GREENEW RED

North–south green, east–west red, pedestrians walk.

Junction 5

WAITWAITWAITWAITNS REDEW RED

North–south red, east–west red, pedestrians don't walk.

Junction 6

HURRYHURRYHURRYHURRYNS REDEW AMBER

North–south red, east–west amber, pedestrians flashing don't walk.

2 · What comes next?

At the live build-along

60 minutes, building together

Team challenge
Teams of three get the same junction and the same rule: never two conflicting greens. Each team designs a state machine that serves pedestrians and lets an ambulance through, then walks the room through one tricky transition. No leaderboard: every team that gets there explains how.
Your own design
On your own: choose a cycle time that keeps the average wait on the busy road as low as you can while giving pedestrians a crossing every cycle. Write down what you traded.
Questions
Moderated questions in the live room. Questions are answered on screen without names, and chat stays off.
Extension
Two junctions sit close together on the same road. How could you time them so a car that gets one green usually gets the next? What information would the second junction need?
You leave with
A saved, audited state machine, a rush-hour timing plan that passes on safety, waits and ambulances, a calculated cycle and a written trade-off argument, stored in your Workshop and counted toward your Passport.

For educators & facilitators

A complete run of show, misconceptions, safety notes and a printable worksheet.

Open the facilitator guide

Safety: Browser simulation and paper design only. Never stand in a road or junction to observe or count traffic, and never touch traffic signals, control cabinets or street equipment; observe only from a safe place with an adult. Any physical extension needs an adult's safety review and supervision before anyone starts.

Go further

Tell the people who built this

Optional. We’re students too, and we change things because of what you say.

Please don’t include your name or anything personal. Nothing you write is shown publicly.

Next build · 006Engineer a Planetary Rover