Tags:
create new tag
view all tags

Traffic light simulator

The Raspberry Pi (see Raspberry Pi Description) is the embedded system we use for our course. It can connect to the outside world through different types of interfaces. The most simple one is the connection through GPIO (General Purpose I/O) pins which are logic levels that can be input or output. When these pins are programmed as outputs, then they can drive LEDs (Light Emitting Diodes) and switch them on or off. Since lighting a single LED is not exactly spectacular we prepared a simulation of traffic lights.

Imagine a road crossing where you have traffic lights on both roads. When the traffic light is green on one road it must be red on the other. The traffic lights are in this state for some time to make a good number of cars pass the crossing. Then the green light turns to yellow while the light on the other road is still red. This is a short phase just allowing the cars, which are already on the crossing to clear it. Then we keep both lights on red for a short period as a safety phase, before switching the other traffic light to green, again for a longer period.

There are therefore the following phases:

Traffic Light 1 Traffic Light 2 Period
green red long
yellow red short
red red short
red green long
red yellow short
red red short
When running the program on the Raspberry Pi or on the Arduino, these phases can be observed. The whole program can be implement as a simple state machine.

... and here you see the traffic light simulator in action:

trafficLight.png

-- Uli Raich - 2017-10-06

Comments

Topic attachments
I Attachment History Action Size Date Who Comment
PNGpng trafficLight.png r1 manage 478.7 K 2017-10-09 - 12:11 UnknownUser  
Unknown file formatgz trafficLight.tar.gz r1 manage 4.9 K 2017-10-11 - 16:04 UnknownUser  
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2017-10-11 - uli
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback