Initially, the only available firmware was Keyberon, a pure rust firmware. Then came a pure Ada firmware Click.
The (initial) goals were:
- build a custom keyboard from scratch
- continue to learn embedded rust
- have fun
Then came the extra:
- learn embedded Ada
- learn the lower level of a keyboard firmware (USB, HID)
- ortholinear
- 60 keys, using Cherry MX switches, only 1U keycaps;
- 4 RGB LEDs for status;
- 6 RGB LEDs for backlight;
- USB-C connector;
- 1 STM32F072 MCU, with hardware USB DFU bootloader;
- Only onboard SMD component (except for the switches).
- ESD protection
- Keyseebee for being the «I will change it quickly and have something ready in an hour» base project (even if I ended up redoing most of the hardware design). It was really nice to have a solid base to learn and bootstrap the project.
- Typematrix 2030: I own 2 of them and really love them. But both are getting old and some keys are not working correctly (this motivated the keyboard change).
- Steamvan for some KiCad design ideas;
- Preonic as a model: ortholinear, good balance between size/usability, simple.
- Mechanical Keyboard is a list of DIY keyboards
- Awesome Mechanical Keyboard is another «awesome» list
- Masterzen and many others for writing online tutorials for newbies like me.
Disclaimer: I'm a software developper, this is my first real PCB design and my first try at SMD soldering: do not take anything here for granted :)
The project started as a quick-hack of Keyseebee to make it simpler but ended up as a near full redesign. As every DIY project, the goal was to be quick and simple (spoiler: it was neither).
Half of the parts have been soldered with a soldering iron (TS80P), the other
half with hot air station. Clearly, with my [un]existing soldering skills, the
hot air is a huge win. But I think I would have simply spent more time by only
using the iron. Even the small sod-323 diodes without the _handsoldering
pads
(mistake) were not a real problem (tricky, but even I could do it). For
reference, I have soldered all SMD components for the second board under 2 hours
with hot air.
The trickiest part is the USB connector if you don't have a hot air station: the plastic casing melts with the solder.
- The LEDs are mostly optional, and the 6 used for the backlight are nearly useless. I did not really study how to insert LEDs for a nice backlight and the result is not really satisfactory.
- I'll hopefully find time to use plexiglass plate to put below the PCB and above the visible part. I've added holes for this but never really planed anything really. If you really want something nice here, you may check this before.
As a typematrix user, I really like the middle column with backspace/enter/del
so naturaly I've tried to do something similar. The initial
layout has only the %
and w
key at different locations:
You can also see how the LEDs are currently used. It's mostly useless/for fun. They may be used someday to measure typing speed or do something else, but in the meantime, they blink like this:
Item | Package | Qty | Remarks | Price |
---|---|---|---|---|
PCB | 1 | aisler (by 3 mini) | 28.80€ | |
100 nF | 0805 | 5 | aisler* | 0€ |
PRTR5V0U2X,215 | sot-143 | 1 | aisler* | 0.43€ |
4.7 uF | 0805 | 2 | aisler* | 0€ |
470 Ohm | 0805 | 1 | aisler* | 0€ |
TLV70233DBVR | sot-23 | 1 | aisler* | 0.37€ |
74LVC1G34GW,125 | 1 | aisler* | 0.28€ | |
0805L050WR (500mA Polyfuse) | 0805 | 1 | aisler* | 1.91€ |
RS282G05A3SMRT (micro switch) | 2 | aisler* | 1.26€ | |
100nF | 0805 | 2 | aisler* | 0€ |
5.1 kOhm | 0805 | 3 | aisler* | 0€ |
0805L050WR (500mA Polyfuse) | 0805 | 1 | aisler* | 0€ |
1N4148WS-7-F | sod-323 | 60 | rs-online (by 200) | 3.24€ |
WS2812B | 10 | 1€ | ||
USB TypeC HRO Receptacle | 1 | by 10 mini | 0.25€ | |
Gateron Switch 5-pin | 60 | by 65 | 15.24€ | |
Blank DSA Keycaps | 60 | by 200 | 15.6€ | |
STM32F072CBT6 | LQFP48 | 1 | 2.87€ |
The total for 3 keyboard is 71.25€. Beware that some parts can't be ordered for the exact amount and you need to buy more (in particular, aisler won't do anything under 3 units, so you need to spend at least ~90€ for 3 PCBs).
*: Bought using magic match from Aisler. Some components are then «free» (resistor, capacitor) and some are not.
Install the complete toolchain and utils:
curl https://sh.rustup.rs -sSf | sh
rustup target add thumbv6m-none-eabi
rustup component add llvm-tools-preview
cargo install cargo-binutils
sudo apt-get install dfu-util
Compile:
cd firmware/rust
cargo build --release
Do not omit the --release
as the debug code will not fit in the memory (the
linker will raise an error).
If you need the firmware binary image (e.g. for flashing using DFU):
cd firmware/rust
cargo objcopy --bin pouetpouet --release -- -O binary pouetpouet.bin
cd firmware/ada
alr build --release
Do not omit the --release
as the debug code will (currently) not work.
If you need the firmware binary image (e.g. for flashing using DFU):
cd firmware/rust
arm-eabi-objcopy bin/pouetpouet -O binary pouetpouet.bin
To flash using dfu-util, first put the board in dfu mode by pressing BOOT, pressing and releasing RESET and releasing BOOT. Then:
dfu-util -d 0483:df11 -a 0 -s 0x08000000:leave -D pouetpouet.bin
The fist time, if the write fail, your flash might be protected. To unprotect:
dfu-util -d 0483:df11 -a 0 -s 0x08000000:force:unprotect -D pouetpouet.bin
probe-rs is a "modern, embedded debugging toolkit". It comes with a command line tool that allows easy flashing and debugging.
probe-rs-cli download --chip STM32F072CBT bin/pouetpouet
Start the gdb server and reset the chip:
probe-rs-cli gdb --chip STM32F072CBT --reset-halt
or start the gdb server to an already executing program:
probe-rs-cli gdb --chip STM32F072CBT
Then connect with gdb:
gdb-multiarch -ex 'tar rem :1337' -ex 'set mem inaccessible-by-default off'
I greatly encourage the use of PyCortexMDebug as it allows for an easier access to peripheral registers.