I’ve always liked handheld computing devices that had a full qwerty keyboard with them, rather than some stubby phone keys. It was a real dream – to have at your disposal some kind of PDA or at least a mobile phone with qwerty. Years passed and the industry moved to touch screens, easy-to-manufacture devices flooded the counters. Now it is not fashionable and expensive to make physical keyboards. At some point, I came across another hack from the Chinese based on ESP32 and with a small snapping keyboard. It was marketed as a MicroPython board, teach, program, nice, well done. And then it clicked in my head – I can do such a thing myself! The idea went further and why do I need an ESP32? I’ll take the SBC right away, there will be a full-fledged PC. I liked the “old Tetris” form factor and it was decided to stop at it. It is convenient to hold with both hands and use while standing – just on the road! So, there is a thought to make your own device, now let’s move on to implementation. Careful, there are a lot of pictures inside.
Display and single board computer
There are a huge number of single board computers on sale, but most of them have just terrible manufacturer support and only the community can be relied on for some specific issues. Therefore, my choice settled on the Raspberry Pi as one of the leaders in low-cost single board.
The fourth raspberry has two microHDMI ports and one DSI (Display Serial Interface) port. I was very attracted by the opportunity to connect the display via DSI and I went to search the marketplaces. To my delight, I found a 5-inch touchscreen display from WaveShare. The beauty is that the signal part and the power supply go through the same cable, there are mounts for the Raspberry Pi on the back of the display, and everything works out of the box.
Printed circuit board
I have decided on the display and therefore we need to proceed to the printed circuit board. It is logical that it should be made about the same size as the display. I took the usual clock buttons, 6x6x5 mm, with the anticipation of making caps on them in the future.
I planted the board in KiCAD, two-layer printing without any frills. The main dilemma was the following: to make a hard-ware definition of the pressed button using diodes or to make a soft-on button detection using the controller logic. There were two versions of the board with just these two options.
The first version also contained a pair of clock joysticks, which I planned to use as a manipulator for the pointer. However, the board turned out to be very laborious to install and wide enough due to the fact that at first I decided to implement a num-block of digits. After collecting the test sample, it became clear that this was no good. I simply could not grip the board with both hands so that it was convenient to type with two thumbs.
In the second version, I took into account the shortcomings and decided to abandon the clock joysticks. Replaced them with one PSP joystick. I also reduced the number of buttons on the future keyboard, which made it possible to reduce its size. I also gave up diodes, a real horror with manual soldering.
In the process of assembling the components, I tore off the contacts for the joystick, I was too lazy to unsolder the second board.
The choice fell on STM32G071CBT6, because it was available at that time. According to my estimates, the number of legs should have been at least 40, so I chose a controller with 48 legs.
The I2C bus seemed like a good choice for connecting the raspberry and my keyboard. On the Internet I came across the HID over I2C standard from Microsoft. It turned out that the driver of this standard is already implemented in the Linux kernel and it is quite easy to configure the operation of this driver in the original RaspberrypiOS image.
To control the controller, I took FreeRTOS – a popular solution for microcontrollers, simple enough to use and embed in projects. Drivers from ST for the controller, the configuration was done in CubeMX. The code is in the repo, all links will be below.
To power this entire structure, it is convenient to use batteries that can be changed during use. The 18650 battery has proven to be an ideal candidate. At first I wanted to make a module for converting to 5 volts myself, but on alik I found a ready-made board for 4 18650 batteries, capable of producing 5V 3A. Actually, I decided to use it.
With the purchase of a 3D printer, the issue with the case was resolved instantly! Designed in FreeCAD, PET-G plastic printing. I really like the red color, respectively, I took the plastic in red. Looks great! Black is also okay, but not as impressive as red.
There were two versions of the case. The first one weighed almost 800 grams, the second was reduced to 657 grams. The dimensions of the current case are 179 x 133 x 36 mm.
Several pieces of photographs
Links to repositories: