Custom Ortholinear Keyboard- Project Write Up

by TJSBear in Circuits > Gadgets

3523 Views, 35 Favorites, 0 Comments

Custom Ortholinear Keyboard- Project Write Up

Title#.png

My process of building a ortholinear keyboard from scratch.

Introduction

Custom Keyboard Assembly - Showcase animation

In 2019 I built myself a custom 60% keyboard from scratch. It used parts I found on the internet and the goal of the project was to enter the custom keyboard scene without breaking the bank. I have been using that keyboard ever since then.

Then in February 2021 I watched this video (here) by Zack Freedman which sparked my interest in mechanical keyboards again. Since then, my project has been to build a mechanical keyboard from scratch using 3D printed parts where possible and to create a custom PCB with an ortholinear layout.

In this project summary I describe my process of designing a prototype part as well as the final product.

I also created a showcase video for my project which you can see above. This was another project in itself and so I have created another summary on how I made it here. It describes my inspiration for the project and shows the process of creating a showcase video including the issues I overcame along the way.

The Layout of the Keyboard

KLE.PNG

Traditional keyboard layouts use staggered keys meaning the keys are offset row by row. This is an inherited quirk from when typewriters were first designed - if the keys were placed in a linear grid, then the physical levers of the typewriter would interfere with each other when pressed. They solved this by staggering the rows.

An “ortholinear” layout uses keys in a grid pattern without any staggering. This layout has the benefit of being more ergonomic and compact, as well as making touch typing easier since the keys are a in a simple and repeating pattern.

I created my ortholinear layout on KeyboardLayoutEditor.com (aka KLE). It is a 13x5 key grid with two spacebars offset left from the centre. I wanted a 4U spacebar (U stands for “unit” and 1U is a standard alpha keycap) however I couldn’t source them, so I settled with 2 2U keycaps.

Prototype Design

Numbered Proto case and plate.jpg
Numbered Proto PCB.jpg

The prototype consisted of a 3D printed plate which held Gateron switches in a grid. The plate was created using KeyboardCad.com which imported the layout from KLE. I then brought that design into a CAD package and added mounting holes and rounded corners. The plate was split into two pieces since my 3D printer bed size was limited. The two parts were later superglued together.

I hand wired the switches to an Arduino Pro-Micro, I chose this as it had integrated USB functionality and was compatible with QMK (the firmware of choice for custom USB keyboards).

I followed QMKs “hand wiring guide” to create the matrix of keys. Using a matrix meant that less pins were used on the microprocessor, because it only requires each row or column to have a pin dedicated to it, rather than each switch getting its own. For more info on this topic here’s the guide I used https://beta.docs.qmk.fm/using-qmk/guides/keyboard-building/hand_wire

For the firmware I chose to use the online configurator KBfirmware.com rather than create my own custom QMK installation. It used the KLE layout to enter the positions of all the keys and basically did all the heavy lifting for creating the firmware, I just had to enter in some key information. I did this because I was more interested in getting the project working and I don’t have much experience coding.

I used QMK-toolbox to flash the firmware to the Pro-Micro, this is where the project started to go downhill. After flashing the Pro-Micro it would continually disconnect and reconnect to the computer repeatedly.

I initially thought this was an issue with the soldering, so I resoldered all the joints and no change. I thought it might be the firmware, so I recompiled the firmware and reuploaded it, but to no avail. Then I tried using a different compiler but also no luck.

Eventually after retracing my steps, I found that I had missed a stage on KBfirmware.com - the pins on the microprocessor had not been set. This meant that the reset pin was constantly being held so the board was in a constant reset cycle. Once this had been fixed the Pro-Micro did not have this issue and it functioned as a USB keyboard device, however it did come with a few more issues.

The issues included:

· incorrect keys being pressed

· switches activating erratically

· multiple keystrokes registering from one keystroke.

All these issues seemed to come from bad connections between switches and the microprocessor, this meant that they could be fixed by redoing all the wiring and soldering. This was a simple fix and would almost certainly be solved with a proper fibreglass PCB. The fibreglass PCB would also neaten everything up and make the keyboard look more professional. The keyboard worked well as a proof of concept, so I moved on.

I created the case in CAD, I used standard keycap spacing to find the size of the inside cavity where the plate was held. The case was angled at 5˚ to put my hands in an ergonomic position whilst typing. I used ribs to increase the strength of the part since it had relatively thin walls, but they also functioned as support for the plate. The plate was fastened to the case using M3 screws which were screwed into pillars around the board.

I used the split feature to split the part in two pieces which can easily fit on a 3D printer bed. I 3D printed the two parts in black PETG with a layer height of 0.2mm at 100% infill. After 3D printing and a light sanding, I superglued the pieces together and assembled the prototype keyboard.

The case worked well enough with the prototype PCB to show it worked. However, the design proved to be inadequate as it was too shallow to fit the board and extremely flimsy despite the ribs. The port hole also was too small and inaccessible. The next version would be designed to fix these issues. At this point I had all the knowledge I needed to make a more developed and finished product.

Image 1 - shows the 3D printed case and plate.

Image 2 - shows the prototype electronics assembly (the tape was to prevent shorts whilst debugging)

Evolving the Prototype PCB

