Mechanical Keyboard PCB: DIY Custom Keyboard Tutorial

Compared to traditional keyboards, mechanical keyboards offer numerous advantages, such as superior tactile feedback, increased durability, and greater versatility. These benefits can be attributed in part to the use of PCBs as the central components that connect various parts of the keyboard, including key switches, LEDs, diodes, and microcontrollers.

For keyboard enthusiasts, designing a custom mechanical keyboard is an engaging and rewarding experience. Customizing the layout of the keyboard PCB according to individual needs can result in unique and personalized keyboards with tailored functions and aesthetics. In this article, FS Technology will present a comprehensive tutorial on manufacturing mechanical keyboards, starting with the PCB.

mechanical keyboard

Before the keyboard project starts


When embarking on a project, it is important to carefully consider the budget, as this will impact the selection of components and the overall complexity of the design. As a leading PCBA company, FS Technology offers the following tips for budgeting your project:

  • Establish a general budget: Begin by setting a realistic budget for the project, taking into account the cost of components and customization options.
  • Research component costs: Conduct research to determine the costs of various components. It is recommended to look for deals and discounts on reputable deals sites to save money. FS Technology provides component procurement services, ensuring that you get genuine products at competitive prices.
  • Determine the priority of components: Consider which functions are essential and which are optional to prioritize the PCB design and components. For example, if tactile feedback is a primary concern, consider investing more in high-quality key switches.

Tools and Materials

Before embarking on custom keyboard PCB design, it is essential to ensure you have the necessary tools and materials on hand. These include:

  • PCB design tools (such as Eagle, KiCad, or Altium)
  • A computer equipped with a USB port
  • Microcontroller (e.g., Atmega32u4 or STM32)
  • Key switches (such as Cherry MX or Kailh)
  • Diodes (one for each key switch)
  • Resistors (if LED is needed)
  • Capacitor (for stabilizing power supply)
  • LED (if required)
  • Soldering iron and solder
  • Multimeter (for testing connections)

Choosing the Right Mechanical Keyboard Components

Microcontroller Selection

  • Number of Keys: Determine the number of keys you need for your keyboard and ensure the microcontroller has sufficient input/output (I/O) pins to connect all the keys.
  • Communication Protocol: Verify that the microcontroller supports the communication protocol you intend to use, such as USB or Bluetooth.
  • Processing Power: Ensure that the microcontroller has sufficient processing power to handle the features you want to include, such as RGB lighting or a display.
  • Availability and Cost: Choose a microcontroller that is readily available and cost-effective. Popular microcontrollers for mechanical keyboards include the Atmel AVR, PIC, and STM32 series.
  • Community Support: Select a microcontroller with an active community of developers and users, which will help with programming and troubleshooting.

Key Switch Selection

Key Switch Selection​

Keyswitches are mechanical switches used to register keystrokes. Different keys have different characteristics of switches. When choosing, focus on factors such as tactile feedback, actuation force and noise level. The following are four different types of keys:

Linear: Smoother keystrokes without noticeable tactile bumps or auditory feedback, requiring only lighter keystrokes, such as Cherry MX Red.

Tactile: There is a tactile bump, when the key is activated, there is a clear feedback feeling, which requires a certain key force, such as Cherry MX Brown.

Clicky: Features tactile bumps and clicks that provide physical and auditory feedback, such as Cherry MX Blue.

Silent: The noise suppression design is used to provide a more silent tapping experience. Such as Cherry MX Silent Red.

Diode-resistor-capacitor Selection

Diodes play a crucial role in the functionality of a mechanical keyboard PCB. They prevent issues like ghosting and key chatter by ensuring that only one keystroke is registered at a time. To ensure compatibility with your PCB layout and key switches, it’s important to choose the right diodes. Popular options include 1N4148 and 1N4148W.

While not essential, resistors and capacitors can help to stabilize the power supply and reduce noise in your keyboard PCB. Additionally, if you plan to incorporate LEDs into your keyboard, resistors will be required to limit the current flow through the LEDs.

LED Selection

Mechanical keyboard LED

LEDs are a popular addition to custom keyboards as they can add a cool aesthetic and provide visual feedback. LEDs can be used to backlight specific keys or add RGB lighting to the entire keyboard. When choosing LEDs, it is important to consider their power consumption. RGB LEDs typically consume more power than monochromatic LEDs. Therefore, it is recommended to choose LEDs that consume a reasonable amount of power to avoid any issues with power supply stability.

