Introduction: Mithotronic LEDmePlay Gaming Console
The LEDmePlay is an open-source gaming system powered by an Arduino Mega 2560. It is easy to build. The games are displayed on a 32 * 32 RGB LED panel which fits perfectly into a picture frame. The idea is to pare the game play down to its very essence without compromising action, speed, and fun. Inspired by many other LED projects we had watched on YouTube, the LED panel seemed to be the obvious solution for our endeavour. Check this construction manual to find out how you can build your own LEDmePlay, and download and try the games on our website www.mithotronic.de.
Step 1: Introduction
These steps describe how to build the LEDmePlay. Feel free to change parts of our design or add extra features, such as additional buttons, a more fancy housing, or a smaller LED matrix. Firstly, you need to buy the required electronics parts. The main components are the Arduino Mega 2560, the RGB LED matrix, and a suitable power supply. Additionally, you need some cables that connect everything. Whether you plan to use the same picture frames that we used for the housing is up to you. The joysticks need not be the same as the one we used. Any C64 compatible joysticks from the Eighties era should work. What about real arcade controllers inside a small arcade cabinet?
Here is the parts list. Unless otherwise stated, you can buy these or compatible parts from any electronics specialist shop. We paid an overall price of approximately 100 EUR.
- Arduino Mega 2560
- RGB LED matrix 32 * 32, e.g., from Adafruit (www.adafruit.com, PRODUCT ID: 1484) or a compatible matrix with pixel configuration SMD3528 1R1G1B (P6 with the size 192mm * 192mm)
- 2 * C64/AMIGA-Joysticks (e.g., Competition Pro, Quickjoy, Quickshot)
- Power supply (~2A), adjustable to 5V (note that sometimes 6V are needed, see below)
Connections and buttons
- Potentiometer 4.7KΩ (for volume control)
- 2 push buttons (reset, pause)
- Switch (on/off)
- 2 * 9-pole sub-D male connector (joysticks)
- 5.5mm female connector (connection to power supply)
- 5.5mm male connector (internal connection to Arduino)
- Small speaker (e.g. LSM-50A-8 with 8Ω)
- (Optional) USB female connector (hexagonal, not the flat type) (connection to computer)
- (Optional) USB male connector (internal connection to Arduino)
Cable and other small parts
- Copper strand (for internal connections)
- Ribbon cable (16-pole)
- Female connector (multi-contact IDC connector) for ribbon cable
- Multi-pin connector grid dimension 2.54mm (male)
- Heat shrink tube
- 4 * distance sleeve
- M3 screws (short ones and a few long ones for the Arduino board)
- M3 nuts
- M3 snap rings
- 2 * picture frames model of size 252mm * 252mm * 45mm (from a Swedish home-center)
- Small woodscrews
- Self adhesive protectors as bases
Step 2: Preparing the Arduino
You should first install the Arduino IDE (Integrated Development Environment) on your computer, as you will need it to upload programs ("Arduino Sketches") onto the Arduino and of course if you want to develop your own games. Grab the Arduino IDE 1.0.3 from http://www.arduino.cc. With a newer version (we tried v 1.6.x), compiling the libraries for the RGB matrix might not work. These libraries, Adafruit_GFX library and RGBmatrixPanel library can be downloaded from the Adafruit tutorial webpage http://learn.adafruit.com/32x16-32x32-rgb-led-matrix/downloads. Follow the instructions there: "Rename the uncompressed folder Adafruit_GFX and confirm it contains Adafruit_GFX.cpp and Adafruit_GFX.h. Place both library folders inside your/libraries/ folder. You may need to create the libraries subfolder if its your first library. Restart the IDE."
After that you may want to upload one of the Adafruit example programs onto the Arduino. For instance, try the demo named plasma_32x32 from RGBMatrixPanel directory. The result is simply beautiful. As we use the Arduino Mega 2560, we need to adapt the source code of the demo a bit since the original code is tailored to the Arduino Uno (the Uno exhibits a different pin assignment). Replace the following lines
#define CLK 8 // MUST be on PORTB!
#define OE 9
by these lines:
#define CLK 50
#define OE 51
Now, the demo program should run fine on the Arduino Mega.
Step 3: Connect the Arduino MEGA With the RGB LED Matrix and the Power Supply
We will now make the connections between the Arduino Mega and the RGB LED matrix.
Prior to that you might have to link the two parts of the matrix by power lines. This depends on your variant of the matrix. There are different variants in the field like the one shown on the pictures. If you have this variant, you should have the power lines in the same package as the matrix itself. The upper pins that correspond to the positive pole are connected to the red cable as shown in the picture. For the alternative variant, this is not required.
We now need to solder the connection cable. Plug the 16-pole ribbon cable into the female connector on the one side (by compressing the clips of the connector). This end is connected with the matrix. The other end of the cable requires some more work. First, you have to strip the cables. Then you have to solder male pin connectors which are plugged into the Arduino.
For the connection, adhere to below scheme. Cut the multipin connectors into the required sizes (you will need 4 times length 2, length 4, and a single pin). Use the heat shrink tube before you solder the pins to the cables. After soldering, heat them with a hairdryer. The finished cable end is shown in the picture.
Connections between the LED matrix and the Arduino Mega
- Pole 1: R1 -> digital 24 (1st pin of the 1st length 2 multipin connector)
- Pole 2: G1 -> digital 25 (2nd pin of the 1st length 2 multipin connector)
- Pole 3: B1 -> digital 26 (1st pin of the 2nd length 2 multipin connector)
- Pole 4: GND -> not used
- Pole 5: R2 -> digital 27 (2nd pin of the 2nd length 2 multipin connector)
- Pole 6: G2 -> digital 28 (1st pin of the 3rd length 2 multipin connector)
- Pole 7: B2 -> digital 29 (2nd pin of the 3rd length 2 multipin connector)
- Pole 8: GND -> not used
- Pole 9: A -> analog 0 (1st pin of the length 4 multipin connector)
- Pole 10: B -> analog 1 (2nd pin of the length 4 multipin connector)
- Pole 11: C -> analog 2 (3rd pin of the length 4 multipin connector)
- Pole 12: D -> analog 3 (4th pin of the length 4 multipin connector)
- Pole 13: CLK -> digital 50 (1st pin of the 4th length 2 multipin connector)
- Pole 14: LAT (STB) -> digital 10 (single pin)
- Pole 15: OE -> digital 51 (2nd pin of the 4th length 2 multipin connector)
- Pole 16: GND -> not used
Next is the Y-cable from the power supply to the Arduino and the LED matrix. You need a female connector that fits your power supply. Before soldering, consider the polarity. The thick red cable on the matrix shall interconnect the positive poles. The Arduino is connected via another male connector that fits into the power jack. Note that the inner pin of the Arduino jack demands the positive pole. Optionally, you can install an on/off switch between the female connector and the power cables that lead to LED matrix and Arduino.
Now, we are ready for the first test. Make sure that your power adapter is set to 5V and that the polarity is correct. Connect the ribbon cable to the matrix and to the Arduino pins as described above. Then power the matrix and the Arduino with your newly created power cable (cf. picture).
Ensure that everything has been wired correctly, then switch on the power. After a few seconds the Arduino should start to execute the program. You should see something on the RGB LED matrix. Congratulations - this was the most challenging part! Occasionally, it might happen that you see just a few dithering lines on the matrix, but the Arduino does not not start the program. We have observed this problem several times (on some of our prototypes more often than on others). Mostly, you can simply turn off the power and then on again. However, we believe this behavior has something to do with the voltage we are using. We are operating close to the lower limit of the required voltage. It is conceivable that the voltage sometimes drops below the lower limit due to component tolerance. In order to resolve the issue, we have switched to 6V.
Step 4: Soldering the Remaining Connectors
Our games support standard C64/AMIGA joysticks with one fire button. For the joysticks, you need 9-pole sub-D male connectors. The 9-pole connectors need to be soldered to 6-pin male multipin connectors that lead to the Arduino (please see below pin assignment for the two joysticks). Furthermore, you need to connect the reset and the pause push buttons. The audio pin is soldered directly to the speaker. Looping-in the potentiometer in-between makes the volume adjustable.
Important: You need to link several wires to the Arduino's ground pin (GND), namely the other pin of the speaker, the second pin of each push button and pin 8 of the sub-D connectors.
The following overview shows the pin assignment for the joysticks, the buttons and the speaker:
- Audiopin -> digital 2 (connected with the potentiometer)
- Joystick 1 up: sub-D male pin 1 -> digital 30
- Joystick 1 down: sub-D male pin 2 -> digital 32
- Joystick 1 left: sub-D male pin 3 -> digital 34
- Joystick 1 right: sub-D male pin 4 -> digital 36
- Joystick 1 fire: sub-D male pin 6 -> digital 38
- Joystick 1: sub-D male pin 8 -> GND
- Joystick 1 fire 2 (optional): sub-D male pin 9 -> digital 40
- Joystick 2 up: sub-D male pin 1 -> digital 31
- Joystick 2 down: sub-D male pin 2 -> digital 33
- Joystick 2 left: sub-D male pin 3 -> digital 35
- Joystick 2 right: sub-D male pin 4 -> digital 37
- Joystick 2 fire: sub-D male pin 6 -> digital 39
- Joystick 2: sub-D male pin 8 -> GND
- Joystick 2 fire 2 (optional): sub-D male pin 9 -> digital 41
- Reset push button -> digital 42
- Pause push button -> digital 43
The pictures should assist you to assign the pins of the sub-D male connector. Pin 5 is never used. Pin 9, which is optional, is not used, too, on the picture. After soldering, you are ready to play.
Step 5: Housing
If everything was successful, you may want to design a housing. The possibilities are endless. We use two picture frames we got from a Swedish home-center which are screwed together. The first one contains only the LED matrix which is fixed to the rear panel. That one must be tooled with a saw before, in order to have a rectangular hole for the cables (see picture). The glass pane of the second frame is removed. The two frames are screwed together at their inner sides using small metal or wooden plates. These are held in place by wood screws (see picture). The rear panel of the second frame carries the Arduino board, the speaker, and the connectors. The rear panel can be kept in place by the clamps of the frame when closed. The easiest way to maintain a USB connection to your computer would be to saw a small opening into the rear panel as a cable outlet. There you can plug an extension cable if required. If you have another idea for a housing, we would be happy to hear from you.
Step 6: Games
You can find an assortment of games for your LEDmePlay on our website www.mithotronic.de. Feel free to download the source code for the games and try them out. You may also want to modify and improve them. If so, we would be happy to feature your creations on our website.