Split Mechanical Low Profile Keyboard Using Arduino Pro Micro

by lucas14 in Circuits > Arduino

1868 Views, 19 Favorites, 0 Comments

Split Mechanical Low Profile Keyboard Using Arduino Pro Micro

IMG_3039.JPEG
IMG_3040.JPEG

Background

I wanted a standalone keyboard to use with my laptop, which with its small keyboard, pushes my hands together and forces my wrists to bend uncomfortably. I had this idea after learning that the Pro Micro, with its ATmega32U4 microcontroller, has built-in Human Input Device (HID) functionality and keyboard libraries that take care of most of the programming work. Additionally, I wanted the keyboard to work with only the left side plugged in, allowing for better gaming ergonomics.

Design Goals

(High to low priority)

  1. Split mechanical keyboard with 65%, ortholinear layout
  2. Powered by Arduino Pro Micro
  3. Barebones and low profile to mirror laptop keyboard height
  4. 3.5mm Aux between sides, USB-C to computer
  5. Low cost (<$100). Amazon alternatives start at $100-120 range
  6. Mirrored PCB, allowing for a single PCB design

Below is a summary of how I designed and built a custom 60%, ortho-linear, 67-key, splittable mechanical keyboard that runs on Arduino Pro Micros.

Supplies

Required:

Preferred:

  • 3x Gateron 2u stabilizer (used for to uniform 2u switch resistance)
  • 1x Small slide switch (used to disable typing functionality)
  • 1x 10k ohm 1/4 W resistor (used to pull up slide switch)
  • 2x Push button, through hole (used to reset micro)

Tools:

  • Soldering iron
  • Solder
  • PC
  • Tweezers

Planning and Prototype

IMG_2322.JPEG
IMG_3149.JPEG

Time Spent: ~10h

The custom mechanical keyboard community is extensive and well-researched. I took a few hours to browse maker sites and it didn't take me long to find a few keyboards similar to what I was thinking. During my brainstorming process, I found Keebio's Levinson and Rickard Von Essen's Let's Split to be somewhat similar to my design goals. They were both 40% layouts, however.

You may be confused about the terminology I've been using so far. In the keyboard community, the most relevant term is the layout size which describes the amount of keys. A full 100% keyboard would have everything, including function keys, navigation keys, and a numpad. On the other end, a 40% keyboard only has letters and a few modifier keys. Another term is a unit that describes the size and spacing of keys. A single unit, 1u, is 19.05 x 19.05mm. 2u would describe a key that's two-wide (shift key for example) and so on. The physical shape of the keyboard is also relevant. I chose the nontraditional grid-like ortholinear format for simplicity.

I instead chose to design a keyboard with 5x6 keys on the left side and 5x8 keys on the right side, similar to the picture above. The extra keys when going from 40% to 60% allow for numbers, arrow keys, and auxiliary keys for custom macros.

I put together a mock keyboard on a breadboard using push buttons, jumpers, and a Pro Micro, also shown in the banner. A quick sketch was written to test HID functionality. After this, I proceeded to the electrical design part of the project.

Electrical Design: Schematic

Screenshot 2023-07-25 220558.png

Time Spent: ~3h

Since I designed this at home and did not have access to professional PCB software such as Altium, I opted to use KiCad, a free and basic PCB software. Because the Pro Micro only had 16 GPIO, a button matrix is needed to conserve pins. I first connected the keyboard matrix using 5 rows and 8 columns, for a total of 13 GPIO pins. As shown in the schematic, diodes were connected from the bottom to each row. These diodes prevent a phenomenon known as ghosting, which may incorrectly detect key presses.

After the matrix was sorted, a pushbutton was put between RST and GND. VCC, GND, and another 2 GPIO were connected to the TRRS jack for I2C communication. With 1 final pin, I added room for an auxiliary potentiometer, which I later changed to a switch.

Downloads

Electrical Design: PCB Layout

Screenshot 2023-08-06 200402.png
Screenshot 2023-08-06 200722.png
Screenshot 2023-08-06 201030.png
Screenshot 2023-08-06 201012.png
IMG_2832.JPEG
IMG_2830.JPEG

Time Spent: ~6h

This was one of the most complicated, yet fun, parts of this build. This stems from my requirements for a mirrored design. The major low-volume PCB manufacturers require a minimum order of 5 boards. To save money, I decided to design a board that could be used for both the left and right, instead of ordering two different designs. This means that the layout must be symmetrical and the component footprints must be mirrored.

I created the 5x8 grid of the through-hole keys, all spaced 1u apart. The diodes used were surface mount, so vias were used to connect the two sides. The microcontroller board was placed and traces were routed to each row and column. Because of the mirrored design, traces were run between the two outer legs of each switch. Finally, the reset button, TRRS jack, and auxiliary connection were placed.

Due to the asymmetry of the design, the PCB needs to be cut. I used short lines of small vias to help in the cutting process. I considered adding a V-score but I didn't want to risk the right side breaking.

The entire board used two trace layers and was 98 x 150 mm. I used JLCPCB to manufacture the boards and after shipping, the total was $15.60 for 5 PCBs. This first iteration worked but has some issues that I will get into later.

The Gerber files are accessible here.

Mechanical Design & Build

IMG_2859.JPEG
IMG_2860.JPEG
IMG_3055.JPEG
IMG_2972.JPEG
IMG_2983.JPEG
IMG_3037.JPEG
IMG_3038.JPEG

Time Spent: ~12h

