Thursday, November 12, 2020

Raspberry Pi 400 keyboard matrix keymap

The diodeless matrix

Like most rubber dome keyboards, there are no anti-ghosting diodes. Instead, the matrix is arranged in a way that it is unlikely to be able to press any combination of keys that would cause ghosting, or blocking.

The matrix on the Raspberry Pi 400 keyboard is 8x16. 24 total io pins used. The connector is 26 wide, 2 are not used (H and J in my numbering).

This is for the ANSI layout keyboard. Someone with the ISO version will need to compare.

The order of the pins on the bottom of the PCB are not in the same order as the ribbon connector.

My original labeling using A through Z on the ribbon connector.

This matrix/keymapping has not yet been verified.

Tuesday, November 10, 2020

Raspberry Pi 400 keyboard controller


The keyboard of the Raspberry Pi 400 is connected to a dedicated MCU that uses one of the 4 ports of the built in USB hub.

D+ and D- USB data lines are circled. They go through the vias to the other side of the board and run across to the VLI USB chip. The large test pad is VBUS.

On the other side of the board the D+ and D- lines connect to the VLI chip.

On the bottom of the PCB under keyboard ribbon connector the matrix pins are broken out. If you could reprogram the Holtek controller you could connect a custom keyboard matrix. Unfortunately this is a OTP (one time programmable) device, so unless you can work with the existing matrix the Holtek is not very useful.

The easiest way to replace the keyboard would be to cut the traces between the USB hub and the Holtek chip. Then connect the D+ and D- to a separate controller.

The keyboard has a power key (Fn+F10). This functions similarly to the modification I did on the Flirc case. A custom replacement keyboard could use an io pin to trigger the power on/off the same way.

Thursday, November 5, 2020

feegle XS


A tinier Feegle. This is the same design as the Feegle but using 4.5x4.5mm tactile switches instead of 6x6mm. The only functional difference is the lack of a RESET button. There is only a USBASP button. Holding the USBASP button while plugging in the USB cable will enter bootloader mode.

Originally planned to use the same through hole PTC fuse I use on most V-USB boards, but with it overlapping the resistors. This turned out to be too thick and would require 6mm spacers. To keep to the 4mm spacer thickness I used a surface mount PTC fuse.

Uses the same blue LEDs for the V-USB circuit and miniature 16MHz crystal.

The switches are tiny. 6mm height for the keys and 5mm for the USBASP button. I used the top plate to hold the switches in place while soldering. It would be impossible to keep them all aligned without the plate holding them in place. Since the base of the switches are shorter than most of the other components I soldered them on first, so the plate could rest against the switches firmly.

Wookie for scale. 63x46.5mm. The holes in the top plate are 2.5mm for the switches. 3mm holes for the LEDs. Flat laptop style M2 screws.

With 4mm M2 spacers the total thickness is about 9mm. I found some aluminum M3 spacers on Digikey that look much better than the transparent nylon ones and fit right over the M2 brass spacer.

I sanded one the top plates to expose the copper layer.

6mm switch on the left, 4.5mm on the right. 4.5mm through hole switches are not very common. Surface mount versions are easy to find. I found these at They are available in a few different heights and in two different actuation weights (160g/250g).

The 4.5mm switch is only 3mm tall at the base. The mini USB connector and ATmega328 are both about 4mm tall so the board can't be made any thinner.

Monday, October 26, 2020

Pogo Pin Lobot

Lobot with Pogo Pins

For programming boards that don't have the ICSP header pins installed.

Same Lobot PCB as before. Pogo pins installed in the ICSP header instead of the Pro Micro footprint. Cheap Tiny AVR ISP programmer board installed.

Spring pressure makes contact with the unpopulated (no pin header installed) ICSP pads on the PCB.

The pins are delicate. I store this in an Altoids tin. More info on the pogo pins can be found in the Lobot post.

The pogo pins are soldered to the top PCB (bottom in this picture). This has to be done with the two PCBs assembled. I used a piece of kapton tape to keep the pins from falling out while soldering. Solder the back row first without the front row in place, there isn't a lot of room to work.

The pins are not soldered at all to the bottom PCB (top in this picture).


Credit card sized 60%

Using the same 3.5x6mm tactile switches as the Wee Gherkin. V-USB powered ATmega328, with blue LEDs for voltage regulation.

The ATmega328 is running at 12MHz. V-USB will run at 12, 16 and 20MHz (and a few others). The code runs most efficiently at 16 or 20MHz. There are a lot of timing adjustments running at 12MHz and the resulting code is much larger for 12MHz.

I built 2 of these. One with the switches from black switches from Digikey and another with the terrible low quality switches I bought on Amazon. I also used a 5mm blue LED on one of them, just for the hell of it.

