DIY LED Arduino Display Game Console

by rcbecker1000 in Circuits > Arduino

361 Views, 6 Favorites, 0 Comments

DIY LED Arduino Display Game Console

IMG_2642.jpg

As I began to develop an interest for programming and electrical engineering and began to play around with micro controllers, I wanted to see how far one could go. This was an opportunity for me to dive deeper into how simple retro arcade games work and figure out how to recreate them my own way. I decided to put my limited knowledge to the test and create something substantial as my first large project. This project can help you to progress your programming and electrical engineering skills if you choose to dive into the code, or could just be an easy, fun project.


This game console is made out of an 8x32 LED array and uses an Arduino Mega or Arduino Uno to control it. The input comes from a 2 axis joystick with a push switch. It has four different games that can be cycled through: Tetris, Snake, Simon, and Draw. This is something that will be fun to build and continue to entertain even once you're finished!

Supplies

IMG_2609.png

Connect Joystick to Arduino

atari(uno) diagram step 1.png

Begin by connecting the female ends of five wires to the five pins on the joystick (GND, +5V, VRx, VRy, SW). Connect the GND wire to the GND pin on the Arduino, the +5V wire to digital pin 3, the VRx (x-axis) wire to the A0 pin, the VRy (y-axis) wire to the A1 pin and the SW (switch) wire to digital pin 2. Use the same pins if you are using an Arduino Mega.

Connect LED Matrix to Arduino

atari(uno) diagram.png

Connect the female ends of five new wires to the 8x32 LED matrix (VCC, GND, DIN, CS, CLK). Connect the VCC wire to digital pin 10, the GND wire to the GND pin, the DIN (data in) wire to digital pin 11, the CS (chip select) wire to digital pin 12, and the CLK (clock) wire to digital pin 13. Again, use the same pins if you are using an Arduino Mega.


The LED matrix works by using a coordinate system, so instead of referring to the lights as 1 through 256, they can be represented as an ordered pair of 1 through 8 and 1 through 32 which greatly decreases the amount of inputs needed. To encode these coordinates, the board uses an integrated circuit called the MAX7219 which converts lists of binary numbers to coordinates that can be displayed onto the LED matrices.

Add a Battery If Desired

atari(uno) battery diagram.png

If you want to, you may add a 9v battery to the Arduino which will make it so you can play without it being plugged into a computer. To do this, attach the battery connecter to the battery and plug the positive end into the VIN pin and the negative end into the GND pin on the Arduino.

Check

FADQS8OLXVUI7DF.png
atari(mega) diagram.png
IMG_2608.png

Your project should now look like the top image if you're using an Arduino Uno or the second image if you are using an Arduino Mega. The third image is a photo of how mine looks.

Download Arduino App

Screen Shot 2024-06-26 at 6.30.35 PM.png
Screen Shot 2024-06-26 at 8.22.30 PM.png

Go to the Arduino app download page (also linked in the materials) and download the app version that is right for your computer. Open the file and drag it into your applications folder.

Paste the Code Into the Editor

Screen Shot 2024-06-26 at 8.25.18 PM.png

Open Arduino and in a new project, paste the code in this link. The code contains four games that can be cycled through: Snake, Tetris, Draw, and Simon. The code for this project is written in C++, the default language for Arduino. Inside the code there are four game loops that are cycled through during the title screens using "goto" functions. Sprites for the title screens and dynamic boards are all saved in bitboards which can be put onto the display using loops. There is also a custom "get_direction()" function which when called converts the analog output of the joystick (0 to 5 volts) into one of four directions.

Upload the Code

Screen Shot 2024-06-26 at 8.30.30 PM.png
Screen Shot 2024-06-26 at 8.33.04 PM.png

Using the USB, plug the Arduino into a port on your computer and make sure that the Arduino app has the right board, processor, and port. To do this click on Tools and then change the board to either Mega or Uno, the processor to be the same as the board and the port to be your board. Once this is done, press the arrow at the top of the window to compile and upload the code to the Arduino board.

Play!

Atari

Once you have finished the project you're ready to play! Begin by using the joystick to go left and right to select a game. After you have chosen one, press the joystick down to select. To exit a game once you have died, press the joystick.

Here are the controls and rules for each game:

  • Snake:
  • Use joystick to control snake
  • Eat the dots to grow the snake
  • If the snake runs into itself or a wall, you lose
  • Tetris:
  • Left and Right to move block
  • Up to rotate
  • Down to accelerate falling
  • Press to hold blocks which gives you a new one that can be swapped back later
  • Create full rows to clear them and earn points
  • If a block hits the top wall, you lose
  • Draw:
  • Use joystick to control cursor
  • Press to either draw or erase
  • Use buttons at bottom for other options (empty square: eraser, square: pencil, X: clear, arrow: exit)
  • Simon:
  • A sequence of buttons flash and you must replicate the order. The sequence gets longer each time.
  • Use joystick to press the buttons in the correct order
  • If you input an incorrect sequence, you lose