← Back to Home

KB2040 Macropad (TinyUSB HID)

Overview

A 9-key macropad with a fader slider, built on the Adafruit KB2040 board. Features a multi-layer keymap system, OLED display for layer and status indication, and Adafruit TinyUSB for native USB HID communication. The device includes custom PCB design, mechanical housing, and companion software for volume control.

Hardware

Firmware

The firmware is written primarily in C++ (with some C components) and implements a multi-layer keymap system where each layer can have different functions mapped to keys, encoders, and the fader. The codebase uses Adafruit TinyUSB for USB HID communication, eliminating the need for Arduino's Keyboard.h library and providing better cross-platform compatibility. The OLED display shows the current active layer and system status, while RGB LEDs provide visual feedback corresponding to each layer's color scheme.

The firmware handles layer-aware logic for all inputs, including rotary encoders and the potentiometer/fader, which behave differently depending on the active layer, enabling flexible control schemes for different applications.

Software

A companion Python program (listener) runs on the host computer to intercept HID messages from the macropad's fader and translate them into system volume control commands. This allows the linear fader to directly control the computer's master volume, providing tactile hardware control for audio levels.

Features

Gallery

KB2040 macropad on desk
Close-up portrait of KB2040 macropad

Additional photos showing the OLED UI, encoder operation, and different layer configurations.

Code & Links

Firmware repository (GitHub)Volume control listener