DYI Pong console based on Arduino and an RGB LED matrix

The finished product

TL;DR: It’s a dedicated desktop Pong console for two players. An Arduino Uno provides the brains, and an Adafruit 16×32 RGB LED matrix the display. The only inputs are two potentiometers connected to two of the analog inputs left free by the LED matrix. There are a couple of pins still available, and initially thought I’d use them to add a push button for each player, but decided to go with a minimal user interface instead.

Background

I recently felt the need to make some kind of a project that would make pretty lights blink. I’ve always liked the look of the RGB LED matrixes from Adafruit, but I just haven’t any project in mind that could’ve used one. After thinking about a suitable project for a bit, I decided to go with Pong.

Design

I started off by designing the whole thing in Blender. No, it’s not a CAD program, but it can be used like one for simple designs. I chose the thickness of the various component pieces based on thicknesses of available materials. I ended up using just three different materials: 12mm MDF, 4mm plywood and some oak plank.

3D model of the console in Blender

Right from the start, I also decided to properly document the build. This meant creating drawings of each component before cutting any material. This in fact saved me some trouble, as I noticed a few problems with the original design while making the drawings. I used Inkscape for the drawings, which _really_ wasn’t the right choice. Next time I’ll learn to use a CAD program.

The control units on the ends of the console are designed to come off with a couple of bolts. This allows me to swap on different controls if I want to play some other game that’s not well suited for paddles.

Building the console

Once the design was ready, I cut the pieces using a table saw and hand tools.

Drawings and the matching pieces

I test fitted the pieces several times while I was making them. Since they weren’t perfectly symmetrical, I made marks on the pieces to make sure I’d align them the same way every time.

The MDF and plywood surfaces that are visible in the finished product I painted with some filler primer and some glossy black from a rattle can. As expected, this took quite a bit of the filler primer, as MDF tends to absorb a lot of paint.

Painted control units

The side panels were cut from an oak plank, sanded carefully, and then oiled with a linseed based product.

Another important piece was the “separator grid” that makes sure each LED only lights its own pixel. This was painstakingly cut from thick paper, slotted, assembled and glued. I can’t recommend doing the same. If you have access to a 3D printer (mine’s out of commission at the moment), you’ll save a lot of trouble by printing an 8 mm high 16×32 square grid of 6mm squares.

Electronics

There really wasn’t much to do with the electronics side of things. The matrix connects to the Arduino with a shield that’s specifically designed for it. All I needed to do was add the wiring for the pots and power.

All the electronics. Note the extra yellow and white wires for the push buttons.

Connecting the RBG LED matrix was really easy with the shield; just plug and play. The pots are connected to pins A4 and A5.

Assembly

Finished pieces ready for final assembly

 

The top plate, acrylic screen and the diffuser

 

Display frame and the separator grid

 

Display mount and the display.

The display was actually slightly thicker than the specifications stated. The stated thickness was 12mm and the actual thickness 13mm. Since I used 12mm MDF as the display frame, I needed to add a couple of spacers on the frame bolts between the frame and the display mount.

One of the side panels attached

 

The second side panel attached, with the pot wires threaded through the ends of the frame
 
Control units bolted on. Some angle wasn’t quite 90 degrees; Note how the end of the control unit is not on level with the side panel.

Software

With the hardware finished, it was time to think about the software side. Since debugging with an Arduino is not ideal, and uploading new iterations of the program is quite slow, I decided to first program the game using Javascript and testing it in a browser. This worked quite well, even though I ended up having some bugs after translating the Javascript to C, due to the implicit variable types in Javascript not matching my chosen C variable types.

Resources

In case you want to do something similar yourself, here’s everything you need:

The javascript version can be played here.

The Arduino code can be downloaded from GitHub.

The drawings for the console pieces are available in this zip file.

Conclusion

This was a fun little project that I even managed to finish in a decent amount of time. Although… with Pong there aren’t that many pretty lights blinking, and the ones that are are all the same color! Maybe I need to do another, flashier, project some time soon.

Please leave any questions or comments below.

2 comments

  1. Just doing different things (woodworking, electronics, programming) for years, and then simply putting it all together. 🙂

Leave a comment

Your email address will not be published. Required fields are marked *