Traffic Light Redux with ProtoStax for Arduino and Breadboard vertically stacked

Traffic Light Redux with ProtoStax for Arduino and Breadboard vertically stacked

Greetings! 

In this project, we will look at the humble Traffic Light project and reimagine it to make it more interesting and learn a couple of programming tips along the way! 

We will use:

  • Arduino Uno
  • Breadboard
  • A bunch of LEDs (green, yellow, red, orange and white)
  • momentary push button switches
  • jumper wires

and use a ProtoStax for Arduino and ProtoStax for Breadboard enclosures, vertically stacked in Open Configuration, to display the LEDs and switches neatly on top while having everything neat and compact at the same time. 

We use the ProtoStax for Arduino base to house the Arduino Uno and ProtoStax for Breadboard to house the half-size breadboard used for this project. The enclosures are stacked vertically and left in an Open Configuration (with the side walls omitted) , so the top part with the breadboard with the lights and switches is exposed to the user as the "User Interface", while the Arduino and connections are safely ensconced below, protected from grubby fingers - perfect for that show-and-tell exhibit! 😊 

Traffic Light Redux Project

 

Basic Operation:

 

Pedestrian Walk Request Activated: 

 

A Traffic Light project is a great and fun way for a beginner to get started with Arduino. In such a project, you usually learn how to turn on and off LEDs and have a certain delay between them, to simulate a set of traffic lights turning from GREEN to YELLOW to RED, and back again, endlessly.

However, when you start adding different streams of traffic, more intersection lights, pedestrian crossing and pedestrian walk request buttons, etc,  traffic lights and their timing and control can get quite complex. 

 Enter the State Machine approach - you can use this to more easily reason about, quantify and program the different states of the traffic light signals as they get more and more complex. In the project, we'll show you how to set up a State Machine and use that for controlling the traffic lights in your project. 

We have a bunch of "Walk Request" buttons for the pedestrians to request a Walk sign - these are handled by the State Machine as well. 

We also use bitmaps to model the LEDs, whereby it becomes easier in code to specify which sets of LEDs to light up.

You'll be able to use the State Machine approach and bitmaps in your other projects as well! 

Ok, let's dive right in! You can find the tutorial with complete instructions, link to the GitHub repository for the code as well as ideas for how to take the project even further at 

https://www.hackster.io/sridhar-rajagopal/traffic-light-redux-70225e

 Happy Making! 

Sridhar (and the ProtoStax Team 😊)

Back to blog

Leave a comment

Please note, comments need to be approved before they are published.