back to home

ruiqimao / keyboard-pcb-guide

Guide on how to design keyboard PCBs with KiCad

4,824 stars
314 forks
22 issues

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing ruiqimao/keyboard-pcb-guide in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/ruiqimao/keyboard-pcb-guide)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

Keyboard PCB Guide So you want to make a PCB for a keyboard? Don't know where or how to start? Well you've come to the right place! Table of Contents • Setting Up • Schematics • Associating Components and Footprints • Generating Netlist • PCB • Component Placement • Edge Cuts • Routing • Mounting Holes • Production • Gerber Files • Manufacturer • Components Setting Up We're going to need KiCad. Download it, install it, and you should be ready to go! ... almost. We're going to want some libraries, too. I like to use Hasu's keyboard_parts component library and footprint library. /u/techieee also has a good switch footprint library. Download all of these and we should be good to go! Make sure you also have the official KiCad libraries as well. Those should be included with your KiCad installation. Schematics Start up KiCad and create a new project (File > New Project > New Project). Name the project whatever you want. For the purposes of this guide, I'll be calling it "example". Very creative, I know. We'll start by designing our schematics. Double click on your file and you should be greeted with an empty schematic sheet: Let's add our component library. At the top of the window, click on Preferences > Component Libraries. Then, click on "Add" and find the file from Hasu's library. Scroll down to the bottom of the component library list and find the library you just added. We want to move that to the top of the list, so your list should look like this: Click "OK" and we're ready to go. We're about to get real technical here, so buckle up. To start off, here's a list of basic commands: Do Place > Component. Your cursor should turn into a pencil. Click anywhere on the sheet. Look for in the keyboard_parts library: Click OK, then click on the schematic sheet again to place the component. This is our controller. Edit the component and change the reference from "U?" to "U1". This is the unique name that we're going to use to refer to this particular component. The next part we'll want to place is the crystal, which is the part that tells the controller how fast to run. Look for the component and place it next to the controller. Change the reference to X1. Next, we're going to want to add 2 decoupling capacitors ( ). These capacitors will basically help prevent the signal to the controller from accumulating too much noise. There's a formula for determining the capacitance you need for these capacitors, but for now, we'll use a crystal with 18pF load capacitance, so these decoupling capacitors will be 22pF. Name them C1 and C2, and change their values to 22p. Also add a GND symbol to represent ground, and connect everything using the wire tool (green line on the right) like so: Next, we'll add decoupling capacitors for VCC, our power source. We will generally want one 0.1uF capacitor for each VCC/AVCC on the controller and one 4.7uF capacitor for UVcc. In our case, we want 4 0.1uF capacitors and 1 4.7uF capacitor, like so: Let's hook up a reset switch. For this, you'll want a switch ( ) named SW1 and a 10k resistor for pullup ( ) named R1. If you want to know why we want a pullup resistor and what a pullup resistor even means, here is a good explanation from Sparkfun. But for now, here's how it should be hooked up: Now let's put a 10k resistor named R2 on HWB/PE2 pin and connect it to ground. We want a resistor here because it tells the microcontroller that when we press the reset button, we want to go into the bootloader so that we can flash a new layout onto it! Next, let's add our USB port. Add the component from the keyboard_parts library and call it J1. Connect VUSB to VCC and Uvcc, and put two 22 ohm resistors R3 and R4 between the D- and D+ connections. Connect GND and SHIELD together and connect them to ground. And lastly, put a 1uF capacitor C8 between UCap and GND: Let's connect all the VCC connections together and all the GND connections together. Normally, you would place a capacitor between AVCC and VCC if you were using the built-in ADC (analog to digital converter), but we don't care about that for a keyboard, so just directly connect them. Here's what everything look like at this point: Now let's build our switch matrix. For the purposes of this guide, we're simply making a nice and easy 2x2 matrix. We're going to want to use the and components for our switch and diode components, respectively. Just connect them like you would a handwired board, and don't forget to name them. K1 should correspond to D1, K2 should correspond to D2, and so on: Now we want to connect this matrix to the controller. We'll use labels for ease (A with a green line underneath on the right). For our example board, we'll use PF0 for row0, PF1 for row1, PF4 for col0, and PF5 for col1: Finally, let's label all the unused pins as not connected. Use the no connect tool (blue X on the right) and click on all the unconnected pins on the controller and the ID pin on the USB port. This is also a good chance to make sure you didn't miss any VCC or GND pins earlier! Our final schematic should look like this: Associating Components and Footprints We have to tell KiCad what each of these components means. Click on the icon for CvPcb at the top: If this is your first time running CvPcb, we're going to need to add the footprint libraries we downloaded earlier. Click Preferences > Footprint Libraries, and in the window that shows up, use the "Append with Wizard" button to add the "keebs.pretty" and "keyboard_parts.pretty" folders that we downloaded earlier. You may also need to manually add the built-in KiCad libraries. Your list of libraries should look something like this now: We're going to assume that all of our capacitors and resistors are 0805 imperial size. Our ATmega32U4 is going to be in a TQFN package. We're going to use the very handy hybrid through-hole and surface mount footprint from Hasu's library for our diodes. Switches are going to be /u/techieee's 1u switch footprint. The c…