ECE434 Project - Arcade Stacker
Embedded Linux Class by Mark A. Yoder
Team members: Luke Wendel and Josh Mitterling
This project is a recreation of a common arcade game known as Stacker, in which rows of blocks bounce horizontally across the screen. The goal of the game is to stack the moving blocks row by row to the top of the screen, without dropping all of the blocks. We implemented the game using an LED matrix, a BeagleBone Black, and a pushbutton for user input.
- User Input device (pushbutton)
- 8x8 LED Matrix
- Playable Stacker game
What doesn’t work:
- 64x32 LED Matrix (Unsuccessfully implemented. After hours of debugging, its behavior did not begin to match what was expected.)
In the end, we were able to produce a nostalgic mini-version of the Stacker arcade game. It's a fairly straightforward project, which leaves a lot of opportunity for further development and interesting add-ons for us or others who find the project interesting.
We do not have any packaging. The BB Black, pushbutton, and LED matrix are bread boarded.
- BeagleBone Black
- breadboard and wires
- 8x8 LED matrix
- Push buttons
Any buttons you can tack on a breadboard will work. As will any breadboard and corresponding wires. The LED matrix we used is linked above. No kernel mods were used.
How to install the project:
- Building the circuit
Recreate the above circuit using the components you've acquired. The LED matrix requires 5V power, a ground (GND) connection, serial clock (SCL), and serial data (SDA) connections. The I2C pins on the BeagleBone Black can be seen on the pinout diagram below. They are P9_19 and P9_20 for SCL and SDA respectively. Connect the ground rail of your breadboard to pin 2 of the P9 header on the BeagleBone. Connect 5V power (pin 3), to the power rail on your breadboard. And finally, connect a gpio pin (we used P9_23, or GPIO_49) to one side of the pushbutton, and connect the other side of the button to ground. And your circuit is now complete.
Go to our github repository and clone it. The README file should include the setup and installation scripts.
The only python package needed to be installed is the Adafruit GPIO package, and the installation is handled by the install.sh file. The setup.sh file configures the IO and I2C of the BeagleBone for execution of the python file.
- Once the programs are downloaded and the setup has been run, open the Stack_game_project directory. you should already be there from running the setup.sh file
- you can then run the python script by running python and the Arcade_games.py file in the terminal. if you're using a debian installation on the BeagleBone, python is probably in the /usr/bin folder, so the command will look something like this:
- $/usr/bin/python /Stack_game_project/Arcade_games.py
- if you did it successfully, your LED matrix should have a bar scrolling at the bottom, which means your game is running, so press the button on your breadboard to stop the bar, and press it again to stack blocks atop the stack
- Our program implements an Interrupt Service Routine (ISR) using a button interrupt for the user input
- The program can play the game over and over again until you break it. No need to run the program again to run the game back
- The matrix will display a special sequence when you win the game
- there is an easter egg programmed in for when you win the game with no blocks lost
- it works
Here's a link to a video explaining how our project works and some of its cool features.
Theory of Operation
At initialization, the software connects to the peripheral display device.
This figure visually describes the game flow:
The operation can be represented as a state machine, where the push of a button changes the idle state to an action state. In the action state, the program will determine the blocks stacked, check the game winning condition, and check the game loss condition.
We have worked together throughout our undergraduate experience, so it's easy to collaborate and connect our ideas together. Much of the work was done together, but one of us was more responsible for each of the following tasks:
- Wiring up the 64x32 LED matrix, managing the IO and headers - Josh
- Developing the initial driver for the 64x32 LED matrix - Luke
- Developing the Stacker game logic and program flow - Josh
- Implementing the logic and constructing a template file - Luke
We worked together, by pair programming, to debug the program and get the game to a playable state.
Work not done yet: Migrating the game to the 64x32 LED matrix to be playable.
This project is a straightforward example of controlling user input devices to play a fun game. More games = more fun, so having a way to select a variety of different games on an LED Matrix, ideally of a larger size and higher resolution, would be very cool. We would start by adding Tetris as a second playable game, and go from there.
We have a working game of Stacker in minigame form on the BeagleBone Black. This smaller version provides a bit of a nostalgic experience, and it was a good opportunity to get even more familiar with the Beagle Bone Black as a microcontroller and embedded linux platform. It required much collaboration, flexibility and debugging. We hope that anyone who stumbles upon this project finds it interesting, but there are a few more things we would have liked to do in furtherance of that aim. The first possibility would have been a second LED matrix that offers a multiplayer experience, where 2 players race to finish Stacking. As mentioned earlier, a second game, maybe mini-Tetris would have been nice. Or at least a few cosmetic upgrades (a bigger pushbutton, packaging, etc).
Embedded Linux Class by Mark A. Yoder