The back of the PCB. The ICSP header is on the back, under the ATmega328. I built a pogo pin version of the Lobot to be able to connect to the ICSP pads without installing header pins.

60 percent 09.

Next to a Wee Gherkin.

Monday, October 19, 2020


Tiny 40%

A 4x12 matrix the same size as the Gherkin Express TH and using the same 6x6mm tactile switches.

The switches are rotated so that the through hole pins are staggered allowing the switches to be placed closer together.

The power and activity LEDs from the Gherkin Express TH are removed. Instead the blue LEDs for V-USB voltage regulation are used as a power indicator, and a flickering activity indicator. 

The miniature 16MHz crystal is also used as on the second version of the Gherkin Express TH.

There is only one decoupling capacitor instead of the usual 2.

The 1mm thick top PCB has legends in the copper layer.

The two blue LEDs on the corner, D- on the left and D+ to the right. D+ is always on while connected to USB. D- flickers when data is being transmitted.

The two red switches are the RESET and USBASP switches for entering the V-USB bootloader.

Everything fits with 4mm M2 spacers. Construction is the same as with the Gherkin Express TH.

Same credit card size as the Gherkin Express TH. It shares the same bottom PCB. Screw holes are in the same positions.

Thursday, October 15, 2020

Wee Gherkin

No'-as-big-as-medium-sized-Gherkin-but-bigger-than-wee-Gherkin Gherkin

Another Gherkin in a different form factor. This shares the same circuit and firmware as the Gherkin32. It is also powered by an ATmega32a. The main difference is the form factor and the use of 3.5x6mm tactile switches. It also uses blue LEDs instead of zener diodes in the V-USB circuit.

3.5x6mm tactile switches only come in 2 heights, 4.5 and 5mm. This is too short to make a usable top plate. The rectangular plunger also wobbles on the short axis more than the long axis. These black switch are from Digikey. There were very few options, and only black available.

These were cheap switches bought from a third party seller on Amazon. They are horrible. About a quarter of them do not click. They do work, just no click when pressed. Most sellers refer to these at 3x6mm but they are really 3.5x6mm.

Wednesday, October 7, 2020

Gherkin Express 3

Third SMT assembly order from JLCPCB

This version uses the same circuit as the Gherkin Express 2, but with blue LEDs instead of the zener diodes. It also uses the PCB as a USB A connector.

All parts used were available in the JLCPCB inventory. Only the fuse and the tactile switches had the setup surcharge.

The board will plug directly into a USB A port, or an extension cable. The 1.6mm PCB is on the thin side. Ideally it should be 2.2mm thick to fit properly. JLCPCB has 2mm PCB as an option, but not with assembly. I'm considering haveing a 0.6mm thick blank PCB with the same outline made and laminate the two PCBs together.

Monday, October 5, 2020

Copper legends

Sanded the soldermask off to expose the copper

I used 220 wet/dry sandpaper to carefully sand the soldermask off the copper. I also used a Scotchbrite pad to dull the surface of the remaining soldermask.

The copper is starting to oxidize and turn darker. I could spray some clear acrylic to seal it.

I also sanded the bottom of the PCB. This looks neat, but is probably a bad idea. The soldermask not only protects where solder can be applied, it is an electrical insulator. They make conformal coatings specifically designed to protect PCBs, but they have highly flammable solvents and I can't find any locally. Shipping for a small bottle is very expensive. If you are using leaded solder this is a very bad idea, creating lead dust.

Friday, October 2, 2020

Gherkin Express TH 2

Second version of the through hole Gherkin Express

Main changes from the original Gherkin Express TH are the miniature 16MHz crystal and the mini USB connector is moved inwards to be flush with the edge of the PCB. The zener diode footprint is overlapped with one for a blue LED.

The switch positions and LED cut outs are the same as the first version.

I made a new top piece with the legend in the top copper layer instead of the silkscreen layer. The resolution of the copper layer is much higher than the silkscreen. Green, blue, red and yellow soldermask is translucent and the legends can be read through them.

M2 spacers with M3 unthreaded spacers. With the shorter crystal and a smaller 3mm diameter power capacitor laid down on it's side, everything fits with 4mm spacers.

The two zener diodes were replaced with rectangular 2x3x4 (4mm tall) blue LEDs. The power capacitor on this one is a 4mm diameter solid polymer capacitor.

Blue PCB top piece. This one is 1mm thick, the green one was 0.8mm thick. It is a bit stiffer but does not make that much of a difference.

4mm spacers and a 1mm thick nylon washer between the bottom PCB. The top screws are 3mm and the bottom 6mm.