When choosing components, I kept price and thickness in mind. Kalih Choc switches are not nearly as common as the Cherry MX, but are low profile. I chose brown switches for their tactile click and medium (60g) actuation force. I also decided on fairly thin keycaps that I made with my Ender-3 V2 3D printer. This produces worse quality caps than I could buy, but are cheaper and can be customized easily with Fusion 360. I used Bull3t's Kailh choc keycap.stl files found here. I printed 64 1u caps. Unfortunately, Bull3t did not design 2u keycaps that I needed for my spacebars and enter key. I instead remixed his design in Fusion 360, essentially stretching the key to two-wide and adding stabilizer holes. My design is included below.

When using keys 2u or bigger, stabilizers are highly recommended. Stabilizers distribute the force of a key press, allowing for equal force when pressing on the side of the key rather than the center. I included holes in the PCB for the stabilizers but mismeasured, so I needed to route them out with a Dremel tool. This was my first major flaw with the PCB. I also routed into a trace, so thin wire was used to fix this. The current build shown does not have the stabilizers installed, but I will update this when I install them.

All electrical components were directly soldered to the PCB, including the Arduino. This is typically not a great idea as replacing a dead Arduino that's been directly soldered is quite difficult (unfortunately I learned the hard way). On the bright side though, not using Arduino and switch sockets saves money and keeps the keyboard low profile. I took my time to ensure all switches were straight. The Arduino was soldered upside down on one half, which prevented me from needing to mirror the large footprint.

I used a Cricut Explore One to cut white vinyl for the keys. I also sanded each key to remove sharp edges. The blank keys are modifier keys such as tab, caps lock, shift, ctrl, etc. These currently have labeled masking tape on them while I figure out exactly the layout I want. Again, I will update this as I progress in the final touches of the build.

Downloads

Firmware Development

Time Spent: ~19h (incl. debugging and optimization)

The firmware development was done through the Arduino IDE. In the mechanical keyboard community, using Arduino language to program a keyboard is quite rare. Instead, many creators use the custom QMK firmware that was created specifically for keyboards. This software is extremely powerful and allows for more advanced features such as Bluetooth, button layers, displays, and backlighting, to name a few. It supports multiple microcontroller bootloaders as well. I instead opted for Arduino IDE as I was very familiar with it and didn't want to learn the QMK coding style.

The current code for the left and right sides is below. This code is fairly well commented, so I won't go over every step, but I do want to mention a few things.

  1. The two sides must be programmed individually, but you don't have to unplug the two halves to do so.
  2. The code is fairly inefficient. For example, the code controlling the initial and repeat delay when holding a key is time-independent. It is instead based on loop time and waits for a certain number of program loops to repeat a key, which is admittedly a messy way to code.
  3. The left (master) side does the majority of the computing as it simply asks the right side (slave) for the status of the keys. The left side does all of the communication with the PC as well. The keyboard would not work if the right was connected to the PC. It will, however, work if only the left side is connected (for use as a gamepad).

Conclusion & Lessons Learned

This project took far longer than expected but was quite enjoyable. I learned a lot about PCB design, coding, and the keyboard community. I also learned a lot of things that I would've done differently.

Lessons Learned

Electrical schematic

  • The auxiliary potentiometer was a good idea, but I utilized it for a switch instead. This switch is coded to disable keyboard input when debugging. Without this switch, if a key was held down in the software, it would be extremely difficult to upload a sketch to fix the issue.

Electrical PCB layout:

  • The stabilizer holes were too small. I mismeasured and need to update this in another revision.
  • The vias to split the board weren't as useful as I thought. I basically needed to saw the board in half anyway. In another revision, I would test V-score if I found it to be strong enough for the right half.
  • I did not pour a ground plane which resulted in noticeable ridges along the traces. This was the result of my inexperience in PCB design.

Mechanical Design:

  • The 3.5mm aux cable is commonly used, but is not 'hot-pluggable'. This means if the cable was (dis)connected during use, there is a possibility that pins in the TRRS socket could be briefly shorted. I would have to find other common wires with four conductors.
  • I should've added holes for standoffs.
  • Real keycaps would be a great upgrade, but are expensive and aren't as thin as the 3D-printed ones I used.

Firmware Design:

  • Although QMK is quite complex, it is more powerful than Arduino IDE. It would be nice to learn and use this firmware in my build.

Costs and Labor

In total, this project took 53 hours. I spent a total of $117.52, which includes shipping and extra parts. The price per keyboard is currently roughly $70.69. If you had all the pieces and a revised PCB ready, I believe someone with a basic knowledge of PCB assembly could make this in under 6 hours.

Next steps

This project is ongoing. Currently, my next steps are to finish to finalize the key layout and add the rest of the vinyl. I will also design a case/thin stand for the board as it currently doesn't sit flat. After that, I'd like to add magnets between the keyboard so that it could snap together to be used as a regular non-split keyboard. I was also thinking of soldering to these magnets, allowing for use without the aux cable when together. For firmware, I'd like to spend time on the code to optimize it and make it faster. I would also like to create macros that could do common tasks for me (open webpages, automate shortcuts, volume control, etc.). I would also like to add the potentiometer on the one unused side. This could be used for volume/scrolling functionality.

We live in a time period where high-quality information is free, abundant, and easily accessible online. Although I do have college experience in Electrical Engineering, this project could be easily replicated by someone with no knowledge of Arduino or electronics. If you read through this whole project, I thank you and hope this inspired you. If you have any questions, comments, or found this useful, please feel free to comment below. Thanks again!