Building a custom keyboard – intro

A custom keyboard? Why? How?

Advertisements

I use keyboards all day, every day. Work computer, work laptop, home computer, home laptop, phone, tablet… even my Nintendo Switch has a virtual keyboard. And cavemen everywhere will tell you that for comfort and feeling, nothing beats a good old mechanical keyboard.

There are plenty of mechanical keyboards on the market, but there is always a problem with every one of them. It could be the size, the shape, the key layout on 60% or TKL, the keycaps, the LED color, the extras… For example, I really like typing on a full 104-key keyboard, but recently I’ve felt the need for a smaller alternative. For reference, this is the keyboard that I use both at work and at home: the Das Keyboard 4 (Ultimate and Professional).

daskeyboard-4-ultimate-front-view-carousel

And here’s what I need to consider when choosing a new keyboard:

  • I like having arrow keys, the page up/down keys from time to time, the home/end key when programming, and I always use the keypad when more than 2 digits are needed. So I need to keep these in a smaller set of keys.
  • I game a decent amount. Game boards are a good alternative but choices are few and are far from perfect.
  • I don’t touch type correctly. I have built my muscle memory over the years, so I don’t use the right fingers, even though I don’t have to look at the keyboard.
  • I like professional-looking keyboards, but a bit of whimsy with LEDs is welcome, especially for the home keyboard.
  • “Form follows function” is a good principle for such an accessory, where productivity is paramount, whether it is for typing or gaming. Key layout and extras may be different depending on what task is performed.
  • While I type in several languages, I’ve become accustomed to the ANSI layout and prefer it over the ISO layout.

Because of all this, I decided that I would build my own, custom keyboard.

It turns out that this is a more common hobby than I imagined, and many things that one needs have ready-made solutions which makes the whole process relatively easy, even for people without electronics or programming experience. This post will follow the progress of my research and experiments with custom keyboards, as I try my hand as “making” for the first time.

The choices, and options

There is a whole world of choices behind the perfect keyboard. Personal taste plays a large role in that, as well as the purpose behind the keyboard. I’ll try to outline as many of them as I can. In the next post I will add ideas for experimentation and my choices.

The layout

This is the most fundamental part, as it will influence the rest of the design. There are already many alternatives out there:

The 104-key ANSI layout

This is the standard one we know and use. It has remained unchanged for decades and is the one that all new computers come with.

filco-standard-layout

The tenkeyless layout

What if you never use the keypad? Just remove it! This is the Ducky keyboard, a very popular alternative.

du4bkyb

The 60% layout

