Thursday, April 14, 2011

LED Matrix Pong!

LED Matrix Pong

I'm taking a robotics course this semester and we're learning how to use the Arduino. For our midterm project, my partner and I created a version of pong on two 8x8 LED matrices. Since the Arduino only had a limited number of digital I/O, we used four shift registers to control the two matrices. Additionally, we used a force sensor to control each paddle. Below is the schematic of how we wired everything up. Our wiring became a bit unruly as we put in the last shift register, but we eventually got everything to work.

(click to enlarge)

I mainly worked on the code for the Arduino. The program follows the idea of having a global matrix that represents the board, and then a function that displays the matrix on the actual LED matrices. That code proved to be the hardest because it required messing around with bit shifting to get the refresh rates to be bearable. This is an area of the project that needs the most improvement. As you will see in the video below, the game is quite flicker-y. Besides displaying the matrix, though, the rest of the code was pretty easy to write.

Click here to download the code.

Robotics 2 Midterm Project from sambot on Vimeo.

LED Matrix Pong

Creative Commons License
Arduino LED Matrix Pong by Sam Prestwood and Eddie Lichter is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Based on a work at


  1. That looks great! I wonder though, shouldn't there be any resistors? All setups with LEd matrixes and shift registers I see on the net seem to be using those.

    1. In retrospect, we should've done the wiring a bit differently. We didn't need to use resistors because the current produced by the arduino (and in turn by the shift registers) was so small that it didn't overpower the LEDs. With that being said, the proper way to wire an LED matrix is with transistors/FETs tied to a beefy power supply. That way, you can use the low current produced by the microcontroller to "turn on" the higher current power from the power supply. In that situation, you would need resistors.

  2. But if you don't use resisters you are expecting the Arduino to do your current limiting for you. I think it can take it, but it could damage the board. Of course I am just learning this stuff myself so I very well could be wrong.