A USB gamepad controller built with an Arduino Pro Micro, featuring 25 push buttons and 4 rotary encoders. Designed for sim racing and flight simulation, it is detected as a standard USB gamepad (HID joystick) with 33 buttons — no additional drivers required.
Tested and confirmed working with:
- Assetto Corsa / Assetto Corsa Competizione
- Microsoft Flight Simulator (2020 / 2024)
- Forza Horizon 4 / 5
Also compatible with any game or application that supports USB gamepad button mapping, including:
- iRacing
- Euro Truck Simulator 2 / American Truck Simulator
- Project CARS 2
- rFactor 2
- BeamNG.drive
- DCS World
- X-Plane
- And many more
| Component | Quantity | Notes |
|---|---|---|
| Arduino Pro Micro (ATmega32U4, 5V/16MHz) | 1 | Must be the ATmega32U4 variant for USB HID support |
| Momentary push buttons | 25 | Wired in a 5x5 matrix |
| Rotary encoders (with push button) | 4 | Standard quadrature encoders (e.g., KY-040) |
| Wires / PCB | — | For connecting the matrix and encoders |
| Enclosure | — | Optional, 3D printed or custom box |
The 25 buttons are wired in a matrix with 5 row pins and 5 column pins:
| Function | Pins |
|---|---|
| Row pins | 21 (A3), 20 (A2), 19 (A1), 18 (A0), 15 |
| Column pins | 14, 16, 10, 9, 8 |
Each rotary encoder uses 2 digital pins:
| Encoder | Pin A | Pin B | CCW Button | CW Button |
|---|---|---|---|---|
| Encoder 1 | 0 (RX) | 1 (TX) | Button 26 | Button 27 |
| Encoder 2 | 2 (SDA) | 3 (SCL) | Button 28 | Button 29 |
| Encoder 3 | 4 (A6) | 5 | Button 30 | Button 31 |
| Encoder 4 | 6 (A7) | 7 | Button 32 | Button 33 |
Note: Pins 0 and 1 are the hardware serial (TX/RX) pins. Using them for encoders means serial debugging via
Serial.print()is not available. This is fine for normal operation.
| Button Index (code) | Windows Button # | Source |
|---|---|---|
| 0 – 24 | 1 – 25 | Push buttons (5x5 matrix) |
| 25 – 26 | 26 – 27 | Encoder 1 (CCW / CW) |
| 27 – 28 | 28 – 29 | Encoder 2 (CCW / CW) |
| 29 – 30 | 30 – 31 | Encoder 3 (CCW / CW) |
| 31 – 32 | 32 – 33 | Encoder 4 (CCW / CW) |
Note: The Windows "Game Controllers" test dialog only displays up to 32 buttons. Button 33 still works in games — it just won't light up in the Windows test panel.
Arduino Pro Micro
┌──────────────────────┐
│ │
│ Pin 21 (A3) ────── Row 1 ┐
│ Pin 20 (A2) ────── Row 2 │
│ Pin 19 (A1) ────── Row 3 ├── 5x5 Button Matrix
│ Pin 18 (A0) ────── Row 4 │ (25 buttons)
│ Pin 15 ─────── Row 5 │
│ │
│ Pin 14 ─────── Col 1 │
│ Pin 16 ─────── Col 2 │
│ Pin 10 ─────── Col 3 │
│ Pin 9 ─────── Col 4 │
│ Pin 8 ─────── Col 5 ┘
│ │
│ Pin 0 (RX) ─────── Encoder 1A ┐
│ Pin 1 (TX) ─────── Encoder 1B │
│ Pin 2 (SDA) ────── Encoder 2A ├── 4 Rotary Encoders
│ Pin 3 (SCL) ────── Encoder 2B │ (8 virtual buttons)
│ Pin 4 (A6) ─────── Encoder 3A │
│ Pin 5 ─────── Encoder 3B │
│ Pin 6 (A7) ─────── Encoder 4A │
│ Pin 7 ─────── Encoder 4B ┘
│ │
│ GND ────────────── Common ground for all buttons & encoders
│ │
└──────────────────────┘
- Each button in the matrix connects one row pin to one column pin when pressed.
- Each encoder's common/ground pin connects to GND.
- Internal pull-up resistors are enabled in software — no external resistors needed.
- Arduino IDE (1.8.x or 2.x) — Download here
- Board package: Arduino AVR Boards (included by default)
- Required libraries (install via Library Manager):
- Keypad by Mark Stanley & Alexander Brevig
- Joystick by Matthew Heironimus
In Arduino IDE:
- Go to Sketch > Include Library > Manage Libraries...
- Search for Keypad and install it
- Search for Joystick and install it
Note: The Joystick library may not appear in the Library Manager. You can install it manually:
- Download from MHeironimus/ArduinoJoystickLibrary
- Extract to your
Arduino/libraries/folder- Restart Arduino IDE
- Connect the Pro Micro via USB
- In Arduino IDE, select:
- Board:
Arduino Leonardo(Pro Micro is Leonardo-compatible) - Port: Select the COM port that appears when you plug in the board
- Board:
- Open
ButtonBox/ButtonBox.ino - Click Upload
arduino-cli compile --fqbn arduino:avr:leonardo ButtonBox/
arduino-cli upload --fqbn arduino:avr:leonardo --port COM10 ButtonBox/Replace COM10 with your actual port.
- Open Control Panel > Devices and Printers
- Find Arduino Leonardo (it appears as a game controller)
- Right-click > Game controller settings > Properties
- Press buttons and turn encoders to verify they register
- Open your game's controller/input settings
- The device should appear as Arduino Leonardo or Joystick
- Map each button/encoder to your desired function
| Issue | Solution |
|---|---|
| Board not detected | Try a different USB cable (some are charge-only). Ensure it's a data cable. |
| Wrong COM port | Unplug and replug the Pro Micro. Check Device Manager for the correct port. |
| Upload fails | Double-tap the reset button on the Pro Micro within 8 seconds, then upload immediately. The bootloader COM port appears briefly. |
| Buttons not registering | Check your wiring matches the pin mapping above. Verify solder joints. |
| Encoder skipping/jittery | Ensure encoder pins are connected correctly (A to pin1, B to pin2). Try adding 100nF capacitors across each encoder pin to GND. |
| Button 33 not visible in Windows test | This is a Windows limitation (max 32 shown). The button still works in games. |
SimPanel-Button-Box-v1/
├── ButtonBox/
│ └── ButtonBox.ino # Main Arduino sketch
├── LICENSE
└── README.md
This project is open source and available under the MIT License.
- Built for the sim racing and flight sim community
- Uses ArduinoJoystickLibrary by Matthew Heironimus
- Uses Keypad Library by Mark Stanley & Alexander Brevig