Instructables
Picture of LED Pong
IMG_20130615_210431.JPG


Quick Overview:
I call this "LED Pong". I built it from scratch and I based the design on a 1-meter strip of individually addressable LEDs and an Arduino Uno. Pong was one of the first video arcade games ever made. It was released by Atari in 1972 and if you are unfamiliar with it, this video provides a good overview of the gameplay: http://www.youtube.com/watch?v=pDrRnJOCKZc

Introduction:
Following my design is not for the faint of heart, unless you plan to have printed circuit boards manufactured, you will need to have excellent solder skills. You will also need a lot of time, patience, and some money. This project took me about 6 months to complete (Don't worry, you can probably finish it in a couple weeks if you're motivated) and I spent about $60 on parts. However, you can modify the project to suit you needs (and save money). If you don't want all the bells and whistles, you can just omit them! In fact, this project really only needs an Arduino, two buttons, and the LED strip to work! Everything else is just extra.

I have divided this Instructable into two parts: The first part covers the building aspect and the second is an in-depth look at the software side of the project. I will do most of the in-depth explaining (I.E. How shift registers work) in Part 2. Also, I taught myself how to do most of the programming so my way may not be the best way to do something. If you know of a better way to code a function, please let me know in the comments section!

It is a good idea to test the components (LCD, LED strip, etc.) before and after you install them. To do this you will need to install the necessary libraries and then load the example from the correct library. I provide links to the libraries and tell you how to install them in step 9: "Part 2: Software".

As a last note, if you are having problems, check out step 19: "Troubleshooting, Troubleshooting, and more Troubleshooting" for some ideas on how to fix any problems. Also, be sure to frequent step 20: "Updates" for any updates/upgrades I do in the future.

Here is an index for easy navigation:

1. Operation
2. Part 1: Hardware
3. Base and LED Strip
4. Scoreboards
5. LCD
6. Arduino Shield
7. Mounting Everything to the Board
8. Buttons
9. Part 2: Software
10. Initialization/Setup
11. Main Function
12. Color Wheel Function
13. chaseForward and chaseReverse
14. player1Celebrate and player2Celebrate
15. rainbowCyclePlayer1 and rainbowCyclePlayer2
16. selectScore
17. shift1 and shift2
18. Final Notes
19. Troubleshooting, Troubleshooting, and more Troubleshooting
20. Updates
 
Remove these adsRemove these ads by Signing Up
hycday9 months ago

Hello !

Great project :)

I'm thinking about starting it soon, however I would like to know how easy is the code to change ?

Indeed I would like to add the two following function, but I have no idea on how to do it !

  1. if a player hits the button before the "ball" gets on his half, then he looses (the ball continues and the other player gets the point)
  2. the more a player waits before hitting the button, the fastest the boal returns back to the other side

Thank you very much for any help :)

Chip Fixes (author)  hycday9 months ago
Thank you!
1. This is already implemented in the code! :)
2. Okay so I'm not entirely certain how to do this so you may have to play around with it a bit: Look at step 11, the variable 'val' is what sets the speed of the ball, it's mapped to the potentiometer, but you can manually set it. You could set it to a specific value in the if statements in the last half of step 11.
For example: 'i' determines the number of LEDs in the string so you could do some code like:
if (i==3) //If the led is the third from the end
{
val = val+10; //Increase the speed by 10
}
if (i == 2) //If LED ball is two from the end
{
val = val +10; //Increase the speed by another 10
}
etc...

Hope this helps!
Kaj_s1 year ago
Is there a reason behind the switch of the order of Clock and Latch between the score board shift register and those for players 1 and 2?
Chip Fixes (author)  Kaj_s1 year ago
Nope, I got destracted and accidently soldered the latch before the clock on the scoreboard so I had to change the code haha
I see. :)
I noticed your project through HAD and I'm creating a proper set of PCB's for this so I can put it into a nice acrylic enclosure. PCB's also incorporate the microcontroller, so I don't have to lose a full sized Arduino board into it.

The lack of a full schematic makes me read everything, so I noticed the switched lines.
Chip Fixes (author)  Kaj_s1 year ago
Oh sweet, shoot me a message when you complete it, i'd be interested in seeing how it turns out.

Haha I thought about adding a full schem but then realized the picture would look really zoomed out because there are so many components.