Green Lights is a project that was created to teach students about physical computing. This includes Inputs and Outputs, Electricity, programming with Arduino, and a little bit about traffic control systems. The intersection will be setup at the front of the classroom and students will be split up into teams. Teams will be given note cards with commands on them (Ex. lightOn('n', "green"); or sleep(2); ) which will be explained as part of the lesson. Overall, this project gives students an easy transition into the world of making electronics.
Step 1: Tools and Supplies
A quick note about this at the beginning of this project, I tried to use a Raspberry Pi with a PWM hat but changed that because trying to locate the drivers took so much time.
- Arduino Uno
- Small Sheet of Foamcore to put the Intersection on
- Traffic Lights (Can be made in a previous class too)
- Male to Female Jumper Wires
- Foam Board to hold the Traffic lights up
Step 2: Construction
- Start by cutting the foamcore to the size of the intersection that you want
- Then cut four pieces of pink foam to the height that you want the lights to be at
- Hot glue the pink foam to the foamcore that you just cut on the north, south, east, and west parts of the board
- Cut a rectangle opening in front of the foam, below where the lights are about to go for the wires
- Glue the traffic lights to each piece of pink foam on the inside of the intersection
- Feed the female side of the wires up from the bottom and connect to the lights (keep track of the colors of the wires going Red Yellow Green Pins on the traffic lights
- Connect the male side of the wires to digital pins 2-13 on the Arduino
I did the following for this last step:
eastLightG = 2; eastLightY = 3; eastLightR = 4; northLightG = 5; northLightY = 6; northLightR = 7; southLightG = 8; southLightY = 9; southLightR = 10; westLightG = 11; westLightY = 12; westLightR = 13; GND to GND for all of them;
Step 3: Testing/Coding
The hackathon1 file is a simple sketch that tests a traffic light. The GreenLights file is what I will be using to teach. Most that you need to know is commented in the code.
Step 4: Problems and Future
I ran into a few problems throughout this project. The main one was with the wiring that came with the lights. The lights work great but the wires, not so much. Another pointer is don't use digital pins 1 and 0 because the code that I use includes Serial communication (requires 0/1) to carry messages back to the computer. Lastly, these materials were used to prove a concept so a hot glue gun may be required if something falls off.
I look forward to moving out of the prototyping phase into better quality building materials. This is one of four possible lessons that I could take to a study abroad in Norway so stay tuned. The light you see in the image is an actual yellow light. I hope to get that working with an Arduino using a relay so that the students can see the full size and brightness of just one part of an actual traffic light. Overall, this is an easier (cool) way to show others how an Arduino works!