Stoplight Arcade Game With Arduino
by oKeeg in Circuits > Arduino
586 Views, 7 Favorites, 0 Comments
Stoplight Arcade Game With Arduino
Welcome to the Stoplight LED Arcade game! My goal for this project is to make a compact handheld game using just a couple of components. It can be pretty cheap to build as well. Feel free to watch the video to get a brief overview, otherwise, let's get started!
Supplies
1: ATTiny85, Arduino(to upload to ATTiny85)
1.5: 10mF Capacitor if uploading to ATTiny85
2: SN74HC595 Shift Register
3: 7x LED's
4: 7 Resistors (depends on LED's. I used 80 Ohm)
5: Push button
6: Small Switch
7: Battery metal holders (Amazon linked)
8: Hot Glue
All of these can easily be found on amazon with a search.
Calculate Resistance and Voltage
It is important to have the correct resistance values for the resistors and LED's. To do this the formula is:
(Battery Voltage – LED voltage) / desired LED current
In my case if I plug in the numbers it would look like this:
(3 - 2) / 0.02
The voltage will be 3 volts because the batteries will be in series. Then according to my LED's, they require 2 volts and use 20 milliamps of power which is 0.02 amps. We have the batteries in series because it accumulates the voltage at the end. Each battery is 1.5 volts. Thus the equation looks like this:
1.5 volts + 1.5 volts = 3 volts
We want 3 volts to power the ATTiny85, the shift register, and the LED's. You can also implement a 3v Cell battery as well to make this project even smaller. I figured more people will have AA batteries on hand to test out the project.
Upload Code to the ATTiny85
There are multiple great examples on how to upload code to the ATTiny85. I will link one to youtube that does a great job of explaining how to do it. The code I created is not the most efficient, but feel free to edit and explore! Attached is the Arduino file. You can always find the files on my website www.neehaw.com
Downloads
Align the Components and Solder!
Follow the wiring diagram and make note of the direction of the ATTiny85 and the shift register. I soldered these on a PCB board but it is not needed. The dot on the end corner of the IC symbolizes the first pin. Attach the battery positive to the switch and from the switch to pin 4 and connect negative to 8 of the Arduino. Next, power the shift register using pin 8 for ground and pin 16 for 3 volts. Solder the negative(cathode, the short side of led) together with the rest of the LED's and solder a jumper wire to ground. Next, connect each LED's positive with a resistor, then from each resistor, connect in order on the shift register starting with pin 1 to pin 7. Connect a push button to the ground on one side and the Arduino pin 3 on the ATTiny85. Since the button is an Input_Pullup, it is expecting a ground signal. The pin is to read HIGH when the switch is open, and LOW when the switch is pressed. Finally, connect pin 10 on the shift register to 3v power, 11 to pin 5 on arduino, 12 to pin 6, 13 back to ground, and 14 to pin 7 on the arduino.
3D Print Parts
I had multiple different pieces to print starting with the battery case. I hot glued the battery terminals so it aligns the batteries in series and had a lid for it. Next, there are holes to screw the top motherboard enclosure into the battery container along with another lid. Last, there is a little rod to use for the push button. The rod has a cap for comfort when pressing the button. I hot glued the rod to the push button.
Test and Have Fun!
I hope you enjoyed this project! Please let me know in the comments what you thought about it or if you have any more comments or suggestions. Thank you for your time!