How to make a custom keyboard PCB

Keyboard PCB Layout Design

  • Key placement: It is important to carefully plan the placement of keys to ensure ease of use. The key layout should be in accordance with the PCB layout.
  • Traces and Routing: The traces on the PCB should be designed carefully to avoid short circuits or crossovers, while minimizing interference and noise.
  • Signal Integrity: Signal integrity is critical to ensure proper functioning of the keyboard. Designing traces with the correct impedance, minimizing crosstalk, and ensuring proper grounding can help maintain signal integrity.
  • Component placement: Efficient and effective routing of traces depends on the placement of components, such as the microcontroller, key switches, and diodes, so it is important to plan their placement carefully.
  • Design rules: The keyboard PCB layout design should follow the manufacturer’s design rules, including trace width, spacing, clearance, and placement of drilled holes and vias.
  • DRC Check: Design rule checks (DRC) should be performed before sending design files to manufacturers to ensure that there are no errors or violations of design rules.

Traces and Routing

After customizing the circuit layout, the next step is to create the traces that connect all the components. These traces are the conductive paths on the circuit board that allow current to flow between different components, so the design should provide smooth current flow without any interference or noise.

To achieve this, it is recommended to follow these guidelines:

  • Shortest path principle: When laying out traces, ensure that these lines are the shortest possible, and check if there is a shorter route available. This helps to improve signal transmission speed and reduce signal distortion.
  • Avoid cross-interference: Line crossing can cause interference problems on the board, especially between digital and analog signals. To prevent this, keep the traces as far apart as possible, or use a ground plane to separate them.
  • Wider traces: Using wider traces with larger cross-sections in keyboard circuits reduces resistance, allowing circuits to handle more current flow and reducing the risk of overheating. A good rule of thumb is to use a trace width at least equal to the drill size of the via being used.
  • Signal direction: Ensure that the output direction of the signal is consistent during the design process to avoid any potential signal flow issues.

Component Soldering and Assembly

Soldering is a critical skill when customizing keyboard PCBA boards. To ensure a strong bond, proper soldering techniques should be used when attaching components to the board. Typically, flux is applied to the area being soldered, which is then heated with a soldering iron, and solder is applied to create a strong bond. It is essential to practice your soldering skills before attempting to solder the keyboard circuit board.

For users who need to manufacture keyboards in large quantities, FS Technology’s PCBA service is an excellent option. We offer a comprehensive range of services, from PCB manufacturing to PCB assembly, to meet all your needs.


  • Test each key: Use a software tool such as Keyboard Tester or Switch Hitter to verify that the computer is registering each key.
  • Test the key matrix: Use a software tool such as Aqua Key Test to test the key matrix by pressing multiple keys simultaneously and verifying that they are registered correctly.
  • Test the USB connection: Use a USB tester to measure the voltage and current being supplied to the keyboard to ensure proper connection and detection by the computer.
  • Test the LEDs (if applicable): Use a software tool such as LED Center to configure and verify the LED settings and ensure proper functioning.
  • Troubleshooting: If you encounter any unexpected issues during testing, perform a thorough check of the wiring, firmware, and USB connections to identify and resolve the issue. Common PCB problems include missing or improperly connected components, incorrect wiring, or faulty soldering.

How to DIY a mechanical keyboard


Mechanical keyboard casings can be manufactured from a variety of materials and sizes, including plastic, metal, acrylic, and wood, and are available in various styles and colors.

  • Plastic casings: Are produced using an injection molding process, where molten plastic is injected into a mold and then cooled and hardened to form the final keyboard case. The shape of the mold determines the final shape of the keyboard.
  • Metal casings: Can be created through stamping or milling processes, where a metal sheet is formed into the required shape and size. Machine tools are then used to weld or glue the individual parts together, creating a complete keyboard enclosure.

Choosing Keycaps

