Wednesday, June 13, 2018

TMK with ChibiOS

Setting up the build environment

I usually compile my firmware in Linux. I use either Ubuntu in a virtual machine or Raspbian on a Raspberry Pi. They are both Debian based and the same procedure should work on either.

Start with a fresh install of the OS.

Then update the list of software packages.

sudo apt-get update

Update all the installed packages.

sudo apt-get upgrade

Install the required packages for compiling TMK and ChibiOS

sudo apt-get install gcc-avr avr-libc dfu-programmer git make gcc-arm-none-eabi

Clone the TMK repository

git clone

Change to the chibios folder

cd tmk_keyboard/tmk_core/tool/chibios/

Clone the stable branch of ChibiOS repo

git clone -b stable_17.6.x

Clone the ChibiOS-Contrib repo

git clone

That's it. You should be able to compile for TeensyLC, Teensy3.2, Maple Mini, etc...

This video goes through the process on Ubuntu 18.04 LTS server.

Monday, June 11, 2018

Praetorian Gherkin

Dark and silent

Red Gherkin plates and black PCB. Cherry silent black switches.
Black nylon M2 spacers. Oxide black screws.
Cheap translucent blank red ABS keycaps from eBay.
Funko Pop bobble head.

Wednesday, June 6, 2018

Dressing up cheap M2 spacers

M3 nylon spacers fit over M2 spacers

Non-threaded M3 nylon spacers have a 3.2 mm inner diameter (ID) that fits over the cheap brass M2 threaded spacers. They come in two outer diameters (OD), 5mm and 7mm. The 7mm ones are most common but are probably too large for most uses. The 5mm OD ones are perfect for hiding the skinny brass spacers.

They are sold on eBay and Aliexpress. They come in all the same lengths as the brass spacers. Amazon has some but they are in kits of mixed sizes, many too short or too long to be useful.

Since they are made of nylon they should dye very well.

These are much sturdier than regular all nylon threaded spacers, when combined with a brass spacer. You can tighten them much more as the brass spacer's threads won't easily strip.

5mm OD M3 nylon spacer next to a M2 threaded brass spacer.

M3 spacer on top of the M2 spacer. It fits well but is not snug. It will fall off if you flip the board over while assembling.

Installed and screwed in place. The raw nylon is translucent. Could dye them black or some other dark color. I have seen ones that are white nylon (more opaque) and some in black nylon.

8mm long 5mm OD spacers on a Dilly with plates.

Monday, June 4, 2018


The Golbat 40% Keyboard

I purchased this as a kit from a GB from several years ago. Blue anodized top and bottom plate with light blue clear laser cut acrylic middle pieces.

It was shipped with the case pieces assembled but the screws all worked themselves loose and scratched up everything. Several deep scratches on the top and bottom plates.

I decided to experiment with it. I sanded down the pieces and it blended in the scratches to be less noticeable. I also sanded down the two acrylic pieces so they would be flush together.

Switches are Zealios, with blue 2x3x4mm LEDs mounted inside the switches.

The keycaps are PBT Gaterons from another group buy.

The controller is a Kimera Core. It is an ATmega32U4 with two io expanders. Somewhat pointless to use this in a board with so few columns/rows. It adds complexity to the design and many people have problems figuring out how to program it.

Friday, June 1, 2018


Maple Mini powered modular 5x5 keypad

Up to 9 of the 5x5x9 boards can be connected together to create a 15x15 matrix with 225 key positions.

The board is constructed in a similar way to the 5x5 board, except it also has connections vertically, allowing for three rows of boards, three columns wide. Each individual board is 95.25mm square.

A Maple Mini clone was used as the controller. It has 34 IO pins. 2 of these pins are actually the USB port data pins. So if you want USB there are only 32 pins left. One of these pins is connected to an LED on the top of the Maple Mini, and has no physical pin to solder to. This leaves 31 actual usable pins. This is enough for the 15x15 grid. The onboard LED is used as a capslock indicator.

Maple Mini clones can be found on eBay or Aliexpress for around $4. As cheap as a Pro Micro clone. You will probably find 2 different boards being called Maple Mini, you want the one that looks like the one pictured. The other board has a similar chip but has a different pinout and less flash memory. It is often called the "Blue Pill". You do not want the Blue Pill, although it works with TMK it will not work on this board.

The chip on the Maple Mini is supported in TMK using the Chibios library. Be sure to clone a stable branch of the library. The firmware is on github. The keymap is the same as I use on my i75, repeated 3 times.

The assembled 225 key board. A PCB top plate has been used. The Gerber files are on github.

The bottom of the assembled board. The routing of the board edges is not perfect and they do not align perfectly. Getting the 9 PCBs aligned and soldered as straight as possible was very time consuming. You need a large flat workspace.

The Maple Mini clone and the BUT1 and RESET buttons on the right. The Serial programming header and the BOOT1 switch on the left. I chose these switches because they are available from and you can get free shipping when combined with a PCB order from

To boot into the serial bootloader BOOT1 has to be held low. The switch connects it to ground. In normal use the switch in the other position disconnects it from ground and that pin is used as a part of the switch matrix.

The BUT1 and RESET switches have the same function as the switches on the top of the Maple Mini. I added them to make it easier to enter the bootloader with the board mounted to a plate.

To enter the bootloader:
  1. Disconnect the Maple Mini from USB
  2. Connect a 3.3v TTL serial adapter to the serial header. It must be 3.3v and not 5v. The Maple Mini will be powered through the Serial adapter.
  3. Switch BOOT1 switch to programming position, (to the left in this picture).
  4. Press both RESET and BUT1, you can use the buttons on the Maple Mini or the ones on the board.
  5. While continuing to hold BUT1, release RESET.
  6. Release BUT1
  7. It should now be in serial bootloader. 
To program it I used the utility from STMicro. Flasher-STM32. You will need to register to download it. The program is very simple and you only need to choose the serial port of your serial adapter. The defaults for all other options are fine. The Maple Mini must be in serial bootloader mode before trying to connect. If it errors it is either the wrong serial port or the TX/RX pins are swapped when you connected to the header on the board. (If BOOT1 switch is in the wrong position it will also error. It goes into some other boot mode.)

I am not sure what USB bootloader came installed on the Maple Mini clone. To get anything to work properly I flashed the original Maple Mini Bootloader from here.

Scroll to the Setup section Step 1 and download the Maple Mini bootloader.

I flashed the bootloader and then the compiled firmware, no need to reset in between. You will have to change the file type to BIN for the bootloader and then to HEX for the compiled TMK firmware.

I was hoping to omit the USB bootloader since it takes up flash space (the serial bootloader is hard coded and permanent). But the firmware would not run without the bootloader. It should be possible, I have not spent the time to figure out what needs to be changed in the firmware code to make it work that way.

Be sure to return BOOT1 switch to the normal position before plugging in the Maple Mini USB. Otherwise you will have stuck key presses.

There are multiple ways to flash from the command line using many different methods. I have not tried any of these. The Flash-STM32 download also comes with the source code if you want to develop your own method of flashing.

This was the first version of the board. The BUT1 button was incorrectly connected, Otherwise it works fine. You can see all the solder bridges that hold the boards together and connect the matrix circuits.

The base is a simple 12x12" 5052 aluminum plate with holes drilled for the M2 spacers. It is slightly oversize as the assembled board itself is 11.25" square.

Some of the theoretically possible ways the boards can be connected together and the matrix still work. The Maple Mini has to be in the top left position in all cases.