Game with 8x8 LED matrix on Arduino
In this article I want to share a simple game I created on Arduino with 8x8 LED matrix created on a single breadboard. The main goal was to build a game console with all components located on a single breadboard.
Components
- Breadboard
- Arduino UNO
- 8x8 LED matrix
- Driver MAX7219
- 4 Buttons
- Bunch of wires
- four 470 Ohm resistors
- one 10 kOhm resistor
Software requirements
You need to have:
- Arduino IDE
- LedControl library
- Game’s source code
Connections
I won’t explain it in details. I just will put a couple of photos that will show you how to set up the most important connections.
Arduino is on the backside of the breadboard.
Arduino is not attached to the back side of the breadboard. Wires are strained in this way just to simply hold Arduino in place.
Four buttons are connected to the Analog Input PINs from A0 to A3.
- A0 - Connects to the button that shoots from the right side of the spaceship
- A1 - Connects to the button that shoots from the left side of the spaceship
- A2 - Connects to the button that moves spaceship to the left
- A3 - Connects to the button that moves spaceship to the right
Three wires are connected to PINs 10, 11 and 12.
- PING 12 - DATA IN-pin
- PING 11 - CLK-pin
- PING 10 - LOAD(/CS)-pin
The most messy part is the one that connects MAX7219 driver to LED matrix.
The first matrix input goes into the hole near number 25 at the bottom of the photo.
It’s hard to understand something just by looking at this photo. In case if need some more information you can check this Tutorial. It has a scheme that helps you connect these components.
Useful resources
During the building process I found a few useful resources that helped me build this device.
- Tutorial that helps connect MAX7219 driver and LED matrix
- Online tool that helps create binary images and save them as an array of hex/binary values.
Source code
The main source code you can find at my GitHub repository. If you find a bug feel free to create an issue or pull request.