mechanical keyboard keycap
  • Keycap Profile: Refers to the shape and contour of the keycap, It can vary in height, curvature, and angle. The most common profiles include OEM, Cherry, SA, and DSA. Each profile has its own unique feel and aesthetic appeal, and it is important to choose the right profile for your custom keyboard based on your personal preference and typing style.
  • Keycap Color: It can significantly enhance the appearance and visual appeal of your custom keyboard. You can choose a single color for a minimalist look, or mix and match colors to create a more unique and eye-catching design. It is important to consider the color scheme of your keyboard PCB and the surrounding environment to ensure that the keycaps blend in harmoniously.
  • Keycap Legends: Refer to the labels or symbols that are printed or engraved on the keycaps. You can choose to have legends that match the standard layout, or customize them to suit your specific needs, such as including additional function keys or symbols. The keycap legends should be clear and easy to read, and they should not wear off easily with prolonged use.

Microcontroller Programming

The microcontroller in a mechanical keyboard typically consists of a single-chip microcomputer that can be programmed to perform certain functions and map them to the microcontroller. This enables the keyboard to recognize key inputs and send them to the computer.

To program the microcontroller, open source firmware such as QMK Firmware or TMK Firmware can be used. These firmware provide various functions and interfaces, enabling programmers to customize keyboard mappings, macros, layers, and other features.

Modifying Firmware

In addition to programming the microcontroller, it may also be necessary to modify the firmware of the keyboard to add new features or enhance performance. Firmware is the software that controls the keyboard’s behavior, and it can be customized through the use of compatible firmware programming tools such as QMK Toolbox or Bootmapper Client. These tools connect the computer to the keyboard microcontroller, allowing for the writing of custom firmware that can be burned into the microcontroller.

However, before modifying the firmware, it is important to have a thorough understanding of the circuit schematic diagram, as well as the technical specifications and model of the microcontroller used by the keyboard. It is also worth noting that modifying the firmware of a purchased mechanical keyboard may result in the loss of warranty rights, so caution is advised.


To incorporate LED functionality into a keyboard, two methods can be utilized, namely surface mount and through hole, both of which are applied to the PCB board.

  • Surface mount: Involves soldering the LED directly onto the circuit board’s surface via SMT assembly, typically utilized for RGB backlight effects. This method requires wiring to connect the LEDs to the microcontroller or firmware for programming to produce different lighting patterns. While wiring, it is essential to ensure proper polarity and resistance matching to prevent overcurrent damage to the LED.
  • Through-hole:  Is accomplished by inserting the LED into a metal socket with pre-drilled holes, requiring holes to be drilled in the PCB to fit the metal socket. This method is usually used to realize single-color LEDs and backlight strips.


If you already have a mechanical keyboard but need to upgrade it due to a fault or desire a better experience, it may require desoldering the components and soldering new ones or even replacing the entire PCBA board if it is a severe failure problem. Desoldering can be accomplished through two methods:

Melted Solder Joint Method: Use a soldering iron or heat gun to heat the solder joint until it melts, then remove the component from the PCB.

Hot Air Blowing Method: Use a special heat gun or hot air gun to direct hot air onto the solder joints to melt the solder and reduce the welding force. Then, use a solder wick or aspirator to remove the solder, and detach the assembly from the PCB.


What other projects can be done besides DIY keyboard PCB board?

The realm of electronics is vast and mysterious, and with just an idea, you can attempt to DIY any electronics project. A plethora of electronics projects for hobbyists are featured under the DIY PCBA board of FS Technology. These projects are contributed by our customers. If you have an intriguing project to share, kindly send us your content via email.

In what ways can FS Technology help readers?

FS Technology is a Shenzhen-based PCBA company that offers meticulous services and assists enthusiasts in realizing their DIY projects. If you encounter any difficulties in manufacturing keyboard PCBs, please don't hesitate to contact us. Our team of designers will be more than willing to assist you.

Does FS Technology provide keyboard PCBA service?

Our primary focus is on the PCBA business, including the manufacturing and assembly of various consumer electronics PCB. We have extensive experience in supporting electronics manufacturers in this field, including those specializing in children's watches, mobile phone circuit boards, and other consumer electronics products. If you have any needs in these areas, please don't hesitate to contact us for assistance.

Related Blogs

Arduino UNO Interrupt Timer

Arduino UNO Interrupt Timer The Timer is a feature embedded in every microcontroller and has certain functions regarding the passage of time. The Timer function

Read More »

We'd love to hear from you