Tiniest Game Boy Hides in Your Pocket


This is likely the world’s smallest fully-functional Game Boy Color, able to play all of the games using the tiny direction pad and buttons, with onboard display and battery and in the original form factor. This is an incredible hack which presents a tour de force in hardware and software. This will easily rank in the top five hacks you’ve seen this year.

keychain-redactedI’m sure that many of you have fond memories of your first handheld games. This will be Game Boy for most, and we admit they had fairly decent portability and battery life that puts many smart phones to shame. Despite this, Sprite_TM always dreamed of an eminently more portable version and to his adolescent delight he discovered a key chain version of the Game Boy. Unfortunately, he was duped. The keychain looked like a Game Boy but only functioned as a clock.

But now, decades later, technology has progressed as have his own skills. For his talk at the 2016 Hackaday SuperConference, Sprite_TM actually built his childhood dream.

Hardware:

Sprite started his hardware design by spec’ing out the display. The original Game Boy had a rather poor screen that could manage 160×144 with about 4 levels of grayscale. The new screen needed to encompass this but with as small a physical size as possible.

The first screen he found was a tiny 800×600 color OLED screen: an amazing piece of hardware with a ridiculous price of $720. The better bet was a color OLED just under 1″ in size for $3.80 — it didn’t have quite enough resolution at 96×64, but Sprite tested it and found it would be a passable image. Rounding out the hardware choices he went with a speaker less than 1 cm in diameter, an ESP-32 chip (in the form of an ESP-WROOM-32 module), and a 150 mAh lithium-ion battery.

The size of the screen decided all of the dimensions for the body of the Game Boy. Sprite pulled a measured image of the screen into Inkscape and started playing with images of the original hardware to arrive at his final size. He had some challenges laying out the board since it needed a slot for the OLED flex cable to pass through. He modeled the PCB in OpenSCAD and built up the case design around it. This was his first time using a 3D printer and his case (printed on a Form 1+) really did come out looking great!

Software:

Software is a challenge in this case. Sprite wanted to start with an emulator, but emulators are written for a full computer system. The ESP32 is a beefy chip (dual-core 240 MHz, 512k RAM, a laundry-list of peripherals, WiFi and Bluetooth) but it is still not a full computer. He decided to look at older emulators that are optimized to run on very old computer equipment. After a survey of the many options he settled on GNUboy which has optimizations that make it runnable on a 486 computer.

tc4-croppedThat was a good start, but he had a long way to go to ensure this was possible. Most notably, the “tile cache” that GNUboy uses to maintain the “sprites” — 8×8 graphic chunks that make up every game. This is well-explained at about 18:34 into the video. GNUboy allocates about 128 kB of RAM (more than 1/4 of what is available) for the tile cache. Sprite was able to reduce this need to about 46 kB.

Once the emulator was running, Sprite added in some nice user features. There is an on-screen display that allows the user to adjust brightness, volume, and to load or reset the ROM. Since there isn’t mass storage on the board the tiny Game Boy can only store a few ROMs at once. Sprite leveraged the WiFi capability of the chip to get around this. When you want to load a new game it broadcasts an Access Point and runs a webserver that allows any phone or computer to upload a new game.

Things That Didn’t Go Well at First

There are always issues when building an epic piece of bespoke hardware like this one. Lucky for us, Sprite is more than happy to share his tripping points and he’s very entertaining while doing so.

speakerhotAudio was a sticking point, and one of the most technically interesting parts of the talk. He noticed that the speaker was getting hotter than it should have… it was about 90 degrees Celsius. He’s driving it with an H-bridge motor driver chip (BD6211) which is not all that unorthodox. It just seemed like that chip never stopped driving the speaker.

To solve the problem he started looking into filtering techniques and uncovered two designs referred to as AD modulation and BD modulation. Turns out that BD modulation uses positive and negative voltage driving on either side of 0V as the center line. This was the solution to the heat problem but provided another challenge: how to generate the negative voltage from the microcontroller? His initial audio technique used the I2S peripheral but that outputs just a single pin. He moved to using the RMT peripheral which has two pins, using this to toggle a negative voltage circuit. This solution is very clever and Sprite suggests looking into the RMT peripheral for other hacks (here’s one that drives WS2812 LEDs).

wroomkill2We’ve heard people complain about microcontrollers that use external flash memory. This is actually a pretty nice feature sometimes. For instance, Sprite wanted more program memory and the ESP32 supports that, but the WROOM module has a metal box soldered on the board shielding all of the circuitry. He figured a hot air reflow station would take care of that. It did, it also took care of desoldering the rest of the on-board components as well. Another try with a new module and he was able to top out with the largest flash chip possible.

It Lives — And It’s More Than a Game Boy

The proof is always in the pudding. The demonstration of the tiny Game Boy was delightful. And if you talked to Sprite at all during the weekend, he probably offered to let you try it out. This works as well as the original Game Boy. Despite the missing pixels the screen looks fantastic! The user controls feel normal and the sound is respectable, although a bit of delay is present and he has a fix for that on his todo list.

tiny-game-boy-doomThe kitsch benchmark for hacked gaming systems has long been DOOM and this fact wasn’t lost on Sprite. He demonstrated DOOM running well, but with very poor framerate — that still counts as a win in our books. He also showed off his key-chain-sized handheld playing Witcher 3. Something doesn’t smell right, right? Of course the microcontoller can’t handle a current-generation game, but it can handle VNC forwarding like a charm. A very cool trick, and if the Game Boy emulation didn’t fully drive home how far our miniturized technology has come, this demo should finish the job.

Sprite will release code under GPL once he has it cleaned up. He is planning the same with the PCB and case design files. If you want one of these, and love to do a little fabrication of your own, it can be yours. Watch SpritesMods.com for that code release and more info on the build itself.

Want more of Sprite_TM right now? His talk from last year’s SuperCon, the Tamagotchi Singularity, is an epic presentation and hardware hack in itself. Enjoy!



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *