Safety and scope
This is a tabletop learning model only; it must not be connected to or used as a real road traffic signal.
Plan, predict and test
Suggested virtual study time: about 15 minutes. This is a planning estimate, not a validated construction time.
Preparation: Foundation electricity and basic programming logic. Adult supervision for children. Review a foundation lesson ↗
Use paper, a spreadsheet or a simulator. This is not a verified physical assembly guide.
- Scenario: Trace green 3 s, amber 1 s and red 3 s from the illustrative sketch.
- Expected result: Exactly one indicator is on in each stable state.
- Checkpoint: Write your prediction, test it in the virtual model and explain any difference.
A correct answer does not certify the physical system.
Record your validation
Use only virtual inputs and indicators until the actual components, pinouts and electrical limits have been verified.
| Case | What to record |
|---|---|
| Normal input | Green 3 s → amber 1 s → red 3 s |
| Boundary | Total cycle 7 s; verify one output active during stable phases |
| Missing or invalid input | Reset briefly clears outputs. This is an LED sequence, never a road traffic controller. |
| Repeat test | Repeat the virtual test, record the actual output and compare with the expected result. |
These are test-planning requirements, not recorded hardware results.
Before building: understand the listed components and the relevant low-voltage safety rules. This is a concept brief, not a tested assembly manual.
What it does
Learn output sequencing, timing and how to avoid blocking the controller while a sequence runs.
Engineering principle
The simplest version uses timed delays. A more flexible implementation uses millis()-based elapsed-time checks so other work can continue while the signal state changes. A sample cycle is green for 5 seconds, amber for 2 seconds and red for 5 seconds.
Hardware and components
- Arduino Nano or UnoRuns the signal state machine.
- Red, amber and green LEDsRepresent the three traffic-light states.
- 3 × 220 Ω resistorsLimit LED current.
- Breadboard and jumper wiresConnect the prototype.
- Optional pushbuttonCan be added to request or pause a sequence.
Suggested build sequence
- Connect each LED through its own resistor to an output pin.
- Write a state table that defines which LED is active in each phase.
- Implement the 5 s / 2 s / 5 s timing cycle.
- Replace delay() with millis() timing to keep the loop responsive.
- Add a pedestrian request or fault indication as a later exercise.
Learning outcomes
- Digital outputs
- Timing and finite-state machines
- Non-blocking code
- Basic test planning
Possible upgrades
Add a pedestrian crossing, button request, night mode or two-way intersection model.
Practice the core principle
This simplified exercise is not the full physical project shown above. Test in simulation first; verify real hardware against its datasheet. Children need adult supervision.
Reference components
- Arduino Uno (5 V)
- 3 LEDs
- 3 × 330 Ω resistors
- Breadboard and jumpers
Connection plan
- D2 → red LED through 330 Ω
- D3 → amber LED through 330 Ω
- D4 → green LED through 330 Ω
- LED cathodes → GND
Reference sketch
const int red=2, amber=3, green=4;
void setup(){
pinMode(red,OUTPUT);
pinMode(amber,OUTPUT);
pinMode(green,OUTPUT);
}
void show(int pin, int ms){
digitalWrite(red,LOW);
digitalWrite(amber,LOW);
digitalWrite(green,LOW);
digitalWrite(pin,HIGH);
delay(ms);
}
void loop(){
show(green,3000);
show(amber,1000);
show(red,3000);
}How the code works
- Constants assign pins to three LEDs.
- setup configures pins as outputs.
- show turns all LEDs off, lights only the selected LED and waits.
- loop repeats the green, amber, red sequence.
Practice sequence
- With power disconnected, place LEDs and resistors; check polarity.
- Connect cathodes to GND and each resistor to its specified output.
- Simulate the sketch first, then have an adult check wiring before applying power.
- Observe each light separately before checking the whole sequence.
Expected result
Exactly one LED should be on at a time; verify sequence and timing.
Troubleshooting
If an LED is dark, disconnect power and check its polarity, resistor and pin assignment.
Independent challenge
Change the green duration and predict the new cycle period.