-
Simon says Game Mode
12/23/2020 at 19:13 • 0 commentsIt was cool to have traffic lights that we could turn on and off but what else could we do with these lights? Well, why not make a giant Simon says game!
Once the lights are plugged into power all traffic lights and button lights blink once to show it's on and working. After that press any button to start game mode.
The first steps to making the game were creating a predetermined sequence of light blinks and to have the Arduino recognize if we pressed the correct button in correlation with the traffic light color.
Then we used a randomseed algorithm to make the light blinks be random.
every 3 light blinks and the the time in between blinks speeds up!
Get 10 in a row correct and the green traffic light blinks 3 times indicating GAME WON!
Take too long to press a button or press the wrong button and 3 red light blinks from the traffic light indicate GAME LOST!
-
CODE
04/29/2020 at 19:06 • 0 commentsStarting off with writing the code for the traffic lights we had to identify the inputs and outputs. We needed 3 inputs (one for each button) and 6 outputs (3 for the relay modules, 3 for the button lights). In the first version of the code a button press would toggle the corresponding traffic light on or off (yellow to yellow, red to red, green to green). With the 2nd version when a button is pressed, the button light is on while the button is depressed (does not toggle)
-
WIRE EXTENSIONS
04/29/2020 at 19:03 • 0 commentsIf we wanted to hang the lights on the wall we were going to need some wire extensions. I took black and white 18g cable (10ft of each color) and twisted them together using a drill. Next I used wire strippers to take off the insulation on the ends and attached the female 2 pin molex connectors and then did the same thing with the male connectors on the other ends. Finally I put red, green, and yellow electrical tape on the ends to easily identify which wire went to which light.
-
TRAFFIC LIGHT HOUSING
04/29/2020 at 19:02 • 0 commentsDesigning and building a housing for the traffic lights was the next task. The face of the housing was constructed from ½ in. birch plywood. We chose the birch plywood due to the strength of the wood since large circles were to be cut from it to hold the lights, leaving very little material left for support. The circles were cut using a jigsaw circle cutting jig. The sides were constructed from ½ in MDF which was used due to its lower cost. 1 in. grid pegboard was used for the back of the housing because, well, that's what we had laying around in our garage. Using Some leftover scraps of wood we made small wedges to secure the lights in place on the inside of the housing. For a nicer looking finish we made some decorative trim for the face using scrap 2x6 redwood lumber. The lights were wired to come through the back of the housing and secured with a strain relief. We then attached the mating molex connectors. As a last detail, I made 3 bezels from ¼ in. black irrigation tubing to go around each light that covered the gap between the light and the plywood face. After finishing the housing I needed to make a 10ft. Wire extension cables from the housing to the relay modules.
-
CIRCUIT
04/29/2020 at 19:01 • 0 commentsWe used an arduino to control the traffic lights via relay modules because we wanted the flexibility to change the interaction of the buttons with the traffic lights and for the simplicity of programming. In total 9 pins were used, 3 for the switch inputs, 3 for the switch lights and 3 for the relay modules. Relay modules were used because the traffic lights operate off of 120 VAC. We also made a small traffic light simulator using a perfboard and 3 LEDs this way we wouldn't need to hook up to the giant traffic lights every time we wanted to test the code.
We already had a Leonardo microcontroller and breadboard mounted on a base plate. We then took the 3 relay modules and the 2 terminal blocks and mounted those onto a larger 3D printed scrap base plate. Following the schematic previously drawn up we wired together all of the components. To connect the lights to the relay modules I attached 3 two pin molex connectors to the output, 1 for each color. Then attached the mating connectors to the traffic lights. We 3D printed custom housing for the large lighted buttons.
-
Concept
04/29/2020 at 18:59 • 0 commentsTo start off we drew up a schematic then gathered the various components we would need including: Arduino leonardo clone, 3 large lighted buttons (red, yellow, green), 3 relay modules (to control the 120 VAC going to the lights), a solderless breadboard, 2 terminal blocks, and misc. Wires and connectors. After all the parts and the basic design was completed assembly could begin!