Microcontrollers are pretty cool; let’s build a game console.
Video demo at the bottom.
Make Up Some Requirements
The requirements call for a menu where the user can select a game to play. When a game is exited, the user returns to the menu.
Furthermore, there needs to be a way to plug the console into a computer and load in new games.
The components we’ll use:
- 8 bit AVR ATmega168V (1KB RAM; 16KB Flash)
- Nokia 3310 LCD (black and white 84x48) with backlight panel
- Buttons for D-pad, A/B, and start/select inputs
- 32KB EEPROM chip for game storage
- Li-poly battery (with external charger board)
Piezo buzzer speaker
To maximize RAM and flash available to games, and to increase performance, we can have two microcontrollers work together:
- The User AVR: Fully dedicated to the user’s running application (minus flash space for a bootloader)
- The OS AVR: Contains drivers, the game selection UI, and external interface for loading games
The ATmega168V can only execute code from flash. Therefore a bootloader on the User AVR reflashes the device every time an application is loaded. The ~10K limit on flash erase/write cycles works well enough for a project like this.
The two AVRs communicate over an SPI bus. While the application runs on the User AVR, the OS AVR processes RPC style requests to render graphics and play audio sequences.
Console boots and the OS AVR runs the (TI-calc inspired) menu UI, showing games loaded from a basic filesystem on the EEPROM chip.
Game selected. The OS AVR sends the game image to the User AVR to be flashed.
The User AVR starts executing the game.
While running, the User AVR does RPC to display graphics (text, sprites, lines) and play audio (tone sequences).
Upon game termination, the User AVR informs the OS AVR it should take over.
Prototype board during development
Compact final design
Write Games, Play Games
8 bit microcontrollers can go a long way :)