Fork me on GitHub

Project Notes

#100 OLED/ArdWinVaders

An Arduino & OLED version of a classic game.

Here’s a quick video of the game in action:

ArdWinVaders

Or see this earlier video before the screen optimisations or sound. There’s a huge performance difference!

Notes

Since playing around with driving an OLED with an Arduino (see the SSD1306BareBack project for example), it doesn’t take long for the mind to wander into gaming territory…

So here’s the first version of a retro classic: Space Invaders in full 128x64 mono resolution running on an Arduino Pro Mini at 8MHz!

For details and discussion of the hardware setup, see the SSD1306BareBack project. This build is mainly about the software.

The software is organised into a number of classes. You can see the code for more details, but here is the overview:

  • ArdWinVaders.ino - main program, also handles all the controls input (fire, movement)
  • game_board.h/cpp - implements the main game controller class, responsible for orchestrating actions and sequencing gameplay
  • buffered_display.h/cpp - implements a logical display interface that GameBoard talks to. It maintains the screen buffer and handles movement, collision detection and so on.
  • oled_driver.h/cpp - implements the OLED-specific display driver. It goes direct to the hardware via SPI.
  • sound_system.h/cpp - music and sound effects support.

Game performance/screen refresh is pretty awesome even with the processor at 8Mhz. The big improvement came from switching to direct port manipulation for SPI rather than using the standard library methods (digitalWrite, shiftOut).

TODO

  • put it in a hand-held form-factor

Construction

The Breadboard

The Schematic

The Build

Credits and References

About LEAP#100 ArduinoOLED
Project Source on GitHub Return to the LEAP Catalog

This page is a web-friendly rendering of my project notes shared in the LEAP GitHub repository.

LEAP is my personal collection of electronics projects, usually involving an Arduino or other microprocessor in one way or another. Some are full-blown projects, while many are trivial breadboard experiments, intended to learn and explore something interesting (IMHO!).

The projects are usually inspired by things found wild on the net, or ideas from the sources such as:

Feel free to borrow liberally, and if you spot any issues do let me know. See the individual projects for credits where due. There are even now a few projects contributed by others - send your own over in a pull request if you would also like to add to this collection.