Featured Software-Only Unit: "Simulating a Traffic Light & Pedestrian Crossing"
Target Year Group: Year 4, 5, or 6 (UKS2)
Required Software: Scratch (Free, web-based or offline desktop application)
Core Concept: Creating an interactive, conditional loop system that acts exactly like a real-world automated system.
The 6-Lesson Scheme of Work
Lesson 1: Deconstructing Real-World Systems
Objective: Understand how an automated physical system functions.
Activity: Pupils observe real traffic lights or look at videos. They identify the inputs (pedestrian push button) and outputs (red, amber, green lights). They write down the exact chronological sequence required for the system to operate safely.
Lesson 2: Designing the Algorithm (Flowcharts)
Objective: Convert a real-world sequence into a logical flowchart.
Activity: Before touching a computer, pupils map out the sequence on paper. They use standard logical structures: a continuous loop for the traffic lights, disrupted by a conditional branch ("IF the button is pressed, THEN change the lights").
Lesson 3: Coding the Basic Sequence
Objective: Use loops and timing variables to control an on-screen object.
Activity: On Scratch, pupils draw a basic traffic light sprite with three costumes (Red, Amber, Green). They write a script using switch costume to... and wait X seconds blocks nested inside a forever loop to mimic the continuous real-world cycle.
Lesson 4: Introducing Interactivity (The Input Trigger)
Objective: Program an event input to change a system's behaviour.
Activity: Pupils introduce a new sprite: a pedestrian crossing "Wait" button. They use standard event blocks (when this sprite clicked) to broadcast a message to the traffic lights, triggering the sequence to transition to red so pedestrians can cross.
Lesson 5: Debugging and Logical Safety
Objective: Identify and correct errors in a simulation.
Activity: Teachers deliberately introduce "bugs" into a sample program (e.g., the lights change instantly without an amber warning, causing an accident). Pupils test the code, trace the logic errors, and rewrite the sequences to ensure a safe transition delay.
Lesson 6: Adding Multi-Sensing Extensions
Objective: Expand a control system by combining multiple outputs.
Activity: Pupils finish their simulation by adding a secondary system: a pedestrian "Red Man/Green Man" light and an audio buzzer sound effect that triggers when it is safe to cross (simulating accessibility features for visually impaired pedestrians).
Here is a complete logic breakdown and a text-based flowchart for a 2-way UK temporary traffic light system (the kind used for one-lane roadworks).
In the UK, traffic lights follow a strict four-phase sequence: Red → Red & Amber → Green → Amber → Red. When managing a 2-way system, there must also be an "All Red" safety delay to allow cars to clear the single lane before the opposite side turns green.
The 2-Way Traffic Light Flowchart
Plaintext
[ START ]
│
▼
┌──────────────────────────────────────┐
│ ALL-RED CLEARANCE │
│ Light A: RED │ Light B: RED │
└──────────────────────────────────────┘
│
▼
[ Wait 5 Sec ]
│
▼
┌──────────────────────────────────────┐
│ Light A: RED+AMBER │ Light B: RED │
└──────────────────────────────────────┘
│
▼
[ Wait 2 Sec ]
│
▼
┌──────────────────────────────────────┐
│ Light A: GREEN │ Light B: RED │
└──────────────────────────────────────┘
│
▼
[ Wait 20 Sec ]
│
▼
┌──────────────────────────────────────┐
│ Light A: AMBER │ Light B: RED │
└──────────────────────────────────────┘
│
▼
[ Wait 3 Sec ]
│
▼
┌──────────────────────────────────────┐
│ ALL-RED CLEARANCE │
│ Light A: RED │ Light B: RED │
└──────────────────────────────────────┘
│
▼
[ Wait 5 Sec ]
│
▼
┌──────────────────────────────────────┐
│ Light A: RED │ Light B: RED+AMBER│
└──────────────────────────────────────┘
│
▼
[ Wait 2 Sec ]
│
▼
┌──────────────────────────────────────┐
│ Light A: RED │ Light B: GREEN │
└──────────────────────────────────────┘
│
▼
[ Wait 20 Sec ]
│
▼
┌──────────────────────────────────────┐
│ Light A: RED │ Light B: AMBER │
└──────────────────────────────────────┘
│
▼
[ Wait 3 Sec ]
│
▼
└───[ LOOP BACK TO START ]
Key Logic Points for Pupils to Program
When translating this flowchart into code (like Scratch blocks), children will need to manage a few specific programming concepts:
The Parallel States: The program must control two separate objects (Light A and Light B) at the same time. In Scratch, this is easily done using Broadcasts (e.g., Broadcast: Move Light A to Green) or by using a single master timeline script that changes variables.
The UK "Red & Amber" Phase: Many children forget that in the UK, lights don't go straight from Red to Green. They must program a brief intermediate step where both the Red and Amber costumes/lights are active simultaneously.
The "All-Red" Buffer: Highlight to pupils what would happen if this step were deleted. If Light A turned Red at the exact millisecond Light B turned Green, cars in the middle of the roadworks zone would collide. This introduces them to the concept of defensive programming and real-world safety systems.