AbHhGD - the Arduino Based Hand-held Gaming Device




Introduction: AbHhGD - the Arduino Based Hand-held Gaming Device

This is a write-up on my Arduino based hand-held gaming device. I realize it’s a somewhat poshy statement but hey, it is Arduino based, it’s hand-held and it’s a device that plays games!

Step 1: A Hand-held Gaming Device...

The device sports a couple of games and a menu system consisting of a letter indicating the current selection. The menu options may be selected by turning the dial and the corresponding game is started pressing either one of the push buttons. When the game is finished playing it returns to the menu system allowing the user to immerse herself in yet another one of the many exciting gaming experiences the AbHhGD has to offer!

Step 2: The Parts

To build this little hack requires just a few parts:

  • Arduino Nano/Uno.
  • Max7219 LED matrix.
  • Mini bread board.
  • Two push-buttons.
  • 50K Potentiometer.
  • And of course, some jumper wires.

Step 3: The Wiring

The LED matrix already contains a Max7219 LED driver chip so wiring it is very easy. Five wires is all it takes and each of them go to the Arduino. The attached sketch expects the following pins:

  • VCC - 5V
  • GND - GND
  • DIN - D12
  • CS - D10
  • CLK - D11

Step 4: The Controller

Then the controller stuff: the potentiometer is wired to 5v, ground and analog port #1. The buttons are wired to ground and respectively D4 and D5. I used the Arduino’s internal pull-up resistors to pull the in-ports high. Since the game loop runs rather slow there’s no need to bother with debouncing so I didn’t bother using any capacitors, although a 10uF capacitor between the potentiometer’s middle pin and ground might take care of some occasional jerkiness in the dial’s readings.

Step 5: The Games, the Code

The games, six of ‘m as of yet:

1. Good ol’ Pong, the well-known infinite loop [Bounce the ball with the paddle. Wait for the ball to return. Repeat]. I’ve put in a very rudimentary level-up strategy, mainly to keep me from going insane while testing during development: everytime the ball hits the paddle a level-up-counter goes up by one, every ten level-ups the game runs a little bit faster. After two times going a bit faster two bumpers appear in the playing field. If the player even survives that ordeal for ten hits in a row the paddle shrinks by one dot. This repeats until the paddle has shrunk to no paddle at all.

2. Tedshow. A regular feature in a rather moronic quiz show called “De Ted Show” which was aired during the early eighties in the Netherlands would require the winner of the quiz catching some sticks falling randomly out of the ceiling to determine the prizes he or she would win. The game is as brain dead as the quiz show I’m afraid.

3. Space Invaders. This true classic features some of the most effective A.I. in gaming history: [Keep moving left, until hit wall. Move down. Keep moving right, until hit wall. Move down. Repeat]. Due to scarce real-estate however, I modified it a bit in having the invaders bounce to and fro a couple of times before moving down. The player is allowed to fire a single bullet at the time, as are the invaders. Starting with two rows of invaders, each level-up adds another row. Again, scarce real-estate forced me to refrain from adding a fourth level. Guess I should have put in a boss-level..

4. Snake. Turn left and right using the push buttons. Eat apple, snake grows and moves faster. Don’t bite yourself!

5. Break-out, or Pong with obstacles.

6. And of course, no gaming device is complete without a racing game!

The sketch contains a number of different units. Some of those units in turn consist of both a .h (header) file and a .ino file. The should be rather self-explanatory and is full of comments to clarify.

Step 6: The Casing

Finally, a nice container would add to the portability of the handheld gaming device :-)

I started out with a little plastic container. The lid would fit the LED matrix and the buttons and dial. I made a square hole in it and hot-glued the LED matrix fixed. I swapped the Arduino Uno with a Nano and had to bend the Nano’s pins to make it fit the container. I used a lot of hot glue to prevent the pins from shortening with any metal parts inside the container. The buttons are hot-glued to the case as well and the potentiometer would fit nicely through an M6 drilled hole.

It is somewhat bulky, especially with the 9v battery container hot-glued to the back, but certainly a handheld gaming device now it is!

2 People Made This Project!


  • Creative Misuse Contest

    Creative Misuse Contest
  • Tiny Home Contest

    Tiny Home Contest
  • Fix It! Contest

    Fix It! Contest

13 Discussions


I was wondering how to download all the libraries for the code because when i try to download them into the libraries file the Arduino I.D.E it says this...

Arduino: 1.8.1 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\MRYntema\AppData\Local\Temp\Temp2_FAYTMGRILJSEUQ1.zip\ABHHGD\ABHHGD.ino:13:19: fatal error: types.h: No such file or directory

#include "types.h"


compilation terminated.

exit status 1

Error compiling for board Arduino/Genuino Uno.

This report would have more information with

"Show verbose output during compilation"

option enabled in File -> Preferences.


Has anyone been able to build this with Arduino IDE 1.6.XX ? I have 1.6.11 and one of many errors I get is:

'Controller' has not been declared

Looking at the .ino files, none of them includes any header files - does the IDE do this magically somehow?


Hey! I'm about to make your project, but I have absolutely no idea how to upload the code sense it's all separate. Could you help me with that? Thanks!

2 replies

Hi there,

If unzip the file into a folder named ABHHGD and open the ABHHGD.ino file in the Arduino IDE it should build.

Just don't forget to also install the libs:

LedControl: http://wayoda.github.io/LedControl/
LinkedList: https://github.com/ivanseidel/LinkedList

Thank you so much! It worked! Now all I have to do is wait for my LED matrix to come in :/

This is really an amazing project! Thanks for sharing!

In the AbHhGD arduino folder it has...

#include <LinkedList.h>
#include "LedControl.h"

when they both don't exist... Help?

1 reply

Ah yes, I'm sorry, should have added that to the write-up. The sketch uses 2 libraries, one of them being the LedControl lib and the other is a LionkedList object:

LedControl: http://wayoda.github.io/LedControl/
LinkedList: https://github.com/ivanseidel/LinkedList

Just install them as any Arduino library.

I wonder how hard it would be to port it to the digipixel.
Flappybird works great on 64 leds btw.

Incredible. I probably couldn't even.

Great project! Thanks for sharing, I plan to make a rainbowduino version when I get a chance.

Nice documentation! Thanks for sharing your project and welcome!

1 reply