USB to PS/2 Keyboard and Mouse Converter for Raspberry Pi Pico
Hecate is a firmware for the Raspberry Pi Pico (RP2040) that converts USB keyboards and mice to PS/2 protocol. It allows you to use modern USB peripherals with vintage computers and systems that only support PS/2 input devices.
Named after Hecate, the ancient Greek goddess of crossroads and liminal spaces. Just as Hecate stands at the intersection of worlds, this project bridges the gap between modern USB devices and legacy PS/2 systems—a converter standing at the crossroads of old and new technology.
- Triple USB ports - Native Type-C plus dual PIO-USB ports
- Hybrid USB mode - Use Type-C and PIO-USB simultaneously
- USB hub support - Connect multiple devices via hub on any port
- HID report parsing - Supports both boot protocol and full HID report descriptors
- NKRO support - N-Key Rollover for gaming keyboards
- Full Scancode Set 2 - Complete key mapping including all standard keys
- Extended keys - Navigation, multimedia, and special keys with E0 prefix
- Key repeat (typematic) - Configurable repeat rate and delay
- LED feedback - Caps Lock, Num Lock, Scroll Lock sync with host
- Host commands - Reset, Echo, Identify, Set LEDs, Set Typematic Rate
- Special sequences - Proper Pause/Break and Print Screen handling
- Standard 3-button mouse - Left, right, middle buttons
- IntelliMouse - Scroll wheel support (auto-detected)
- IntelliMouse Explorer - 5-button support (auto-detected)
- Stream and Remote modes - Automatic mode detection
- Host commands - Reset, Get ID, Enable/Disable streaming, Read Data, Status request
- Connection indicator - LED on when keyboard or mouse is connected
- Activity indicator - LED blinks on keypress or mouse button click
- RP2040-Zero RGB - Green when connected, blue flash on activity
- Pico onboard LED - On when connected, blinks on activity
| Function | GPIO | Description |
|---|---|---|
| UART TX | GPIO 0 | Debug serial output |
| UART RX | GPIO 1 | Debug serial input |
| PIO-USB0 D+ | GPIO 2 | PIO-USB Port 0 Data+ |
| PIO-USB0 D- | GPIO 3 | PIO-USB Port 0 Data- |
| PIO-USB1 D+ | GPIO 4 | PIO-USB Port 1 Data+ |
| PIO-USB1 D- | GPIO 5 | PIO-USB Port 1 Data- |
| PS/2 KB DATA | GPIO 11 | Keyboard Data line |
| PS/2 KB CLK | GPIO 12 | Keyboard Clock line |
| PS/2 MS DATA | GPIO 14 | Mouse Data line |
| PS/2 MS CLK | GPIO 15 | Mouse Clock line |
| WS2812 LED | GPIO 16 | RGB LED (RP2040-Zero) |
| Native USB | Type-C | Native USB host port |
- Onboard LED on GPIO 25
- Build with default settings
- WS2812 RGB LED on GPIO 16
- Build with
-DUSE_WS2812=1
cmake -DUSE_WS2812=1 ..- Pico SDK installed
PICO_SDK_PATHenvironment variable set- ARM GCC toolchain
mkdir build
cd build
cmake ..
make -j4The firmware will be generated as build/hecate.uf2.
- Hold the BOOTSEL button on the Pico
- Connect to USB while holding BOOTSEL
- Release BOOTSEL - the Pico appears as a USB drive
- Copy
hecate.uf2to the drive
Or use the included flash script:
./flash.shTo create a release build with version tracking:
./release.shRelease files are saved to the releases/ directory with version numbering (e.g., hecate_1_00.uf2).
UART serial console is available on GPIO 0 (TX) and GPIO 1 (RX) at 115200 baud. Connect a USB-to-serial adapter to view debug messages.
PS/2 uses open-drain signaling. The DATA and CLK lines should be directly connected to the Pico GPIO pins. The Pico's internal pull-ups are not used; the PS/2 host provides the pull-ups.
PS/2 Connector (female, from device side):
6 5
4 3
2 1
Pin 1: DATA
Pin 3: GND
Pin 4: +5V
Pin 5: CLK
Pin 6: N/C
Each USB port requires D+ and D- connections. The D- pin is always D+ pin + 1.
For a USB Type-A connector:
- Pin 1: +5V (VBUS)
- Pin 2: D-
- Pin 3: D+
- Pin 4: GND
MIT License - See LICENSE file for details.
This project incorporates code and concepts from:
-
ps2x2pico by No0ne - PS/2 protocol implementation and PIO programs
- Copyright (c) 2024-2025 No0ne
- Copyright (c) 2023 Dustin Hoffman
- Licensed under MIT License
-
pico-hid-host by Fruit-Bat - HID report descriptor parsing library
- Copyright (c) 2024 Fruit-Bat
- Licensed under MIT License
-
Pico-PIO-USB by sekigon-gonnoc - USB host implementation using PIO
- Licensed under MIT License
-
TinyUSB by Ha Thach - USB stack
- Licensed under MIT License
-
Raspberry Pi Pico SDK - Hardware abstraction layer
- Licensed under BSD 3-Clause License