As someone who enjoys playing intense games like League of Legends, Mario Kart, and gun battles, I ended up destroying my Wrangler mechanical keyboard with my vigorous typing. In order to replace it, I purchased an RK100 online as a suitable replacement. At the time, my understanding of mechanical keyboards was limited to gaming and work purposes. However, when I was looking for a theme for TechSparks, I found an article online about keyboard PCB design, which sparked my interest in DIY.
This experience sparked a 4-month journey that transformed me from a novice with limited knowledge of linear and paragraph axis switches to someone who is now waiting to process CNC shells for their first DIY customized keyboard. Though I remain a novice when it comes to standard keyboard, I am excited to share a comprehensive summary of the knowledge I’ve gained during this process with others who are interested in embarking on their own self-made keyboard journey.
I must admit that my article is lengthy and may contain errors. Therefore, I welcome any feedback or corrections that readers may have and encourage them to contact me via email with their suggestions.
Customize unique keyboard skins
When it comes to customizing your own mechanical keyboard, it’s important to make it stand out and be unique. Otherwise, it would be more practical to simply buy a pre-made keyboard online. This is why I made it my first priority to figure out how to make my keyboard distinctive. After much contemplation, I decided to customize its appearance based on my personal interests. As a big fan of Michael Jordan, I thought a Jordan-related theme would be fitting.
One of my favorite moments in NBA history is from the 1998 NBA Finals, when Jordan stole the ball from Karl Malone and scored the winning basket in the last 5.6 seconds of the game after a series of impressive moves. It’s a classic moment that’s been passed down through generations and one that I wanted to honor with my keyboard design. I’ve named this self-made mechanical keyboard with a youthful theme “Last Shot.“
Search data for keyboard themes
- Michael Jordan needs no introduction as he is my favorite player and wears No. 23;
- Scottie Pippen, who wore No. 33 and No. 2 for the Bulls, was another key player on the team;
- Dennis Rodman, No. 91, was one of the important members of the “Iron Triangle” and is well-known to fans of the anime Slam Dunk. He is considered the prototype of the character “Yingmu Huadao” and is the well-deserved rebounding king;
- Toni Kukoc, No. 7, was a top three-point shooter and often became the biggest threat to the Bulls when no one was marking him;
- Steve Kerr, who wore No. 25, is now a coach and was once the champion of the three-point contest.
Appearance setting of the mechanical keyboard
Main Color of Keyboard: Jordan wore a red and black bull jersey in the last battle of the year, so red and black are the most suitable colors for “Last Shot”.
Keyboard Structure: Most popular one is the “gasket mount,” but as a novice, I found it too challenging to attempt. Instead, I decided to go with the “top mount” structure, which involves fixing the positioning plate onto the top shell.
- Keycaps: If I’m going to DIY a mechanical keyboard, why not also create my own set of keycaps?
- Switches: I chose the gold powder switches because they are excellent in quality and aesthetics.
- Positioning plate: For the positioning plate, I opted for copper to give the keyboard a stylish look. I chose champion yellow as the color for added flair.
- Circuit board: Initially, I planned to customize the PCB, but the cost was too high. TechSparks operates without profit, so I decided to go for a more affordable option.
- Cable: I had initially planned to create handmade red and black cables to elevate the keyboard’s aesthetic appeal, but due to cost constraints, I had to abandon the idea.
Customize keyboard layout
Keyboard layout options
Full Size Keyboard
The full-size layout refers to a traditional keyboard case that includes 104 keys, such as number keys, function keys, arrow keys, and a separate keypad. A mechanical keyboard PCB is responsible for providing connections between different keys, switches, controls, and other electronic components in this type of keyboard. If you plan to use these homemade keyboards regularly, sticking with the traditional layout may better suit your habits.
The layout of the RK100 is practical and functional, making it a more compact and aesthetically pleasing option compared to a full-size keyboard. However, for designers or heavy keyboard users, a mechanical keyboard with a 90% layout may be a better choice.
It’s important to note that the size of the keyboard layout corresponds to the amount of money you’ll need to spend on the switch body. If you want to change the switch body for a new experience, you’ll find that a 60% layout will save you money. Therefore, when choosing a layout, you should consider the investment you’ll need to make in the switches later on.
Tenkeyless (TKL) keyboards are designed without the independent numeric keypad and instead feature an 87-key layout. This makes them ideal for users who prioritize compactness and space-saving designs, especially gamers and computer professionals. A reliable and stable TKL should support multiple switch types, provide excellent key rollover and anti-ghosting, and ensure optimal performance.
The 60% configuration is similar to that of a Mac keyboard, with only the main keypad reserved and the top “F keypad” canceled. The functions of F1-12 are instead realized through combination keys, resulting in a perfectly proportioned keyboard. However, if you frequently use the “~” key when typing, then customizing this type of keyboard may not be the best choice for you. Nevertheless, the sleek appearance of these keyboards may be worth compromising your typing habits.
Split keyboards employ an ergonomic design that divides the keyboard into left and right parts, each with an independent PCB board connected by a flexible cable or other connectors. The split layout promotes comfort and healthy work practices, reducing hand fatigue caused by extended keyboard use.
Edit your project with the keyboard layout editor
- Preset: After entering the interface, you will see the layout that needs to be preset, and you can choose an arrangement that matches your expectations. If you want a 60% keyboard, you can delete the excess in the selected full-size layout.
- Add Key: Add a key to the layout page.
- Delete Keys: This feature is a bit redundant and has the same result as if you used the DEL key on your keyboard.
- Undo, Redo, Cut, Copy, Paste: These are self-explanatory features.
- Properties; This feature is very important, as it includes basic settings such as text, color, width, and height on your keycaps.
- Top Legend, Center, Bottom Legend: These three features mainly allow you to input text on a certain keycap in the first column, and the position of the text is divided into upper, middle, and lower layers.
- Width and Height of a Single Key: The width and height of the keycap have a basic unit “U”. Usually, the letter key is 1U, the CTRL function key is 1.25U, the space bar is 6.25U, and the Backspace is 2U. Here, you can customize the width and height of these keys according to your preferences.
- Raw Data: This is the most important feature of the editor because I have encountered many layout-related issues. After adjusting all the arrangements, an unintelligible code is generated in the text box, which must be saved. I forgot this step when I did it for the first time. You can save it in a local text document, so that the next time you make a positioning board or change your arrangement, you can simply copy this code and make adjustments based on the layout you saved last time, instead of starting from scratch. Furthermore, the layout editor is very flexible. You can adjust the data on the web page and the “U” value using the left and right arrow keys on the keyboard. One trick here is to use the mouse to select the buttons’ size to be adjusted in batches.
Plates and cases built for keyboards
To excel in one’s work, a worker must first hone their skills and tools. For this purpose, it’s essential to find a suitable “weapon” before commencing the work. In our case, we recommend using AutoCAD, an engineering drawing software developed by AUTODESK. While AutoCAD is commonly used for drawing dimensions on construction plans, it’s also a powerful tool for drawing and modifying positioning board files. Though it has many features, only a few basic commands are needed for working on a DIY mechanical keyboard.
Having learned the above, you should now be aware that our keyboard is called “Last Shot”. We have determined the layout and generated our own arrangement code in the ROW DATA column of the keyboard editor website, which we’ve saved.
The next step is to create our own positioning plate using the “Plate & Case Builder” website. The website interface is shown below, and TechSparks will explain it in detail:
- Plate Layout: Our main focus will be on any content related to the code. We need to copy the code generated on the KEYBOARD EDITOR website to this position, which represents the layout of the entire positioning board.
- Switch Type: This refers to the shaft switch. Since I’m unfamiliar with the other options, let’s just choose the first one.
- Stabilizer Type: This is used to select the satellite axis. No matter what, always choose “Cherry Only”. Do not select “CHERRY + COSTAR”! This is very important, don’t ask me why I say this, because I have a spare copper set in my hand now.
- Draw My CAD: Once all the work is completed, click this button to jump to “5”, the CAD Output column, as shown in the figure below:
In the interface shown above, you’ll notice three download buttons located in the upper right corner. You can choose from different formats such as SVG, DXF, and EPS.
Below the positioning board, there are two numbers that hold significant importance. These numbers are used to set the width and height of the positioning board, measured in millimeters. I’ve selected a width of 347.665 and a height of 119.064. Once we download this file, we can open it in CAD, as depicted in the figure below:
AutoCAD is a tool that relies heavily on shortcut keys. If you want to know about it, you can search it on Google. Here we briefly introduce it:
- L — Straight Line
- TR — Trim Redundant Lines
- O—Offset Side
- M — Mobile
- CO — Copy
- DIV—Several Paragraphs on One Side
- E — Delete
- Space / Right Mouse Button — Confirm
For example, if you want to draw a straight line on this software, you can complete it according to the following process:
Tap “L”→space to confirm→left mouse button to select the starting point of the line→confirm the direction→input the value of the line→space to confirm again.
Upon comparing the two pictures above, you’ll notice that the positioning plate for my keyboard has been almost entirely manufactured, and there’s a self-made logo on the right-hand side.
Due to the usage of the TOP MOUNT structure, there are four protruding fixed structures on the upper and lower sides of the positioning plate. To ensure that the keyboard remains intact and does not fall apart under severe knocking, screw holes must be added to this structure before it’s combined with the keyboard shell.
You might be wondering how to set the width of the fixed structure. In reality, this is quite simple to calculate. Although the positioning board we’ll be working on later is a copper fixture, there must still be a specific distance between the screw hole and the edge. The hole must be positioned 2mm from the edge.
TechSparks used screws with a 2mm diameter stud. To account for any tolerance issues, the screw hole diameter should be slightly larger than 2mm. Typically, this value is 0.2mm. Therefore, we can deduce that the diameter of the screw hole is 2.2mm, the distance below the screw hole is 2.0mm, and hence the width of the fixed structure of the positioning plate is 2+2.2+2=6.2mm.
Adjust the keyboard matrix map
In the content above, we have used CASE BUILDER to manufacture the keyboard’s positioning board, and modified it into the suitable TOP MOUNT structure using software. Now, we will proceed to generate the configuration file in JSON format:
What is the Json file for
- This can be used to layout the matrix of your keyboard. While the word “matrix” may sound very professional, it is actually quite simple. It refers to the rows and columns of your keyboard, forming an XY two-axis system.
- This is a linking file, as we need to prepare the PCB for the keyboard. With the exact rows and columns defined, we can accurately draw the schematic PCB diagram.
- Within this file, you can define the key values of the keyboard, which is to say, you can define the function and role of each key.
- After drawing the PCB, adjust the rows and columns corresponding to the pins of the main control chip.
- Finally, generate the HEX suffix file for flashing the firmware.
How to adjust the matrix plot
After entering the Keyboard Firmware Builder, copy the code that we generated on the keyboard editor to position 1, and then click “Import” to import it.
- Keyboard Matrix Diagram: By adjusting the ROW and COL values, the layout can be made more comfortable, which will make it easier for us to draw the circuit schematic diagram.
- ROW Value: This refers to the number of rows in the keyboard matrix.
- COL Value: This refers to the number of columns in the keyboard matrix.
- Select Row or Column: At this stage, this can be temporarily ignored, but it is very important. It needs to be synchronized with the PCB schematic diagram when generating the firmware, otherwise the keys on the keyboard may not function properly.
- PINS: The pin numbers of the master controller that correspond to all the rows and columns, as well as the CAPS LOCK and RGB lights, can be adjusted here. After clicking on it, it will be displayed as shown in the following figure:
- ATMEGA32U4: We choose this option as it is the main control chip we want on the assembled PCB (printed circuit board).
- ROW & COL: This box allows us to adjust the pin numbers corresponding to the ROW and COL values. Once the schematic diagram is drawn, we can fill in the corresponding row and column values.
- CONFIGURE LED PINS: This controls the pins corresponding to the keyboard lights.
- KEYMAP: This refers to the key values. The key values are hierarchical and are usually divided into tier 0 and tier 1. Layer 0 is the base layer, where commonly used symbols and letters are stored. When we press the FN key, we can switch to layer 1.
- Layout Name: Enter the name of your DIY keyboard here.
- Bootloader size & Backlight LEVELS: These settings do not need to be adjusted; you can use the default values.
- WS2812 LEDs: This setting is used to specify the number of LEDs on the keyboard. Typically, you can set this to the same number as the number of keys on your keyboard, so that the LEDs will light up when you type.
- Save Configuration: Click on “Save” to generate a configuration file in Json format.
Design Keyboard PCB
Design Tool Introduction
When preparing the PCB for the keyboard, it’s worth mentioning JLC, a turnkey PCB manufacturer based in Shenzhen, China. JLC offers free PCB prototypes twice a month for boards up to 10cm by 10cm, which can save a lot of costs for enthusiasts. In addition to PCB manufacturing, JLC also provides professional design software called LCEDA.
The software shown in the picture above is the LCEDA. On the left side, there is a work area that lists all the electronic projects created before.
Don’t worry about the other options on the far left. The component library is the most commonly used feature and must be mastered.
To create a new project, click on “File” and select “New Project”. Then, create a new TLS 83 tutorial project.
Following my colleague’s instructions, select the frame using the left mouse button and press the DEL key to delete it. This will make your page clean. Then, look at the electrical tools column located in the upper right corner of the screen, as shown in the figure below:
Here are some tools that need to be used to draw schematic diagrams: the W key is used to draw wires, CTRL G is used for GND, and CTRL Q is used for VCC. In addition to labeling with a small “X”, there are no shortcut keys for these functions.
Draw the keyboard PCB schematic
Mechanical keyboards differ from traditional keyboards in that they use mechanical switches to control keyboard input. The printed circuit board (PCB) is a crucial component in realizing the keyboard’s functions, and the schematic diagram serves as a general control logic diagram for the PCB, indicating where the current enters and which components it flows into.
To begin, we must first import the 32U4. Next, we need to use the component library function. To access this function, click the component library button on the left-hand side of the interface. Then you can see the following interface:
In this interface we can search for the required PCB components, and then drag them into the schematic.
At this stage, we have various chip packages, such as AU and MU. The difference between them is that the pins of AU are outward, while the pins of MU are concealed within the chip. For beginners, I suggest choosing AU as it may be easier to solder.
To add the main control diagram to our schematic diagram, simply move the mouse outside the window and click on the main control diagram in the blank area. It will be automatically copied to our schematic diagram.
The horizontal lines on the left and right sides of the figure above represent pins
Schematic to PCB
Once the schematic diagram is complete, click on the design button located at the top of the software to convert the schematic diagram into a PCB design diagram. Alternatively, you can use the shortcut key Alt+P. This will enable you to create a keyboard PCB design diagram, as shown below:
The current design appears messy and incorrect, but there is no need to worry. Once we import the positioning board into the border layer and rearrange the components based on the schematic, it will work just fine. The revised design will look like this:
At this stage, your keyboard circuit board is almost complete. Here are a few points to keep in mind:
Before importing the positioning board, several settings need to be made after transferring to the PCB design. It is recommended to use mil as the unit of measurement.
Set the grid size to 93.752mil.
The grid size should also be set to 93.752mil.
The Alt grid size should be set to 5.906.
By moving the original in the PCB according to the distance of each grid in this unit, it becomes easy to center and align the components on the axis hole. This is a very efficient setting.
The process of placing components can be quite tedious, but using the layout transfer function (shortcut key: CTRL+SHIFT+X) can greatly improve efficiency.
While attempting to manually route the DIY keyboard PCB layout, I made a mistake. It should not be done this way.
During the PCB routing process, it is important to ensure that the distance between the two components under the type c port is as consistent as possible. Additionally, the lines coming out of D+D- should use differential pair wiring to keep the line length uniform.
In JLC’s design software, we can use shortcut keys to draw a line W to cut the top layer T and cut the bottom layer B. These are the most commonly used functions.
The 16MHZ crystal oscillator should be placed as close as possible to the main control and the length of the two wires should be kept as uniform as possible.
For example, after manually laying out the data lines and the crystal oscillator lines, we will lay copper on both the front and back sides. When laying copper, we choose the GND layer so that the GND lines disappear.
In the reserved island on the right side of the screen, we need to open a local routing program and then choose to ignore the routed lines for automatic routing. This will significantly increase the success rate.
Although the drawings produced by automatic routing may not be aesthetically pleasing, it is a convenient and reliable method. After routing is completed, we need to export the BOM file, which contains all the necessary information for the keyboard PCB components. We should follow the BOM when soldering and purchasing components.
Choose to generate the PCB GERBER file, which is a ZIP compressed package. Then, you can download an order assistant software from JLC and install it on your computer. After logging in, you can upload your GERBER file and choose the quantity, color, delivery method, and other options.
Draw the shell and dimensions of the keyboard
3D modeling software
When it comes to the drawing of the keyboard shell, we have to talk about the choice of 3D modeling software. After completing the modeling, you can take the file to the processing factory to start manufacturing the shell. Usually, the file format is either STEP or STL.
The most commonly used software in the industry for this design process is Solid Works, which is very powerful. Although its interface can be complex, it is easy to use, and the keyboard modeling is relatively simple, so TechSparks also recommends using it.
Basic size setting
- The positioning board needs to maintain a certain distance from the upper surface of the keyboard shell.
- The size of the bottom edge of a 1U keycap is approximately 18mm x 18mm.
- The dimension from the edge of the positioning plate to the edge of the side shaft hole is 3mm.
- The height of the overall keyboard’s upper shell should be controlled at 20mm as much as possible.
- Each positioning plate’s shaft hole measures 14mm x 14mm.
- The positioning plate is 1.5mm thick.
- When processing the positioning plate, the size of the shaft hole should be 14.1mm x 14.1mm.
- The distance between the PCB and the positioning board is 3.5mm.
- The PCB has a thickness of 1.6mm.
- For a hot-swappable PCB, the thickness is approximately 1.85±0.1mm.
Then if you are separating the key wires, there is a power terminal block on the PCB board.
|Applicable wire gauge
Manufacture of the keyboard case
Although you may not have used 3D printing technology, you must have heard of it, as it is widely used in various industries. With the advancement of technology, this method is no longer limited to materials such as resin, and now it can print precious materials such as metal and nylon. If we use this technology to make keyboards, it can be divided into two categories:
FDM: This stands for Fused Deposition Modeling. The primary materials used in this process are ABS and PLA. In simple terms, this refers to the process of layering. This technique produces a less refined product, and the tolerances will be large, requiring more post-processing on your part.
SLA: This refers to the technology of light-curing resin. It is strongly recommended that you use this technology when making your own keyboard. Compared to FDM, the accuracy of the finished product printed by SLA is higher, and it can achieve up to ±0.1mm precision.
CNC technology refers to the use of CNC milling machines for metal product prototyping. Unlike the stacking method used in 3D printing, CNC relies on the “subtractive” process of cutting metal materials with a cutter head to create the desired shape. However, due to the limitations of the cutter head, it may be impossible to create a perfect right angle at certain inner corners of the model. The smallest cutter head may have a diameter of 1mm, whereas the inner corner of a keyboard case is typically 0.5mm. Despite this, the inner corner may still appear as a right angle visually, and the impact on the final product may be minimal.
There are not many points to pay attention to in CNC machining technology because its accuracy can reach ±0.01mm. Basically, if your model meets the above-mentioned cutter head diameter, it can be perfectly realized by CNC technology. The assembly gap of CNC, if anodic surface treatment is done, is enough at 0.1mm for perfect assembly. However, it should be noted that if your keyboard model is too complicated, the processing cost may rise sharply because the cutter head comes in different sizes, and the subtleties are definitely more labor-intensive.
Component soldering and QMK flashing firmware
Generate HEX file
Before soldering components, you need to revisit the FIRMWARE BUILDER website and further customize the keyboard settings. This ensures that the ROW and COL pins mapped out in our schematic diagram match the configurations here. After that, generate a HEX file to flash the firmware.
The detailed process is as follows:
Open the PCB schematic diagram designed in JLCEDA software.
In the picture above, you can clearly see the circles and arrows I drew. ROW0-ROW5 corresponds to the pins of the main control chip, namely F0F1 F4F5F6F7. The pins corresponding to your COL0-COL16 are C7C6 D7-D0 B7-B1, which are actually the pins of your main control chip controlling all your rows and columns. Each pin controls one row or column, as I mentioned earlier. If you want to have RGB and CAPS LOCK lights, then your number of rows plus columns must be equal to 23 because the main control chip has only so many pins. Of course, if you are familiar with the Planck or Trump 10X10 matrix, you can save a lot of pins, but I haven’t studied that, so I won’t discuss it here.
After understanding the above information, you can log in to the keyboard firmware builder website, upload the JSON file you generated before, and go to the PINS page. There, you will see:
Right, as you have understood, on the PINS page, you can match each ROW and COL with the corresponding pins of the main control chip, and then select them from the drop-down menu.
CAPS LOCK corresponds to the key E6, while the bottom 2812 corresponds to B0, which is your LED string. At this point, most of the difficult problems have been solved, and now you can move on to the KEY MAP section.
To set the FN key, go to LAYER 1, which is the first layer, and set the reset key to FN+ESC for the reset function. Now, you need to set the keys related to lighting according to your preferences. In the QMK manual, the following are the key values related to lighting that I’d like to share with you:
- BL_TOGG: Backlight (shaft light) switch
- BL_DEC: Backlight dimming
- BL_INC: Backlight enhancement
- BL_STEP: Backlight step
- BL_BRTG: Backlight breathing
- RGB_TOG: RGB bottom light switch
- RGB_MOD: RGB bottom light mode switch forward. Hold shift and press RGB_MOD to switch backward.
- RGB_RMOD: RGB bottom light mode switch backward. Hold shift and press RGB_RMOD to switch forward.
- RGB_M_P: Static mode
- RGB_M_B: Breathing mode
- RGB_M_R: Rainbow mode, single color gradient
- RGB_M_SW: Rotation mode, rainbow gradient
- RGB_M_SN: Snake mode
- RGB_M_K: Knight Rider mode
- RGB_M_X: Christmas animation mode
- RGB_M_B: Static gradient animation mode
- RGB_M_T: Static three-color transient
- RGB_HUI: RGB hue addition
- RGB_HUD: RGB hue subtraction
- RGB_SAI: RGB saturation plus
- RGB_SAD: RGB saturation minus
- RGB_VAI: RGB brightness plus
- RGB_VAD: RGB brightness minus
To begin soldering components, export the BOM file from the design software and locate the components with the corresponding numbers on the PCB.
Firstly, tin the pad for the Type C port to make soldering easier.
Secondly, Be careful not to connect the tin on the main control board.
Lastly, add enough solder paste and let it melt completely. There should be no issues with the soldering.
After soldering the main control peripherals, such as the 100nf470nf crystal oscillator and the two 22 ohms on the C port’s side, plug in the C port to connect to the computer.
If your soldering is successful, the computer will recognize a new device in the device manager.
Next, you will need a software called ZADIG. Once you open the software, select “List All Devices” in the option toolbar and then choose the 32U4 entry in the drop-down menu.
Select “libusb win32” on the right, then click “Install” to install. Check the device manager again to confirm that the recognized hardware has become “ATMEL 32U4”.
Finally, use the QMK TOOLBOX software to flash the firmware. Though it may sound daunting, it is simply copying the HEX file to your chip.
Flash the firmware
Here we will be using the QMK TOOLBOX software. It should be noted that some users may have a standalone file of this software that can be double-clicked to run. However, if you encounter issues entering DFU mode, it is recommended to download and install the QMKTOOLBOX installation program from the official QMK website. During the installation, you will be prompted to install the necessary drivers, and it is important to select “yes”. This should solve any issues with entering DFU mode.
After plugging in the keyboard PCB and pressing the KEYSWITCH button, a line of yellow text will appear in the window indicating that you have entered DFU mode. Select the downloaded HEX file from the website in the LOCAL FILE column, and click FLASH to flash your firmware. Once the firmware is flashed, plug in the keyboard PCB and your work on the PCB part is basically complete.