The smallest standard layout. With this one, keys are lost (the `~ key is replaced with Esc, F keys are gone, and there are no arrow keys). To remedy this, the keyboard supports “layers”. A single key press will have different effects depending on which layer is active. The Fn key is an example of key that will determine which layer is active. Layers are the solution to smaller layouts, but can be extended to turn keyboards into multi-purpose peripherals.

Smaller keyboards reduce the travel distance for your hand to use the mouse, which relieves tension in the shoulder and neck.

poker2.jpg

Non-standard (but still recognizable) layouts

After that, one can add or remove keys, or even move them around. This really depends on how you use the keyboard. One of my inspirations for building a custom KB was to find the Whitefox by Matt3o (a reference and an inspiration on the subject). The layout can be customized, and the firmware can be modified if you are familiar with C.

whitefox

whitefox-programmable-mechanical-keyboard-07

I like that this keyboard looks like a 60% layout but adds another column of keys to provide some of the lost functionality. The `~ key was moved from its original place to the right side. This is definitely my main inspiration for this project.

Ergonomic layouts

You know this, but the idea behind the ergonomic keyboard is to bring the hands to a more natural angle, reducing wrist stress and the possibility of getting carpal tunnel after long bouts of typing. For this, the layout is split in two sections, one for each hand. Unfortunately, ergonomic keyboards usually assume that their owners can touch type correctly.

We have all seen the classic Microsoft ergonomic keyboard, which adds a bit of curvature. But there are more “extreme” examples:

7332059_sa

maxresdefault

The Ultimate Hacking Keyboard can be used as a normal, one-piece keyboard or separate in two pieces for ergonomic placement.

Ortholinear layouts

The ortholinear keyboards simply form a matrix of keys.

t1qqfad.jpg

This is a cool-looking keyboard, but it apparently takes time to adjust and get back the typing speed one has learned to get on a regular layout. However, a programmable keyboard with this layout can become anything: a soundboard, a map of specialized macros for software, etc.

While it can be difficult to adjust one’s typing method with it, some gamepads use this layout, so it may be useful for this purpose.

Fully ergonomic

These keyboards break a few conventions we’ve seen in the examples above: the keys are neither vertically nor horizontally aligned, they are not arranged on a flat plane, and the layout can be completely different. The idea is to respect each finger’s length and travel distance, which results in little to no wrist movement, further reducing stress and possible injuries. These keyboards are not solving the space issue though, see for yourselves:

The Kinesis Advantage is the first example I’ve seen of this.

kinesis20advantage201.jpg

Other examples include this keyboard, which seems to add even more curves by adding thumb wells, and a full pad of keys in the center.

ergonomic-keyboard1

The switches

There are many different types of mechanical switches out there.

The most famous and wide-spread switches are built by Cherry and are known as Cherry MX ; they come in various flavors, depending on whether one likes to feel and/or hear the actuation, how much force one likes to exert on the switch for it to register. It comes down to feel and purpose (many people love the brown switches for typing but the red switches for gaming, some love the “clickyness” of blue switches but people who work in the same open space may disagree).

Other types of switches include Topre, which many enthusiasts prefer for its feel and simpler mechanism. Alps switches are also popular and praised for their feel.

The micro-controller, software and electronics

Once we picked the switches, we need to add the electronics for them to become a keyboard. On the surface, this looks complex, as:

  • The circuit must register on the computer as a keyboard, i.e. as a human interface device (HID) and communicate as such
  • The system must be able to register potentially 100+ keys and send the correct data over the USB (or Bluetooth)

Fortunately, smarter people than I have figured out those things and prepared the work for us.

The most popular micro-controllers for electronics enthusiasts and makers are ATMega controllers and ARM controllers. ARM controllers usually offer higher computing power, support more peripherals and I/O protocols, and have more pins to work with.

Arduino boards are extremely popular, and feature either an ATMega or an ARM chip.

Another popular pre-made board is the Teensy.  It is particularly popular for custom keyboards for the reason we will see below.

The appeal of pre-made boards with ATMega or ARM chips is that they connect via USB, usually come with a development environment and with software to easily upload firmware onto the boards. They also benefit from very large communities which have been extremely productive and make most of their code open source for us to use as is or customize.

The reason why Teensy is popular for keyboards is that there is such a firmware: TMK, or its variant, QMK. The firmware takes care of the USB registration and communication, of processing the data in and out of the micro-controller pins, and of converting those inputs into key presses the computer can understand. Usually, the most “programming” one needs to do is configure the keys and layers along rows and columns, also called the key matrix (more about this later).

The materials

The physical build for this project is rather simple: you need a plate onto which the switches will be attached, and a case. If you choose a standard key layout (104-key, TKL, 60%), you will easily find pre-cut plates and cases for sale on the internet.

Plates are usually made from aluminium, steel or plastic. Rigidity is necessary so the plate doesn’t cave and bend on keystrokes. The case can be made out of anything.

For home enthusiasts, there are a few options, depending on the tools available to you and the money you’re willing to shell out.

3D printing is a great tool to build the case. It doesn’t quite provide the strength needed to avoid deformation though, making it a poor choice for the plate if not reinforced.

Laser-cut acrylic is stronger than 3D-printed plastics, but does not offer the design flexibility that 3D printing offers, and it also requires reinforcement to be used for the plate.

Aluminum and steel can be cut by many consumer-grade laser cutters, and are great materials for the plate.

The features

After doing some research, I have found many different features for keyboards, some of it we take for granted, some that are a bit less common. I’ll list the ones I have in mind, and add the questions they got me thinking about.

USB outlets/USB hub

xarmoru9bl_39

This is particularly interested for those with a Bluetooth mouse, or as a thumb drive outlet, or for other peripherals.

How does that work? Is the cable sticking out from the keyboard the USB hub input, and the keyboard itself is only one of the peripherals plugged into the hub? Can the hub be powered (with a thicker cable containing USB and power)? How would that work with USB-C? Can we have high-amperage USB-C outlets on a keyboard?

Headphones and microphone jacks

See photo above. Is this just a jack-to-USB device that uses the USB hub? I don’t expect the keyboard cable to include more lines for these.

Trackball, trackpoint or mouse by keys

To further reduce hand travel distance from keyboard to mouse, the keyboard itself can feature a trackball, a trackpoint, or even emulate the mouse with keypresses. The Ultimate Hacking Keyboard (UHK, see above) for example has a mouse layer, and the QMK firmware supports mouse outputs.

Usually mice are different devices for the computer, is it once again a hidden USB hub where one device is a keyboard and the other is a mouse? Can one HID device send both keyboard and mouse signals (from the QMK software support, it looks like it might be the case).

LEDs

How to personalize your keyboard? Add LEDs, and rotate colors and patterns by typing a set sequence of keys. LEDs backlight under the keycaps, LEDs around the case, there are so many possibilities!

RGB patterns quite probably need an extra MC to control them, but for simple, one-color backlight with just levels of brightness, would the Teensy or Arduino suffice?

Case buttons

When typing, I find it instinctive to find spots on the side of the case. Adding buttons on these spots would be an easy way to add functionality without expanding the keyboard surface area. The UHK features case buttons, and I have seen other custom keyboards with flat buttons on the side of the case.

uhk-merged-photo-1024x425

Volume wheel

Wheels are so much more practical than buttons for volume control in my opinion. More precise, faster, and just more intuitive. Usually easier to find as well. I love the volume wheel on my Das Keyboard 4, but drum roller wheels have a smaller footprint.

 

Is this part of the usual HID device control features?

Extra storage

If we build a USB hub inside a keyboard, why not make one of the USB peripherals a storage peripheral? Some people have managed to add hidden storage, which only appear when a given sequence of keystrokes is performed (like a password).

This is done by programming a MC so the USB storage’s power pin is only up if the correct sequence is entered.

LED/LCD screens

Screens are also a common feature on gaming keyboards. It can display information about the computer (CPU/GPU temperature, music track being played, etc) or information about the keyboard (the UHK’s three 7-segment displays indicate which layer is active).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s