Fork me on GitHub

Project Notes

#100 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

LEAP is just 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.

Projects are often inspired by things found wild on the net, or ideas from the many great electronics podcasts and YouTube channels. Feel free to borrow liberally, and if you spot any issues do let me know (or send a PR!). See the individual projects for credits where due.

For a while I have also included various scale modelling projects here too, but I've now split those off into a new repository. Check out LittleModelArt if you are looking for the modelling projects!

Project Gallery Notebook LittleCodingKata LittleModelArt More on my blog