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

HOLTEK HT45R0072

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

SSL

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 lcsc.com. 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).


60%09

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

feegle

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.


Wednesday, September 30, 2020

Yin and Yang

Two very different Gherkins

Two different Gherkin PCBs, one built for the Seeedstudio Xiao and the other for the ATmega32A using V-USB.

Both have the same shape and mounting hole positions as the regular Gherkin PCB. The Gherkin32 has a Mini USB connector sticking out where the Pro Micro would have been.

The GherkinX has a 5x6 diode matrix like the original Gherkin. It uses all 11 available pins on the Xiao.

The Gherkin32 has no matrix diodes. Each individual switch is connected to it's own pin on the  ATmega32A. 30 pins for the switches and the remaining 2 for the V-USB connection.

Possible to fit everything with 6mm spacers. Low profile Peel-A-Way sockets.



Monday, September 28, 2020

ATmega324PA

Cheap ATmega32A alternative at Digikey

The ATmega324PA-PN is the industrial temperature rated version which usually cost more. It is a non-stock item at Digikey and they seem to be trying to get rid of them. At $2.04 each they are much cheaper than the ATmega32A. It is a newer (though still fairly old) generation chip than the ATmega32A. It shares the same pinout. It can also run at up to 20MHz while the ATmega32A runs at 16MHz. 

It is not a drop in replacement. A compiled hex file for the ATmega32 will not run on the ATmega324PA. It will need to be recompiled with the ATmega324PA as the target.

The only modifications I had to make to the 108 code was to change the MCU from atmega32a to atmega324pa and comment out the line that defines the timer register on the ATmega32.

I also compiled a version of the USBaspLoader for the ATmega324PA, same as for the ATmega32, just changing the MCU. The fuses are the same as for the ATmega164.



Wednesday, September 23, 2020

nobbs

16 rotary encoders on a Teensy LC

Using the Arduino CommonBusEncoders library it is possible to connect multiple encoders in a keyboard like matrix.

There is a single common data pin for the Encoder A and Encoder B signals. If there is a switch built in then one pin of the switch is also connect to a single bus data pin. The ground pin of each encoder is connected to it's own data pin. The tutorial PDF explains the topology.

16 encoders and 10 APA106 LEDs connected to a Teensy LC. 

There is a second pin 17 on the Teensy LC that has a level converter for the 5v output that the APA106 requires. The rest of the pins run at 3.3v logic. I have a tiny solder bridge jumper that connects either the regular 3.3v pin 17 or the level converted pin 17 to the APA106. When connected to the 3.3v output pin the LEDs flickered randomly. On the Seeeduino Xiao the 3.3v output works fine driving the APA106 without level conversion.

16 encoders with 3 diodes each to prevent ghosting.

I made a simple plate to hold everything in place. Much sturdier than without.

The encoders are spaced the same as MX switches. Small tapered knobs work best.

Side view. M2 spacers and screws holding a second PCB as the base.

A second built with different encoders. These have the split spline shaft instead of the D shaped shaft. The purple Teensy LC is from OSH Park.


Monday, September 21, 2020

Gherkin Express 2 with blue LEDs

Swapped the zener diodes for blue LEDs

0805 LEDs fit the SOD123 footprint. Installed blue LEDs in reverse polarity and it works.

D+ is always on, D- only when there is data being transmitted.

The 4 Gherkin Express 2 that have been completed so far. I have one PCB left.