In this challenge, we will design, create and test a logic gates circuit to control a traffic lights made of 3 LEDs (Red Amber Green). This challenge is designed to be completed with a logic board such as the Logic & Arithmetic board designed by the University of Southampton and the UK Electronic Skills Foundation. You will be able to complete the circuit with just the Logic & Arithmetic board. However if you have access to breadboards and LEDs you will be able to create your own Red Amber Green traffic lights for a more realistic output.
Alternatively, if you do not have access to a physical kit, you can still complete these challenges using our online logic gates circuit simulator
Traffic Lights Sequence
A UK Traffic Lights follows a sequence of four different states:
In order to design a logic gates circuit for our traffic lights system we will need a circuit with two inputs (J and K) and 3 outputs (X, Y and Z). Our two inputs will give 4 different states to our circuit: 00, 01, 10 and 11. The following diagram shows the expected outputs for 4 possible states (input patterns):
Truth Table?
Your first task is to use the above diagram to complete the Truth Table for our Traffic Light Controller system:
Input J | Input K | Output X (Red) | Output Y (Amber) | Output Z (Green) |
0 | 0 | |||
0 | 1 | |||
1 | 0 | |||
1 | 1 |
Logic Gates Diagrams
Using the information from the completed Truth table we can then work out the logic gates circuits needed to control each output based on the two inputs J and K.
You can try to create this diagrams by yourself using logic.ly or our online Logic Gates Diagram designer tool.
Here are the individual diagrams:
Output X: Red Light:
Output Y: Red Light:
Output Z: Red Light:
All three diagrams can then be combined into a single diagram:
You can now recreate this circuit with your logic board:
Using RGB LEDs
The following diagram shows you how to connect your logic board to 3 LEDs on a breadboard.
Be careful when connecting your LEDs to detect where the anode and the cathode are on each LED:
Using Lego bricks…
You can also create your own traffic lights using Lego bricks and control them with your logic board!
Traffic Light Sequence using Logic Gates
By combining the above circuit with a 2-bit counter circuit, we can create a fully animated traffic light sequence. Click on the diagram below to test this circuit: