Introduction: Arduino Game System
This project is a simple video game system. The project is based off an Arduino and an Arduino shield called the tellymate. This instructable describes the process of prototyping the system, and building the constituent parts. When finished the system can create simple text-based graphics or simple pixel-based graphics (hypothetically). As of now I've only written one game for it but I may update this instructable once I've created more.
Step 1: The Game
I won't go into great detail about the game as it's not that amazing. The game allows player one and player two to move a space ship up and down the sides of the screen (think pong 'paddles'). The two space ships can shoot at each other. Each player has a limited number of shots and lives, if your opponent shoots you enough, you run out of lives and die. The included code has three end screens (p1. win, p2 win, and tie) in addition to two instruction screens (p1. instructions, p2. instructions) a boot screen and a story screen. I'm not great at coding so feel free to suggest improvements.
EDIT: I also wrote a version of PONG which is now added to the instructable. There are two PONG files, one is two player (uses both controllers) the other is 1 player (uses one controller). Both versions have a selectable points cap, so you can decide how long you want to play for. I've updated the AI in the single player version, and you can now select skill level.
To get the PONG to work you'll need to change the fontbanks on the tellymate. Batsocks has an arduino sketch that will do this for you, read about it here. I've created my own fontbank in the Batsocks software and uploaded it to the tellymate. To upload my fontbank to the tellymate plug the tellymate into the Arduino and run the sketch called 'PONG_fontbank' (attached below). this will reprogram the fontbank so that PONG will work
Step 2: Prototyping
After I wrote the code I built the circuit on a breadboard with the Arduino intact. After successfully implementing the design I extracted the ATmega328 and embedded it (with a crystal) in the breadboard. This is the first time I've created a a stand alone Arduino project (i.e. no Arduino board just the ATmega) so I needed some help, This instructable was very useful.
Step 3: Layout
Before building the system I came up with an idea of how all the parts would go together. The final design is a board that sits on top of the tellymate (I will refer to this as the game board), two controllers, and a cartridge.
game board (no diagram)
The game board includes the power circuit that supplies the 5v for the cartridge and controllers. The game board also provides the connection between the tellymate and the cartridge, and the connection between the controllers and the cartridge. The game board is not technically complex (very few components) but has quite a few solder connections
The controllers are the handheld units that allow user input, they have a potentiometer an LED and a button. The controllers are connected to the game board by a long 5 wire cable.
The cartridge houses both the game processor and memory (the ATmega), and communicates to the tellymate based on the data it recieves from the controllers. The cartridge is essentially a very stripped down perfboard Arduino without the USB to serial connection or its own power supply. The cartridge is the most technically challenging section of the build and requires that you have some knowledge of soldering and how to properly handle electronic components. I ran into multiple problems building the cartridge due mostly to a sloppy connection between the ATmega and the 16MHz crystal.
Step 4: Controllers
The controllers allow the players to communicate with the game. Each controller has 1 potentiometer (I'm thinking of adding another), 1 push-button, and 1 LED. The controllers need 5 wires to connect with the game system, 1 wire for the pot, 1 wire for the button, 1 wire for the LED, and 2 for power. The pot and push-button both send information to the Arduino. The LED receives information from the Arduino.
To build the controllers I cut a piece of perfboard and drilled two holes in it to mount the pot and button. Next I attached the wire and wrote down which colours correspond to what. After that I soldered all the components in place.
Step 5: Game Board
The game board is the board that plugs into the top of the tellymate and allows the controllers to communicate with the Arduino/cart. The game board also provides the regulated 5v needed by the ATmega and the tellymate. The game board is not particularly complex from a parts stand point, but does have a lot of connections to solder and it has to be wired carefully.
I started by measuring a board that would fit over the tellymate, then I cut out the board and began assembling the power regulator. Next I wired up the controllers and the cartridge slot.
Step 6: The Cartridge
The cartridge is basically a stripped down Arduino. It has ten pins to talk to the controllers and the tellymate. This is probably the most challenging part of the build. It requires you know how to work with chips and can solder in tight spaces.
To build the cart I started by cutting out the board and soldering the chip socket on it. I then proceeded to populate the board. Once again this instructable is very helpful.
Due to my local electronics store not having a chip socket large enough for the Arduino at the time of the build I decided to use a female header. DO NOT DO THIS. It turns out that this created a very sloppy connection between the crystal and the Arduino. This meant that the Arduino's timing was off and it could not consistently communicate with the tellymate. I was in the end able to rectify this problem by using two 14 pin sockets instead of one 28 pin socket. In the pictures you will see that there are two clusters of ceramic capacitors, This is because I did not have the necessary 22pf caps available and instead used in parallel two 10pf capacitor and two 1pf capacitors. Don't do this either. It turns out that 10pf capacitors or 20pf capacitor will work just fine, however if you have 22pf capacitors, use them.
Arduino/ATmega328/168 pin map here
Arduinos breadboard page thing here (I didn't include a programming circuit)
Step 7: Put It All Together
The game board plugs into the top of the tellymate, the controllers plug into the game board, the cart plugs into its slot, and the tellymate plugs into the TV. Power up and you're ready to go!