D1M1x Keyboard — Building first prototype

Marek Piechut
Real Life Programming
8 min readAug 13, 2021

--

I’ve just finished build of a first prototype of an ortho-linear mechanical keyboard — D1M1x. It was not an easy route and I’ve found a few issues in the design in the meantime. In this post I’ll be sharing how I was building it, what went totally south and how it finally ended.

Just get it done by the PCB factory

My original idea was to get all assembly done by the PCB factory. I was ordering them from JLCPCB. I’ve heard a lot good about them, their prices are very good and ordering process is simply great — you upload all the files and can see what the final result will be, how much will it cost and if all parts are in correct spots. It really boosts up confidence that what you have in CAD is what you’ll get from the factory. Unfortunately, it wasn’t possible.

First issue was that they didn’t have per-key LEDs that I’ve originally designed — SK6812 MINI-e. They are not even listed in their catalog. Fortunately, after 15 minutes of searching I’ve found a good candidate for replacement — Tonyu DY-S1515065. To be honest, they even looked like a better idea — smaller, lower energy consumption and the same communication protocol (it took me quite some time browsing through Chinese datasheet to confirm all that though 🤪). The only problem was that their footprint (PCB connector layout) was totally different. I had to create a new footprint in KiCad, replace it in the PCB design and fix the routing. We have 67 LEDs, so it was not that fast.

After the change I have prepared all files for assembly and was ready to order. Unfortunately I was also not smart enough to carefully read the capabilities section of the docs. Changing the LEDs made our board 2 side assembly, and it was not supported by JLCPCB (they plan to add it some time this year, but its not there yet). So, I could get 1 side assembly with LEDs they don’t have, or 2 side assembly that they don’t do, but with LEDs they have in stock. Either way, I’m screwed.

I’ve decided to keep the new LEDs and just solder them on my own. It would be enough to just use a lower temperature soldering paste and a home made reflow owen. JLCPCB would give me fully working prototype without LEDs that I can test and just add them on one or two boards. I’ve modified the assembly files (removing assembly for all the LEDs) and was ready to go. And then…

Chip shortage hit №1

During 2 days when I was changing the design and learning how to prepare everything for the automated assembly, the already short stock of ATMega32u4-MU chip on JLCPCB has depleted (they are back after more than a month… with 2x the price and still with a very low stock). This was the first time that chip shortage has hit me. I’ve had to rethink my approach. If they would not solder the chip and LEDs it made no sense to pay for them to just do few resistors and an USB socket. MCU with VQFN-44 package was the hardest part to solder anyway. Rest could be done by just adding in a soldering iron and some back pain into the mix. Screw it, I’m ordering just PCBs and will do everything on my own.

Chip shortage hit №2

Getting all the other parts was quite easy. I’ve reverted LEDs routing, so all the soldering was on just on one side. Changed all resistors and capacitors to 0603 package, so it would be a bit easier to solder. And ordered parts from large electronics supplier. Everything except of the main chip. It simply was nowhere to be found. The only place I could find it was Ali Express. And even there prices went up. So it was the worst of all — expensive parts and a long wait for the package. But there was no other option, so I’ve placed an order for 5 chips and waited.

After 2 or 3 days I’ve received a message from seller — they don’t have the chip in stock and asked me if I could cancel my order. Damn, I had to find another seller. The only one I’ve found had it for almost 2x the price. It was $6 per piece. For a part that was only $2 just few months ago. You could get a fully assembled ProMicro controller with exactly the same chip on it cheaper than that. Nevertheless I’ve placed an order and waited. (What’s interesting is that the original seller has finally posted the package in few more days. The same time asking me again to cancel the order. I’m still waiting for it. I wonder what will be inside the box…).

First assembly

PCBs and all other parts have arrived in 2 weeks. I’ve already either had or purchased all the tools. It took more than a month for chips to arrive. Few seconds later I’ve unpacked them, and… it’s not the right model! What I got was an ATMega32u4RC-MU not ATMega32u4-MU. I’ve consulted the datasheet. What’s the difference between the two? It appears, that the RC version has a calibrated, built-in oscillator, so you could use it without external one. Except from that it seemed to be the same chip 😮‍💨. The next day I was ready to build the keyboard.

