Bit Racer: an Arduino-run Video Game

by HQManiac in Circuits > Arduino

21 Views, 1 Favorites, 0 Comments

Bit Racer: an Arduino-run Video Game

ME608 Project Done

As part of my collegiate coursework, I was asked to create something using a sensor I hadn't used before. I decided that this was sufficient grounds to attempt to push the bounds of what I knew an Arduino could do, and this is the result. A simple, one-bit racing game. However, due to time constraints, the other racers have been replaced with landmines. Don't hit them.

Additionally, this game has a soundtrack! Unfortunately it's too performance crippling to run on the same Arduino as the game, but you can connect a second one to get the Audio playing.

Supplies

Necessary components:

1 Arduino Uno R3

1 Breadboard, large

1 Adafruit 2.42" Monochrome OLED (Comes with an included CD4050BE Hex Converter and 220 uF capacitor)

1 Adafruit BNO055 Inertial Measurement Unit

1 Push button

1 CD4050BE Hex Converter, for a total of two


Optional Components:

1 Additional Arduino Uno R3

1 Additional Breadboard (any size)

1 220 Ohm resistor

1 104 nF capacitor

2 1K Ohm resistors

1 100uF Capacitor

Solder Adafruit Part Connections

The two Adafruit kits, the display and the BNO055 both come with pin headers that can be attached to them for easy mounting to a breadboard.

For the Display, solder the pin header on such that the long side of the pins points down, below the display. This will allow you to simply press it into the breadboard later.

For the BNO055, it is would be a good idea to solder long wires directly to the board, as opposed to attaching the header. This is because we will be using it as our controller and as such will be moving it a lot. In testing, the connections made to the pin header came loose rather often, which crashes the game. If this isn't something you feel confident in doing, or you plan to use this for other projects in the future, then solder the provided pin headers to the appropriate spots.

Wiring

Circuit Diagram In Progress.png
Line In.png

Place the non-optional components onto the large breadboard, and wire as shown in the circuit diagram. It is mission critical that the wires connect exactly as shown, as a single misplaced wire will prevent the entire system from booting up and could cause other problems.

Also, there is an error on the circuit diagram - what is labeled as a 104 pF capacitor is actually a 104 nF capacitor.

If you are not planning to add the audio, then ignore the lower Arduino and all connected components

If you are planning to add the audio, place all components (Resistors and Capacitors) connected to the lower Arduino onto the second breadboard. This is purely for easy access, and to minimize clutter on the main board.

Make sure to connect the Line Out on the circuit diagram to the Line In on your 3.5mm jack as shown. You don't have to connect both of the Line Ins shown, as the audio is mono not stereo, but at least one of them must be connected for sound to play. Make sure the ground of the 3.5mm jack is connected to ground on the second Arduino, otherwise it may not work correctly or at all.

Program

Now it is time to upload the attached code to the Arduino.

The file "Video_Game_Final" should be uploaded to the Arduino connected to the screen.

If you are using the audio, the file "Audio_Test" should be uploaded to the Arduino connected to the resistor/capacitor circuit.

Finishing

Since the BNO055 is the controller for the game, you should devise a way to attach it to the back of your hand, similar to how it is shown in the video. This is left as an exercise to you, the reader, as my solution was sufficiently jank that I know you can do at least as good a job.

And there you have it! Now you too can play Bit Racer. Enjoy.