High Level Design
After working with the ATmega family of processors for the first six lab assignments, and working extensively with generating television screen images, we decided that a video game would be a viable goal for a final project. While not as hardware-intensive as some projects, we decided that our experimentation with the analog-to-digital converter (ADC), as well as our plans to build the circuit onto a permanent printed circuit board would provide a sufficient hardware component for our project. We chose the Arkanoid concept because the basic game is not highly complex, which would make it very likely that we would finish in the allotted four weeks for the project. However, one the basic game works, the Arkanoid concept allows for many additions that would enhance the game playing experience. When we started, we listed three sets of goals which are listed below. The first set of goals was a minimum that wanted to accomplish, the second set represented what we had hoped to have time to accomplish, and the third set represented goals that we thought would be interesting but probably would not have time to accomplish.
- Goal 1: a working game with 128×100 resolution reasonably smooth game play without any noticeable screen flicker
- Goal 2: mechanism to keep score of the game additional levels with more walls and obstacles additional smoothing of game play (if necessary)
- Goal 3: power ups different ball speeds more balls simultaneously platform width adjustment sound effects
The Arkanoid concept fit well with our desire to have such a set of goals, which is why we chose it for our project.
At a high level, our project is composed of several key software and hardware components. Our primary software component is the code that generates an NTSC video signal. One section of this code is composed of functions that place points, lines, and text into RAM where they are stored in a format that represents a black-and-white 128 x 100 pixel video image. A second section works to output this image to the television screen at a specified interval of about 60 Hz. Another key component is our algorithm that allows the ball to change direction while maintaining a constant speed and allows the user to control the bounce angle by hitting the ball with different parts of the platform. Another software component is our code to read the analog joystick’s position using the Atmega32’s ADC. Finally, we have a section that keeps track of game status information, such as the current level, the number of blocks remaining on the current level, and the number of balls remaining.
On the hardware side, our major component is our joystick, for which we use a standard potentiometer which is connected through a headphone jack and a length of telephone cable to the project board. We also use a set of resistors and diodes to construct a circuit for generating a black and white television image using a standard composite video connection. Finally, our stand- alone board includes a 16 MHz crystal to clock the chip, a low-pass filter for the analog power supply, a reset switch for the chip, a connector for an external 6V DC power supply, and a connector for a programmer (such as an STK500 board) to program the chip.
We built a stand alone circuit so that the game could be played without the STK-500 board. Shown below is the circuit diagram and some photos of our actual circuit. Many of the parts including the switch, 5K variable resistor, plugs, and wires were scrounged from Richard’s electronics stash.
- (1) Atmel Mega163 Microcontroller – Free
- (1) 5k ohm Linear Variable Resistor – Free
- (1) 6V 500mA Power Supply – Free
- (1) Telephone Cord (used as paddle cable) – Free
- (1) Audio Cord (used to connect our circuit to the TV) – Free
- (1) Reset button – Free
- (1) Headphone plug – Free
- (1) Headphone jack – Free
- (1) Power plug connector – Free
- (1) Video connector – Free
- (4) Diodes – Free
- (2) 100nf capacitor – Free
- (2) 27pf capacitors – Free
- (1) 10uH inductor – Free
- (1) 100k ohm resistor – Free
- (1) 1k ohm resistor – Free
- (1) 330 ohm resistor – Free
- (1) 100 ohm resistor – Free
- (1) 16MHz crystal – Free
- (1) PC board – Free
- (1) Wires – Free
For more detail: Arkanoid Video Game