Project A, how it started

A project log for raspberry pi zero handheld computer

Since rpi zero is unobtainum, I got a few.

jaromir.sukubajaromir.sukuba 03/24/2017 at 18:020 Comments


I decided to make two different portable computers with raspberry pi zero: one would have low-end user interface, perhaps low price and dimensions; another one with bigger display and keyboard, somehow resembling smaller laptop PC.

Project A is the smaller one. A lot of work has been done, but I couldn't find time to write logs here, so this is somehow retrospective description of how I did the design process. I also included some photos of prototype, to attract you to future logs ;-)

Project A, motivation

The project has to fit those constraints:

- raspberry pi zero as main processing unit

- at least 320x240 pixels LCD

- some form of keyboard and

- some form of pointing device to allow handheld use

- at least one USB 2.0 interface, with A type connector

- on/off switchable via single button, negligible current draw when off

- no touchscreens

- easy to source components

The last one is more difficult than it may look. Internet is not short of various displays and especially keyboard connected to all forms of whatever-pi class computers, but those are often gutted Chinese consumer items, like Xbox chatpad containing and PIC device back in the day, but nothing but asphalt blob on newer ones. While the difference is next to none for average consumer, it can be dealbreaker for open-source project, prepared for others folks to reproduce and build upon. So I want to build the thing using basic and obtainable components, available from multiple sources.


The main limiting factors for overall dimensions of the device is the size of user IO - display, keyboard, pointing device, so I have to choose those ones first.

For display I experimented with PAL/NTSC displays from Chinese sources, designed for parking camera in your car. While perhaps usable for its intended purpose, it doesn't fit very much the "availability point" above and the picture quality leaves a lot to be desired, not to mention the fact the analog/digital interface takes a lot of current, what is a problem for portable battery powered gadget. The only real option here is digital interface. Another usual suspect is HDMI, but the connector is bulky, interface takes a lot of valuable juice too and brings price higher. Those two options don't require any configuration nor programming, so being more hardware than software oriented guy, I have to resort for "more complicated" methods (though being quite easy, in fact). I took inspiration from #Portable Raspberry PI Zero and bought some ILI9341 TFTs.

I ended up having three different sizes - 2,2", 2,4" and 2,8", all being electrically the same. The 2,2" is most common and cheapest of the three. The former ones are somehow more expensive, but the size of display is IMHO good fit for this project, especially in 2,8" variant. I debugged the interface on Raspberry pi 3, easy to use for it's populated 0,1" header and Ethernet interface for headless access.

Keyboard is problem as usual. Calling @davedarko as reference for second time, I'm not the only one having this problem. See me reply in here for some more background info. Long story short, I decided to use the same keyboard as on my #Pavapro - portable AVR programmer project. It is available locally and through Asian suppliers and seems to be more-less jellybean part.

For pointing device, I opted for joystick, moving mouse cursor in similar way as pointing stick on some notebook computers. After a long search, I decided to use joystick designed to be replacement part of PSP1000 and others. While it is exception to the "availability rule", it is available in huge amounts from a lot of sources, including local ones, so - while not being particularly happy about it - I had to accept it as solution. It's dimensions and electric interface are well defined, so future replacements will be good fit too.

Having, the main parts identified, I had to arrange it somehow. I thought of three different variants:

1, Display on top, keyboard left and joystick right

2, Landscape version, keyboard on left, display top right, joystick bottom right

And third option (you can guess it's the winning one), display, joystick and keyboard from top to bottom

I printed all three mock-ups on paper and tried to how it's going to fit in my hand. Not surprising, the classic design, somehow resembling old calculator or phone, is probably giving the best ergonomics from all of those.

Brief summary of smaller details

Here I was at position to solve smaller details. Those details are suited for separate log, though - so take this as a brief summary of what I did.

I wanted to connect the keyboard in "simple" way, with no special device drivers for raspberry pi, USB seemed like logical choice - so i had to implement an USB HID device. The 12-key layout (actually 16-key, but 4 of them used as modifier keys) makes it a bit harder, as normal keyboards usually have one key per character, but it's nothing unmanageable. I did the same for pavapro. Somehow more complicated was to make "two-headed" HID device, allowing both keyboard and mouse action via single USB device, realized in STM32F072C8 device.

For WiFi, I opted for RTL8188EUS module, available at usual Asian sources. It is also common in many tablets or small computers on market, it has even similar module in the same package (88W8782) so I qualified it as jelly-bean part.

In order to have somehow useful computer, one USB port is not enough, especially when consumed by on-board WiFi module and keyboard interface. So I added USB hub with four downstream ports, with FE1.1s chip. This one seems to be popular in "diy-handheld-console" guys too.

For all this, I need some kind of power. I opted for powering from two Li-Po cells in series, with three step-down switched TPS562200 regulators - 5V for Raspberry pi, 5V for USB and 3,3V for WiFi module. All those voltages are switched on or off via another MCU, STM32F030F4, capable of communicating with Raspberry pi, so it can turn itself off, if needed. The MCU can also monitor battery voltage and battery charging.


I took a few hours at Eagle and designed the PCB.

This is bottom side, top side being mostly groundplane. I ordered it and...

..magic happened, PCBs were at my hands.

It didn't took me long to populate the board and correct some minor fuck-ups

and to get it running

The codebase for both MCUs is still far from being complete, but I'm working on it. Stay tuned.