Skip to content

ishaanpilar/SimPanel-Button-Box-v1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SimPanel Button Box v1

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.

Supported Games

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

Hardware Requirements

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

Pin Mapping

Button Matrix (5x5)

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

Rotary Encoders

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 Numbering (in Windows)

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.

Wiring Diagram

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.

Software Setup

Prerequisites

  1. Arduino IDE (1.8.x or 2.x) — Download here
  2. Board package: Arduino AVR Boards (included by default)
  3. Required libraries (install via Library Manager):
    • Keypad by Mark Stanley & Alexander Brevig
    • Joystick by Matthew Heironimus

Installing Libraries

In Arduino IDE:

  1. Go to Sketch > Include Library > Manage Libraries...
  2. Search for Keypad and install it
  3. Search for Joystick and install it

Note: The Joystick library may not appear in the Library Manager. You can install it manually:

  1. Download from MHeironimus/ArduinoJoystickLibrary
  2. Extract to your Arduino/libraries/ folder
  3. Restart Arduino IDE

Uploading

  1. Connect the Pro Micro via USB
  2. 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
  3. Open ButtonBox/ButtonBox.ino
  4. Click Upload

Upload via Arduino CLI

arduino-cli compile --fqbn arduino:avr:leonardo ButtonBox/
arduino-cli upload --fqbn arduino:avr:leonardo --port COM10 ButtonBox/

Replace COM10 with your actual port.

Testing

Windows

  1. Open Control Panel > Devices and Printers
  2. Find Arduino Leonardo (it appears as a game controller)
  3. Right-click > Game controller settings > Properties
  4. Press buttons and turn encoders to verify they register

In-Game

  1. Open your game's controller/input settings
  2. The device should appear as Arduino Leonardo or Joystick
  3. Map each button/encoder to your desired function

Troubleshooting

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.

Project Structure

SimPanel-Button-Box-v1/
├── ButtonBox/
│   └── ButtonBox.ino    # Main Arduino sketch
├── LICENSE
└── README.md

License

This project is open source and available under the MIT License.

Credits

About

Arduino Pro Micro USB gamepad button box for sim racing & flight sim — 25 buttons + 4 rotary encoders. Works with Assetto Corsa, MSFS, Forza Horizon, and more.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages