Introduction
When we travel into a big city or town like Nairobi, we are most likely to meet with thousands of cars moving through the streets and pedestrians cycling or walking along the same streets. To ensure there is order, traffic lights are used to inform people driving, cycling or walking of what to do and what not to do, just as we do in school when we have to wait in line and take turns while the teacher stands there making the children take turns and play nice with each other.
Traffic lights permit orderly movement of people and vehicles to ensure there are no delays. They prevent injuries, fuel wastage and both air and noise pollution.
Traffic lights are made of three lights which are of three different colors to represent each of the messages. These lights are controlled by timers.
What are the different colors that make up traffic lights?
Where else can we use traffic lights?
Things to learn
In this lesson, you will learn about:
- How traffic lights work
- How timers work
- How to build our own traffic lights
How traffic lights work
Traffic lights consist of 3 different lights; Red, Orange and Green to give different information.
Whenever we see the red lights, it signals that we should stop where we are. Red and Orange together means we should get ready to go while Green means we should go. Orange alone comes on after Green and signals that we should get ready to stop.
Timing events
Traffic lights uses a timer to change at fixed times or at set intervals.
In digital computing a timer is a set of computer instructions that keep track of time and perform certain actions when a specified time period has passed or conditions have been met.
For simple timed events, events that happen one after another, a delayed timer is used.
A delay timer pauses the ongoing action for a particular amount of time before it goes to the next.
Basic circuits
Digital Control
Build the Project
In this section we are going to build the traffic lights circuit on the UNDA.Xplora breadboard.
Step 1
Connecting the Green LED on the breadboard
- Placing the LED:- Take one green LED from your Unda Xplora kit. Now put the Green LED as shown in the diagram above, with the negative leg (the shorter leg) on the bottom negative terminal and the positive leg (the longer leg) on pin b28 on the breadboard.
- Placing the Resistor:-Take one 220 ohm resistor and place it on the breadboard, with one of its leg next to the positive leg of the Green LED at pin d28 and the other leg placed at pin f28 of the breadboard.
- Connecting a jumper wire:-Pick a jumper wire of any color of your choice and connect it from D2 to one side of the resistor at pin h28 of the breadboard.
Step 2
Connecting the Orange LED on the breadboard
- Placing the LED:-Take one Orange LED from your Unda Xplora kit. Now place the Orange LED as shown in the diagram above, with the negative leg (shorter leg) on the bottom negative terminal and the positive leg (the longer leg) on pin b16 on the breadboard.
- Placing the Resistor:-Take one 220 ohm resistor and place it on the breadboard, with one of its leg next to the positive leg of the Orange LED at pin d16 and the other leg placed at pin f16 of the breadboard.
- Connecting a jumper wire:-Pick a jumper wire of any color of your choice and connect it from D5 to one side of the resistor at pin h16 of the breadboard.
Step 3
Connecting the Red LED on the breadboard
- Placing the LED:-Take one Red LED from your Unda Xplora kit. Now place the Red LED as shown in the diagram above, with the negative leg (shorter leg) on the bottom negative terminal and the positive leg (the longer leg) on pin b8 on the breadboard.
- Placing the Resistor:-Take one 220 ohm resistor and place it on the breadboard, with one of its leg next to the positive leg of the Red LED at pin d8 and the other leg placed at pin f8 of the breadboard.
- Connecting a jumper wire:-Pick a jumper wire of any color of your choice and connect it from D9 to one side of the resistor at pin h16 of the breadboard.
Step 4
Connect a jumper wire to ground
- Pick a jumper wire of your choice. Connect one pin of the jumper wire to the GND pin of the kit and then connect the other end of the jumper wire to the bottom breadboard negative rail.
Running the Project
Once you are done building the circuit, go back to the Project main window and click on the Load option. Select the Load Project option and the click on Yes to run the project and once the project has been uploaded observe what happens.
Select the Play option and observe what happens in the Play Section.
Observation
When we run our project, we observe that the LEDs work like traffic lights.
The red LED lights up for 5 seconds to show stop. Both the red and amber then go on for 3 seconds to show that it is time to get ready to go. The green then comes on for 5 seconds showing go! After green, the amber then comes on to show that it is time to get ready to stop before the red comes on again and the process is repeated.
Traffic lights make use of timers that keep each of the lights on. When the timer counts to the required time (such as 5 seconds for green), the next LED goes on.
To ensure that traffic lights work every day to control traffic without stopping, traffic lights also make use of loops. Loops instruct our minicomputer to repeat the turning on and off of the LEDs without stopping unless the kit is powered off.
Feedback is closed.