Board ready for assembly

Assembly was not that bad. It was not very easy either, but in the end my hot air station was enough to solder the MCU and all the parts in place. When it was ready, I’ve found some USB-C cable, connected it to my laptop, and…

It was a total brick

The MU series chips come without bootloader baked in, so you cannot program them via USB. This was something I was aware of, so I’ve designed a programmer pins on the board and built a simple programmer from old Arduino UNO lying around. Also hacked a simple no solder connector I could use without soldering anything on the PCB. Just a 6 pin pogo connector and few cables. My own cheap version of Tag-Connect.

Cheap in system programmer connector

Flashed UNO with a Arduino ISP firmware, connected the cables and tried to flash one of available bootloaders using avrdude. Nothing. Detected chip ID was 0x0000000. It looked like there was nothing connected to the programer. Maybe something was wrong with my UNO? I’ve also had someProMicros for prototyping lying around. Tested with one of them. Nothing. Tried to flash bootloader on one of ProMicros — worked fine. So something has to be wrong with my board.

I’ve got back to the workbench and started to check everything using a microscope. Soldering looked good. Checked with multimeter if all programmer connections were correct — yup they were right. Right pin was connected to right MCU pin. Connected the board to USB and tested if voltage is on all required pins. Everything seemed just fine.

I’ve spent 2 days trying to find the cause. No luck, everything seemed fine, yet the board was dead. It had power, but chip was not working. It had to be one of three - my soldering skills are shit and I should’t be even trying, MCU from Ali Express is junk or oscillator is dead. And I had no equipment to test any of these. Ok, I’ll sacrifice the ProMicro and swap chips. We’ll see what’s broken.

After 15 minutes I’ve had my keyboard with MCU from the working ProMicro. Quick test, and I can flash bootloader. 15 more minutes — ProMicro with chip from Ali Express. Dead. No sign of life. I was able to swap chips more than 4 times and one from ProMicro always worked and one from Ali was always dead. So maybe my soldering is not all that bad and its not the problem. It seemed it should be good enough. Also oscillator has to be good if the other chip worked.

✅ First takeaway: Source your components from well known suppliers. Wasting 2 days searching for source of problems will be more expensive than paying a bit more for a chip. (Of course if you can get it from any of well known suppliers).

So now I had a working bootloader, but…

USB connection was not working

Without USB there was not easy way to flash firmware or use the actual keyboard. I knew that MCU was fine and checked that current from USB was flowing. I had to somehow check if routing for USB was correct or was it problem with socket itself. USB-C is a bit more complicated than good old USB 2.0. It can not only work as master and slave on both sides, has much faster transfer rates, but also be a 2 way charger with configurable voltage up to 20V and the socket is reversible. For keyboards you’re using USB 2.0 compatibility mode, so most of this stuff is not used, but you need to configure the port anyway.

I wanted to keep all this out of the equation, so I’ve just baked in a pair of cables for D+ and D- into the circuit board. Right on ESD protection diode.

After destroying an old USB cable and connecting straight into the board it worked! I could flash QMK firmware and actually use the keyboard. It took me 2 more tries to actually get the socket right.

✅ Second takeaway: USB type C sockets are actually bigger pain to solder correctly than VQFN-44 chip package.

Design was more or less fine

This was my first keyboard design. To be honest this was my first real electronic device except of some Raspberry PI tinkering. In the end, keyboard is working fine. There are some minor issues with routing and rotary encoder, but you can type and program it just fine. I will be ordering fixed PCBs soon. This time I have managed to get chips from established local supplier.

So here it is. A 66% Ortho-linear keyboard prototype. Not the most common type of a beast.

Next to Keychron K3, a D1M1x with high profile switches in a minimalistic 3d printed case.

--

--

Software engineer — Tech Lead @Dayone.pl with more than 11 years of commercial experience. Getting into electronics and hardware engineering just now…