My Linux handheld game console. Part 1
10 October 2016
A custom made Linux powered handheld. This sounds interesting, don’t you think ?
I had this project from quite some time: I have some hardware that is collecting dust, and I want to make use of it, I just recently had the idea to blog about it, and release everything on GitHub afterwards, when it will be actually something useful.
Also, this thing will need a name… But that’s not important right now ^^”
I’m a fan of the Ben Heck Show from quite some time. In multiple episodes of the show, Ben makes portables consoles from scratch as electronic projects. With the existences of small single-board computers like the Raspberry Pi, this is actually surprisingly easy to build.
Also, a few years ago, I was looking with interest to the OpenPendora game console. They look cool, but they are expensive, and I don’t need a full keyboard on a machine like that… 😛
I think the idea of having a Linux Powered emulation machine is really cool. And since I have a 3D printer, and some 3D modeling skills. I decided to try to design a gameboy shaped device that include a Raspberry Pi, a D-pad, 6 action button (probably 4 in the face and 2 bumpers) and a start/selects.
I’m not sure yet of the physical design. a “clamshell” one will probably result on something too thick. I think I’m going on a “GameBoy Advance” route, but bigger and with more buttons. I really like the shape of it.
For sure, the shell will be 3D printed in PLA plastic, as the buttons will be. The idea is to have something comfortable, easy to re-open and hack into while having the components as densely packed as possible.
I have a Raspberry Pi (Model B 2011/12 Made in UK, the ones with 512 MB of ram) on hand that is in a pretty bad shape. The SD card reader has broken plastic that doesn’t permit good contact with the memory card, and the micro USB and input filtering cap aren’t on the motherboard anymore.
Theses things aren’t problematic: The USB plug would take un-necessary space and be bypassed bypassed. for the SD card reader it’s just a matter of soldering a new one (or just a bunch of wires, we’ll see if I want to relocate it)
I also have on hand an old USB WI-FI adapter, and an Arduino Nano clone (the 3$ ones you find on eBay). This older Arduino Nano uses a ASIC as USB->Serial interface to be programed and communicate. This means it cannot directly emulate an USB HID device, nor it can emulate a keyboard, but it doesn’t mean that it cannot be used as such. It will just require a bit more software running on the Pi 😉
The built-in GPIO ports of the Raspberry Pi has only 8 actually useful digital pins. the Arduino as at least 13 of them if you count the RX/TX Serial pins, and a number of Analog ones that can probably be used as digital if I want. This mean that I can sample the state of a bunch of buttons and send debounced press/release events via serial to the Raspberry Pi. Writing a daemon that listen on a serial device, and send key press events to the system shouldn’t be a problem (I bet this probably already exist) And it can be powered via the USB port. So it’s probably what will be the interface between the computer and the custom inputs.
I basically just need a bunch of buttons :
- 6 (4+2) actions buttons
- 4 (directional pad)
- 2 (start&select for console, coin/credit&start for arcade machines)
Every digital input has internal pull ups. So by shorting the pin to ground, you can register a LOW state
This makes for 12 digital inputs. I have a bunch of analog inputs to play with to. It would be easy to imagine having it sample the voltage level of a battery…
Speaking of battery…
I plan on using a Li-Po battery, with an off the shelf charging IC. I need an external recharge jack to put power on it, and a small power supply. The Raspberry Pi and the Arduino take 5V. A Li-Po cell doesn’t provide 5 volt. In function of the wanted battery life and space requirement. This is for now the least of my issues. The Raspberry Pi and Arduino combined will use a few hundreds of mA, I can imagine that stuff running for a really long time easily.
I need to choose. I think I’m going to use a car camera composite screen. But I’m worrying about the quality (composte analog video? meh). I may choose a small HDMI screen, but then I only seen ones that are way to big (7″? I wanted smaller…)
I’m not sure about what Linux distribution I will run. I want to use ArchLinux, but I had bad luck actually getting a correct driver for X for it. Also, there is multiple “game” stuff for the Rasbperry Pi. I’m thinking about RetroPie. The problem is that I may need to actually write a “serial->keyboard” driver, or at least configure strange stuff, so I can’t take an emulator distribution “out of the box” and make use of it.
Also, I think I’ll have some fun writing a small launcher for games in on it.
That’s it for now. I’ll have to chose what kind of screen I want to use. And to order from the web a SD card reader that I can solder on it, a few USB cable that I can sacrifice to the cause, an SD card, some prototype-board PCB and a dozen of tactile switches!