Micro:Gamer is a portable game console based on the micro:bit board. It features a 128x64 monochrome OLED screen, six buttons (plus the two buttons of the micro:bit), a buzzer for sound and a 2xAAA battery holder. The micro:bit is inserted in the back of the board, like a game cartridge on the GameBoy. The specs being similar to the Arduboy, it is quite easy to port existing games to the Micro:Gamer.
Let me know in the comments section if you are interested by this project, what would you add/remove and if you would like to get one.
Micro:Gamer is now available on Tindie!
A couple months ago, given the feedback I received on the project, I decided to order a batch of 20 Micro:Gamer from Seeedstudio. They are now available on Tindie.
On the software side, the Micro:Gamer library is integrated in the Arduino library manager. So it is even more easy to start programming.
https://www.tindie.com/products/Fabien-C/microgamer/
The idea and the first prototype
Like most of you I suppose, I love the micro:bit. It is very affordable, available everywhere, quite powerful and it even has an integrated programming/debugging probe. However, one “disappointing” aspect in my opinion is the 5x5 LED matrix. It can barely display text and cannot be used for anything beyond very very simple “games”. A couple months ago I saw the Adafruit OLED Bonnet for Raspberry Pi and I thought it would be cool to have something similar for the micro:bit, so I decided to give it a try.
One of the design choices for the Micro:Gamer is to embrace the micro:bit edge connector. There are a good number of disadvantages with this connector, it’s big, there is no SMD version (at least I couldn’t find one). But for this project in particular I think it is great because it mimics the cartridge of a retro console like the GameBoy. If you have more than one micro:bit you can program different games and swap between them.
For the batteries, my first idea was to not include any on the board (keep it simple), but then it’s not really a portable device anymore… The next choice was between a coin cell battery and 2xAAA. I decided to use the AAAs because - even if they are bigger - it is easy to find rechargeable ones.
For the software I use the Arduino IDE and a modified Arduboy2 library. Since the Arduboy and Micro:Gamer have the same screen and buttons, it is very easy to port games from the Arduboy to the Micro:Gamer (I already did 6). I will maybe experiment with Python support and probably Ada as well.
The next steps for me are:
- Try audio support with the buzzer
- Some improvements to the PCB (on/off switch, button position)
- Add an API for persistent storage (highscores, player data)
- Add an API to read the accelerometer and magnetometer of the micro:bit
- Improve performance of screen data transfer
- Design a case for 3D printing
That’s it for the first project log. Let me know in the comments what you think about this project.
"Memory Card" (Non-volatile memory)
Most of the games I ported from Arduboy to the Micro:Gamer use EEPROM to save high score or game state when the console is powered off. I think this is must have feature for a game console so I implemented it for the Micro:Gamer.
There is no EEPROM on the micro:bit board and I don't want to add it as an extra component on my hardware design, so I had to use the flash memory inside the micro-controller.
The interface to use the flash as persistent storage is provided by the MicroGamerMemoryCard class. This class uses two different memory areas:
- The first one is a 1k bytes page in the flash memory, this is where the data will be stored permanently. The reason for a fixed size of 1k bytes is because flash memory have to be erased/written by pages of 1k.
- The second memory area is the temporary RAM buffer. This is where the program will read/write the data before saving it permanently in the flash page. Since there is not a lot of RAM available, the program can decide to have a temporary RAM buffer that is smaller than 1k.
Here is an example of how it looks like in the code:
// Create a memory card of one 32bit word
MicroGamerMemoryCard mem(1);
// Load the content of the flash page to the temporary RAM buffer
mem.load();
// Read a value from the temporary RAM buffer
if (mem.read(0) != 42) {
// Write a value to the temporary RAM buffer
mem.write(0, 42);
// Permanently save the RAM buffer into flash memory
mem.save();
}
And here is a demo with the game Micro City:
Playing sounds
After the persistent data storage, the next important feature for me was sound.
There is a small buzzer on the Micro:Gamer board which means it can play a single note at a time. It is enough to play little tunes and some sounds effect as shown here:
Comments