Posted on

Simple Arduino Pong Game

Another one of those long overdue articles. I originally created this pong game 3 or 4 years ago, but it has gone through several great iterations since them.
This portable pong game has been a work in progress for many years. The components have stayed the same, but the enclosures and format have changed a fair bit.
The first version was created on a breadboard and was mostly just a proof of concept and a platform to figure out the code.
The second version was built inside a 3D printed enclosure and was a mess of wires inside.
Next version (number 3), I created on a 7x9cm perfboard and managed to keep the wiring a little bit neater, but it looked much better than previous versions with the added benefit of being more compact.
For the final version (number 4), I designed my own PCB to hold all of the components, with an easily replaceable battery holder.
As mentioned earlier, the circuit stayed the same throughout all versions (with the exception of a power LED on some). So let’s take a look at what that circuit consists of. I used an Arduino nano to control everything, a 1.8″ LCD display, 2 10K potentiometers, a switch, a TP4056 charge and protection module, an 18650 cell, and a 5V boost converter. These were wired up in logical fashion so that the 18650 cell was protected and the voltage would be stepped up to 5V for the system, and the Arduino communicated with the LCD over SPI while using the potentiometers as analog inputs to control the paddles.
For programming this, and part of the original inspiration for this project, I found an example on the Arduino website that showed 1-player pong, where the paddle could move anywhere as the ball would bounce off of it and the edges. I modified the code for this to make a 2-player version.

By far, the custom PCB version is the best because it is compact, neat, durable, and easy to wire everything up. If designing the PCB again, I would definitely use a different software than EasyEDA, as the one thing that was especially annoying was the UI. I could not figure out how to create rounded corners on the PCB, and their guides were not much help either. Since designing this board, I have figured out how to do that, but I still don’t enjoy the interface.
As for improvements on the code, there are plenty of things I would change – the main ones being a better menu, text facing the right way, and the ball not removing parts of a dividing line. When programming this, I just programmed it up to the point that it worked, and then stopped making improvements, which I somewhat regret now, but is not something I am going to go back and fix, as I have too many other projects that I am working on now.

Project By: Micah Black
Written By: Micah Black