Numbered Keyboard schematic.PNG
Numbered Early Breakout board PCB.jpg
Numbered USB C keyboard PCB 3D.PNG
Numbered v2.png
Numbered Final PCB layer view.PNG
Numbered finished pcb.png

With a working prototype I decided the next step was to
design a proper fibreglass PCB. I wanted it to have off the shelf components which were easy to solder and to also use hot-swap sockets (this meant switches could easily be taken out without de-soldering).

To create the schematics and the actual PCB layout I used KiCad (since it was free and open source). I had never used the software and had only limited experience in PCB design. Over several weeks I designed multiple PCBs, slowly iterating my design, whilst also learning the software as I went.

My first designs were effectively breakout boards for an Arduino Pro-Micro, with diodes added to prevent multiple strokes being registered. These were my simplest designs but would have worked.

But then I got inspired by Hadi (a keyboard PCB maker on YouTube) from his video series on custom keyboard PCBs (Hadi's PCB Design Series). I decided I wanted to make a fully custom PCB with integrated microcontroller and USB-C port, this meant that there would be no need for a Pro-Micro and the PCB would look and feel even more professional than before.

I found that these PCBs were significantly more difficult to design, most of the issues came from the layout of the keys. There was not much space between the switches to place the larger components (such as the processor) and these spaces were identical across the entire board (it being ortholinear) so there were only a few sneaky places to put them. It was a logistical nightmare.

Eventually I had what I thought would be a working PCB with built in microprocessor and USB-port. I planned to outsource the board manufacturing and placement of SMD components (SMD means surface mount device where the components are just placed on pads, they are generally smaller and more difficult to solder manually). But first I wanted to check my designs.

I asked a friend to check my designs, he spotted some mistakes and made some suggestions (including to add pull up resistors to increase signal strength going into the processor) but he also questioned why I was making it more complex than necessary. He asked why I wanted to have the PCB as one piece, with the microcontroller integrated in the part. He was right, I struggled to find a good enough reason not to make the PCB this way since it would make the project cheaper (SMD assembly is not cheap) and I already had a Pro-Micro and I knew it worked.

So, I redesigned a new PCB, it was very similar to my first PCBs but combined everything I had learned about optimised trace runs and component placement. I added the pull up resistors to the columns, which I connected to a jumper pin so I could disable them if not needed (which it later transpired that it didn’t).

I then sent the PCB designs to JLCPCB (a PCB manufacturer in China). I chose to manufacture with matte black solder mask since it cost nothing extra, and I really like the look. The total price for 5pcs was £27 of which £17 was delivery from China.

The PCBs arrived a week later, and I started the final build. I started by soldering the components with the smallest height since it made it easier to solder the board without other components falling out. Plus I had extras of the smaller components, but not extras of the larger components which meant if I messed it up then it was less of a problem.

I used gateron SMD hotswap sockets instead of directly soldering the switches in place. But I don’t own a SMD soldering station. However, since the pads for these were relatively large, I could just heat the leg up, push the solder into the joint and capillary action took over.

Finally, I soldered the Pro-Micro to a connector block (this would make it easier to remove and replace if something went wrong) and the board was complete. After testing the board only a few keys did not register, and they were fixed by just resoldering the joints. It worked!

Image 1 - Shows schematics for the Pro-Micro breakout PCBs (I cannot confirm this design works, use at your own risk)

Image 2 - Shows an 3D render of the Pro-Micro breakout PCB

Image 3 - Shows a 3D render of the PCB with intergrated microprocessor components

Image 4 - Shows schematics for the PCB with intergrated microprocessor components (I cannot confirm this design works, use at your own risk)

Image 5 - Shows layer view of the final PCB in KiCad

Image 6 - Shows the fully assembled PCB

Version 2 Case

V2 case parts crop.jpg

For the version 2 case I wanted to fix the issues the last one had but also to add some more features. I followed a similar process but made it stronger and bulkier by adding more ribs and making the walls thicker.

I also split the board into 3 parts rather than 2. I intended this to make the gap between the parts less noticeable since it would no longer be in the centre. However, this resulted in the gaps being placed in an even worse position. Since both hands now rested on them, making it more uncomfortable to type on.

I also changed the height of the keyboard to allow for more space below the PCB, I did this by increasing the angle. But the result was that the keys were positioned too high and made it difficult to type on without raising my wrists.

After printing I attached the 3 pieces together by melting the plastic together rather than supergluing them. This made the bond much stronger and made the seam much less noticeable than before. The case worked fine and was better structurally than before, but I do plan on making a version 3 with better ergonomics.

Summary and What I Learned.

I wanted to make a custom keyboard from scratch, and I did so. I went down way more rabbit holes than I thought I would, and the project ended up taking months rather than a few weeks as was initially intended. I am happy with the result; my typing speed has taken a hit but that will hopefully improve over time!

I have learnt some valuable skills including using a new CAD package (KiCad), as I spent several weeks iterating and experimenting with the software. I also learnt to keep to the project brief - I kept wanting to add more to my keyboard (i.e., the fully integrated microcontroller, at one point I was going to add RGB lights) but I got reminded to keep to the goal. I learnt that retracing my steps is a good way of debugging and often the problem is just user error (i.e., me not changing the pins on the keyboard firmware wizard) and that iteration can sometimes result in a worse product (i.e., the version 2 case) even though intentions were reasonable.

Thanks to Andy Moore who provided feedback with the electronics.