In early July, Seeed Studio launched the Seeed Fusion DIY XIAO Mechanical Keyboard Contest. The goal of the contest was to enable people to design and assemble their own mechanical keyboards using Seeed Studio’s PCB manufacturing and assembly services. Contestants were also encouraged to use Seeed’s XIAO boards (SAMD21, RP2040, nRF52840, and ESP32C3) in their designs. I immediately started gathering information about mechanical keyboards and evaluating the right microcontroller for my design. I decided to create a simple macro pad with a few keys instead of a full keyboard.
PCB DesignThe design features a PCB using the XIAO RP2040, based on Raspberry Pi's microcontroller. The circuit has nine MX keys arranged in a 3x3 matrix, which saves IO pins for additional functions. The design also includes a rotary encoder for volume control or zoom. Each key is backlit with a WS2812 RGB LED. Considering the various switch types available, I opted to use hot-swap sockets instead of soldering the switches directly to the board. I also added Truchet tiles designs to the board.
The contest guidelines required me to generate Gerber files for manufacturing and assembly files with component positions and BOM. I uploaded everything to Seeed Studio's Fusion website and received confirmation after the files were reviewed. Seeed Studio's support then sent me a discount coupon for the full cost of the PCBs and assembly, making it free of charge. Seeed Studio recommended using parts from the Open Parts Library for faster assembly times, but the SK6812 MINI-E LEDs I used for reverse mounting were not on the Open Parts Library. However, Seeed Studio was able to find and add the parts with the part number and reference PDF.
While waiting for the PCBs, I ordered the other parts and worked on a case design. I used Eagle's tool to export the 3D models to Fusion 360 and created a case based on the PCB model. The case has a base with M2.5 screws to fix the PCB and holes for the XIAO's USB-C port and RESET/BOOT buttons. The cover has holes to pressure-fit the switches and protect the internals. The parts were 3D printed using resin for better resolution, finish, and the option of transparent cases to show the circuit and RGB LEDs.
The PCBs, switches, and printed parts arrived on time, and I was impressed with the quality and detail of the assembled PCBs. After soldering the hot-swap switches and encoder, I tested the keyboard. I connected the XIAO RP2040 to a computer and used a basic MicroPython program to turn on the LEDs and detect key presses.
After confirming that the circuit was working properly, I fixed it to the 3D printed base, being careful not to break the resin while screwing. I then placed the cover and pressed the switches into place, making sure the pins made contact with the hot-swap switches. The base and cover are held together by pressure and switch connections, but glue can be added for additional security. The next step was to write the final program for the XIAO RP2040 and set up the function of each key.
Firmware and ConfigurationI chose KMK as the firmware, as it's based on CircuitPython and easy to set up. CircuitPython installation is straightforward, and Adafruit has a helpful tutorial. The KMK installation is shown at KMK's Getting Started page.
It's worth noting that all XIAO boards are pin compatible, so the MacroBoard could be used with any XIAO board that supports CircuitPython and HID USB.
The project files, including the schematic, 3D models, and firmware, can be found on the GitHub repository.
Comments