Project information
- Category: Hardware design
- Project date: 03 Sep, 2019
- Github Page: www.example.com
Custom Design Mechanical Keyboard
This project was inspired by other project by many people online. Basically, they show how easy it is to design your own mechanical keyboard. I'm doing this project because I always wanted to own mechanical keyboard. There are many cheap mechanical keyboard, but those keyboard have a lower quality then more expensive one.
So, because I learned how easy it is to make my own mechanical keyboard, I decided to design and make my own mechanical keyboard. This keyboard that I make it's far from perfect, but because I make it by myself, I kinda satisfied by the result. In this writing I will show you how to make your own mechanical keyboard. From design process into manufacturing.
Design
To design the case, first, I created my keyboard layout using Keyboard Layout Editor. Then, I use Case Builder to generate a case without designing it from scratch. This will save a lot of time designing. If, you want to have custom holes some place in the design you can do that too with the website above. But, I use Autodesk Inventor to do it, because it easier for me, and I can visualize what the design will look like.
Hardware
I decided to make 65% keyboard because of the limitation of the microcontroller that I'm using. The ATMega32u4 is the most common microcontroller to use when making keyboard, because it has native support for USB and it has support for QMK firmware.
I use Autodesk Eagle to design the pcb for this keyboard. I mapped all the possible GPIO from microcontroller to connect all the switches and some LED. I want to make a backlit LED keyboard so, I connect 2 GPIO to connect to each zone of LED. I use 2 GPIO to control LED because I'm afraid 1 GPIO doesn't have enough power to control all the 68 LED.
65% keybord means it doesn't have numpad key, and no function key. In total it need 68 switches, instead of 104 swithes on full size keyboard.
Of course ATMega32u4 doesn't have 68 GPIO for all switches, thats why all switches need to be design in matrix format. (eg. 5 rows x 5 columns) Allowing to use minimum pin as possible for many switches. I found out about using matrix in keyboard in this article. For this case I need to make it 5 rows x 16 columns. I can make it even more compact, but for easy PCB routing I will make it like this. With additional led pin and backlight, I need 25 pins. Exactly the maximum GPIO ATMega32u4 has.
Once the scematic is done, now begin the fun part wich is routing the PCB. The key to PCB design is to take time for each signal route. And once its done, it will look like a professional looking PCB. In the process of designing this keyboard took me around 1 week or more, because I don't want to make any mistake and send the PCB back to manufacture.
And yes there is one mayor mistake that I make. I accidentaly assign the wrong pinout for MOSI pin on ATMega32u4 for programming. But, nothing to worried, the MOSI pin still accessable.
I send the design to JLCPCB to manufacture. I choose blue silkscreen because I like blue, that's it. Once I got the PCB I start to placing component, starting with the chip it self and the switches are the last one to solder.
Software
Luckily, QMK firmware has already doing all the work for software side. It already support all kind of keyboard configuration and has a great documentation on docs.qmk.fm. And with the help of qmk firmware builder, there almost nothing to change on the firmware. Of course I added some additional functionality like, tap dance and overcomplicated the layer thing.
This is some of the code snippet for my keyboard. For more detail are in my github page.
Assembly
I choose acrylic for the case because it looks cool and it's cheaper than using allumunium or plastic case. And I want to build it myself too. I choose 3mm thick acrylic for top and bottom case, and for filler I choose 2x5mm acrylic then I decided to use only 5mm acrylic because it was too thick. The problem here I think the top acrylic was too thick, some of the stabilizer doesn't work properly.
After soldering all of the components and compiling the firmware, I flashed the firmware onto the board over USB using dfu-programmer. To my surprise, everything worked on first try! Typing on it was a lot of fun and I was pretty happy with the results. Though I probably won’t be using this as my daily driver, I definitely learned a lot about PCB design and embedded development.
Future Development
For future design, probably I will make it more variety for the sizes. I know that I can make it full size keyboard using ATMega32u4. Or make it even smaller like 60% keyboard. And probably adding some functionality like rotary encoder or OLED screen.
But, the one improvement that I want to make is to make it wireless using bluetooth.