WORK IN PROGRESS
Rather than fumbling around on your keyboard Button Boxes are a simple and accessible extension to your steering wheel.
This button box provides 13 push buttons, 4 encoders and 4 two way switches which pairs with an Arduino Pro Micro or Arduino Leonardo gives you 33 possible controls you can pass to your computer. The great thing about these Arduino boards is that they utilise the ATmega32u4 chip allowing the board to appear to a connected computer as a mouse and keyboard – perfect for this task.
In addition to the printed parts I used the following.
- AITRIP 4-Pack Pro Micro ATmega32U4 5V 16MHz Micro USB Development Board
- RUNCCI-YUN 7pcs 12mm Waterproof Momentary Push Button Switch Packs.
- Taiss/10pcs Toggle Switch ON/OFF/ON
- AZDelivery 5 x KY-040 Rotary Encoder Module
- ElectroCookie Mini PCB Prototype Board (Optional)
- Terminal Block Connector,10pcs/set 12 Pin (Optional)
The Circuit and Wiring.
Rather than connect each switch option to the Arduino directly, which would need 33 inputs we are going to use a 5×5 matrix. Using a matrix we can encode a larger number of inputs using fewer pins in this case we can use 10 inputs for the basic switches + 8 additional ones for the encoders.
|ROW||COL||1: Black (9)||2: Grey (8)||3: Black (14)||4: Grey (16)||5: Black (10)|
|Push But 1||Push But 2||Push But 3||Push But 4||Push But 5|
|Push But 6||Push But 7||Push But 8||Push But 9||Push But 10|
|Extra Push Button?||Encoder 1 (6/7)||Encoder 2 (4/5)||Encoder 3 (2/3)||Encoder 4 (TX1/RX2)|
|Push But 11||2Way 1A||2Way 1B||2Way 2A||2Way 2B|
|Push But 12||2Way 3A||2Way 3B||2Way 4A||2Way 4B|
For the code we will need to have a working Arduino compatible IDE. This can be the simple Arduino IDE or via Visual Studio Code. We are going to use the Joystick Library by Matthew Heironimus and the Keypad Library by Mark Stanley and Alexander Brevig. The later can be installed via the Arduino Library Manager with the former needing to be downloaded from the GitHub link and installed as advised on the GitHub page.
There is a detailed explanation on Matthew’s Joystick Library Wiki but a quick test can be achieved by typing joy.cpl into the search box on Windows and then clicking properties after selecting your device.
Choosing what to map to your button box.
For reference, on my wheel I have:
|DRS||PUSH 2 TALK||TEAR OFF||BOOST|
|PIT LIMITER||BR. BIAS –||BR. BIAS +||EXIT|
|LEFT 8WAY ENCODER >||UNUSED||RIGHT 8 WAY ENCODER >||BLACK BOX|
|ADJ –||CHAT SORRY||CHAT THANKS||ADJ +|
Leaving the following options on the Button Box.
|PUSH A||PITS IN||FULL PIT|
Tyres + 50L
|PUSH B||PITS OUT||Use Free Repair||CLEAR TYRES||-5L|
|ENCODERS + PUSH C||Unused||Unused||Unused||Unused||CHAT |
|TOGGLE A + PUSH D||TOGGLE|
|FLASH LIGHTS||X||SHOW CAM||CENTRE HMD|
The original inspiration and incomplete source code was sourced from Hobbylex’s Sim Racing Button Box on Instructables although I also referenced Arduino Forum threads #1 & #2 where there is a reference to AMStudios.