Traffic Signal Lab
Every traffic light runs a program, and somebody wrote it. Traffic Signal Lab puts students in charge of one: Main Street and Oak Street at 7:41 on a weekday morning, a light that counts 30 seconds for each street, and a line of cars on Main that keeps getting longer. They change the program in Blocks or Python and the scoreboard answers the way a traffic engineer's would, in seconds lost per car and a letter from A to F. Then the problems get real: an empty town at 2 a.m., children at a school crossing, a rush hour of left turners, an ambulance.
Using this with a class? Make a free class and add your students yourself: each gets a username and password, with no email or Google account needed. Or give them one join code. Using Google Classroom? Post the link there; with a free class, the link also puts each student in your class, so you see their work. mytekDev is also available from the Google Workspace Marketplace, so your school's Google admin can install it for everyone.A first lesson: Open it on the projector at Level 1 and let it run for a minute. Ask the class what is wrong: Main Street backs up while Oak's green runs on with hardly anyone on it. Ask what one number they would change. Then change Oak's 30 to 15 in Blocks, come back to the intersection, set it to 16x and watch the letter go from D to C.
Set up a free class Share to Google ClassroomWhat a student actually does
The first view is the intersection with the light already running the starter program: Main green for 30 seconds, Oak green for 30. Within a minute it is plain what is wrong. Main's line grows, and Oak's green runs on with hardly anyone on it. A card along the bottom says what to try, and a scoreboard keeps the score: seconds lost per car, measured car by car against the same trip straight through on green, and the letter traffic engineers give that delay.
The program is in Blocks, and the Python tab shows the same program as Python. A student changes one number, comes back, and the light runs rush hour again from 7:41 with their program. At 16x a whole rush hour takes about a minute. Oak at 15 seconds turns a D into a C, and the obvious next idea, more green for Main, makes it worse, which is where the trade between the two streets starts to make sense.
The yellow and the all-red are not in the program. They are on a timing sheet, worked from the speed limit with the formula engineers use, and the controller puts them in by itself. A program can ask for a change but cannot cut a yellow short. The sheet can be edited: a yellow shorter than the formula leaves drivers too close to stop, and they run the red. It prints on one page with the intersection drawn from above, the phase numbers, the timing, the best run, the program and a box for why the student timed it that way.
Five levels follow. At 2 a.m. a car sits at Oak's red while Main's green runs for nobody, and one if reading the loop detector cut into the road fixes it. At the school crossing the button only leaves a call, and the program has to give the children their WALK. At the evening rush a fifth of Main's drivers turn left, and they need a green arrow of their own. At noon three ambulances come through, and an event block drops everything for them.
The town can be watched from the pole camera, straight down, at street level, or from the driver's seat of a car waiting at the light. A car made in Car Design Lab can join the traffic.
The starter program. The yellow and the all-red are not in it: the controller puts them in by itself, from the timing sheet, the way a real one does.
What they are learning while they work
Nothing here is presented as a lesson. This is what the intersection and the levels are made of.
| What the student does | What it is |
|---|---|
| Gives Oak 15 seconds instead of 30 and watches the letter move | Cycle and split. A fixed-time light shares one cycle between the streets. More green for one is less for the other, and the right split follows the traffic, not fairness. |
| Gives Main 40 seconds and finds the score got worse | A tradeoff that is not linear. A longer cycle changes the light less often. Left turners mostly go when it changes, so their line grows, and every driver on Oak waits longer for each green. |
| Reads the scoreboard: 39.6 seconds lost per car, D | Level of service. Engineers grade a signal by its average delay per vehicle, A for 10 seconds or less down to F for over 80, the bands of the Highway Capacity Manual. |
| Sets Main's yellow to 2 seconds on the timing sheet and counts the red-light runners | The yellow change interval. A yellow is one second to react plus the time to stop from the speed limit. Shorter than that, some drivers are too close to stop and too far to clear. |
| Turns Oak green only when a car is waiting on its loop | Detectors and actuated control. A wire loop in the pavement senses a car's metal. A light that reads it answers demand instead of the clock, and the controller still holds each green a minimum time. |
| Gives the children a WALK only when the button has been pressed | Input that latches. A push button leaves a call that stays until it is served. The program answers the call; pressing again does nothing, as on a real crossing. |
| Adds a green arrow for Main's left turners ahead of Main's green | Protected and permitted turns, and phase numbers. A flashing yellow arrow lets a turn go when there is a gap; a green arrow gives it its own time. Engineers number the movements: odd for the lefts, even for the throughs. |
| Writes 'when an ambulance is coming' with two blocks inside it | Events and preemption. An event interrupts the running program and hands back when it is done. Even for an ambulance the light finishes its yellow and all-red first, or the safety monitor stops it. |
How to tell whether it landed
Ask, and let them show you on the intersection. A student who has understood it can answer these without the app's help.
- Main Street is the busy one. Why did giving it more green make the score worse?
- Why is the yellow not in your program? What would happen if a program could make it shorter?
- At 2 a.m. your light turns Oak green only when a car is waiting. Why does Oak's green still last 7 seconds when your program did not ask for any wait?
- Someone at the school crossing pressed the button five times. Did that bring the WALK sooner? Why not?
- Why does the ambulance's street not go green the instant it is seen?
- Your left-turn arrow program grades a D and passes. Why does a level with three phases pass at a lower letter than one with two?
Use it in your subject
Not a technology class? Then the app is how students show what they learned in your unit. More projects for every subject.
Computer science, middle and high school (CSTA 2-AP and 3A-AP)
A forever loop that runs a real machine, conditions on sensor input, an input that latches, and an event that interrupts the main program, each with a scoreboard that says whether it worked.
Engineering design (NGSS MS-ETS1 and HS-ETS1-4)
A problem with criteria and a constraint (the letter, people's waits, the yellow), solutions tried and compared on the same rush hour, and a computer simulation used to test them, as HS-ETS1-4 names.
AP Computer Science Principles, simulations
A simulation that simplifies on purpose and says what it leaves out, with the same seeded traffic every run so two programs are compared fairly.
Data and statistics
Delay as an average over a thousand drivers, a letter grade from bands, and the difference between the busiest minute and the whole hour.
Practical notes
- AgesGrades 6 to 12. Level 1 works from grade 6 by changing numbers in Blocks; the detector, the button and the left-turn arrow fit middle school CS; the ambulance event and the Python fit high school.
- TimeLevel 1 fits a class period with time to talk about the trade. Levels 2 to 5 make a unit, about a period each.
- EquipmentA computer or Chromebook with a modern browser. Nothing to install. A projector for the opening question. A printer for the timing sheet, if the class hands one in.
- CostFree. The app has no paid tier and no AI.
- PrepRun Level 1 once yourself: let the starter run to 8:01 at 16x, then change Oak's wait to 15 in Blocks, come back and run it again. Then open Level 2 and read its card.
- In a groupOne intersection per student, or pairs: one edits the program, one watches the scoreboard and calls out what the line is doing.
For a class with one projector
Run Level 1 on the projector and let the class call out the split. Every run is the same rush hour from the same seed, so the class can try three or four programs in a period and compare their letters fairly, the way an engineer compares timing plans.
Common questions
Is it free?
Yes. Traffic Signal Lab has no paid tier, and it can be tried right on this page without an account. Saving needs an account.
Does it work on a Chromebook?
Yes. It runs in the browser with nothing to install.
Is the traffic real?
It is modeled on real numbers. Cars follow the car ahead the way the traffic research models do, a lane of cars leaving a green moves about 1,840 cars an hour after about 2 seconds of start-up, close to what engineers measure, and the yellow, all-red and crossing times come from the formulas engineers use. The streets, the volumes and the town are made up.
What does it simplify?
One kind of vehicle, level roads, and no lane changes once a driver has picked a lane. Every driver keeps to the speed limit, which is why the formula's yellow leaves no red-light runners here; on real streets a correct yellow cuts red-light running a lot, but speeding and distracted drivers still run some. Detectors always work. Delay is measured car by car rather than with the Highway Capacity Manual's equations. Real controllers have dozens of settings per phase; this one has the few that matter most.
Do students need to know Python?
No. Every level can be done in Blocks, and the Python tab shows the Python the blocks make. A student who wants to can write the Python directly.
Why does the ambulance not get its green at once?
Because a real controller never cuts a yellow or an all-red short, even for an ambulance: drivers already in the intersection need the time to clear it. The rules let a controller cut the walk countdown short in an emergency; this one lets people finish crossing, as many cities do. There is a block that skips the yellow, so students can see what the safety monitor in the cabinet does about it.
Is it affiliated with a traffic agency or a controller maker?
No. It follows published practice (the MUTCD, the FHWA Signal Timing Manual, ITE's change interval formulas and the Highway Capacity Manual's level of service bands) and is not affiliated with any agency or manufacturer.
Still have a question? Ask us, and a person will write back.
Where to go next
Start with Traffic Signal Lab
Trying it costs nothing and takes about five minutes. An account is what makes the work last.
Traffic Signal Lab is one of the making apps on the platform. The intersection, the timing sheet and the scoreboard come from one model, run the same on every computer, so a class compares programs on the same rush hour.
Page last reviewed November 2026.
Google, Google Classroom and Chromebook are trademarks of Google LLC.