Wireless PC Joystick/Wheel Buttons

by AussieMakerGeek in Circuits > Arduino

9472 Views, 69 Favorites, 0 Comments

Wireless PC Joystick/Wheel Buttons

2020-05-15_17h15_23.png

I've been building up a new racing sim over the last few years and decided to go with a DIY Direct Drive steering wheel. While that project alone could be several instructables in itself, this is an instructable about making all of the buttons on the wheel wireless.

Why?

  • The DD wheel has unlimited rotations, so having wires going to it would be annoying.
  • No ability to route cables via the wheel shaft like in commercial wheels
  • I wanted to be able to easily swap wheels with different button configurations
  • Because I could :)

To a achieve the goal of wireless buttons we need to consider:

  • Power delivery
  • Wireless Connectivity
  • Reaction time/delay
  • Reliability

The following components were chosen to match this criteria:
Tx - Arduino Nano with Integrated NRF24 Module here or use a Generic Nano or Pro Mini + NRF24 Module
Rx - Arduino Pro Micro / Leonardo / Beetle (Atmega32u4) + NRF24 module
USB 'Battery Bank' - Any generic single 18650 battery bank should work. This will last approx 20 hours! You may want to check if it can charge and deliver power at the same time though. This is handy if it runs flat and you want to charge and use at the same time.

Additionally you will need the buttons and a power switch of your choice,some hookup wire and possibly some heat shrink tube.

This can also be used in a 'button box' instead of on a wheel but I figured there would be less demand for that since there's not much advantage if it does not move.

Tools needed:

Soldering iron and solder
A hot glue gun comes in handy for mounting the parts too.
Arduino IDE installed on your computer.

The Transmitter Wiring

2020-05-18_13h05_54.png
2020-05-15_17h09_09.png
2020-05-15_17h09_29.png
2020-05-15_17h11_35.png
2020-05-18_13h37_11.png

Start by mounting as many switches as you need on your wheel and consider the location of the Arduino. Connect all of the wires to the switches as per the diagram. Each button will be wired with one side to GND and the other to the associated arduino pin. The code allows for 14 switches/buttons which should be enough for most wheels.

If you use the Nano with the embedded NRF module, then obviously you don't need to add that associated wiring for that, just wire the buttons.

The buttons are in this order (1-14):
RX, TX, D2, D3, D4, D5, D6, D7, A0, A1, A2, A3, A4, A5

But why only 14 buttons?
The reason for this is because we can read a full bank of pins fast and only transmitting 2 bytes of data does not take long - So although this could be modified to include more buttons (via a matrix) and/or analogue inputs, this would slow things down a bit. Matrix reading and analog reads/conversion take processor time. I only needed 12 buttons on my wheel so I went with that but would consider adding more.

Power
For the power, you have two choices - You can either leave the battery bank in tact and just secure it to the wheel somehow. This gives you the added bonus of being able to disconnect the power from the arduino, avoiding having a built in switch and some wiring.

If you'd prefer a more custom solution, it may be necessary to crack open the battery bank and re-purpose the internals into your custom configuration.

I didn't have the room in my wheel to leave it in tact so it was stripped out. I removed the standard USB connector from the charge board and soldered the +5 and Gnd wires from the usb port pads to the Arduino via a switch. It's a bit hard to detail this because of the many options available...

The circuit was then mounted inside the wheel, exposing the micro USB charge connector.

The charge board will have one or more LEDs to display the charge status - It's handy to make these visible somehow or use some plastic to 'port' them to somewhere visible so that you know when it has finished charging.

What Wheel is that?
For those interested, my wheel design is by Amstudio - Some great DIY racing sim part designs are available from them at reasonable prices.

The Reciver

2020-05-18_13h06_15.png
2020-05-18_13h06_27.png
2020-05-17_18h59_03.png
2020-05-18_13h20_02.png
2020-05-18_13h19_53.png
2020-05-18_13h19_26.png
2020-05-18_13h19_45.png
2020-05-18_13h19_18.png
2020-05-18_13h19_04.png

Simply follow the wiring diagram as attached. If you are not using a Leonardo, you WILL need an external 3.3v regulator such as the AMS1117. The Pro Micro regulator can not provide enough current for the NRF24 Module and the beetle does not have one at all.

I have colour coded the connections to the NRF module the same for the Pro Micro and beetle.

The Arduino 'Beetle' which is pretty easy to find in the common places but once again, 3.3v regulator will need to be used as it does not have one at all. I have tested this and it works fine too. The connections are the same

Programming the Devices

2020-05-17_20h00_54.png
2020-05-17_19h56_10.png
2020-05-17_19h56_23.png
2020-05-17_19h57_08.png
2020-05-18_11h47_27.png
2020-05-18_11h49_18.png

If you do not already have the Arduino IDE installed head over to https://www.arduino.cc and download the version suitable for your operating system for this example I am on windows.

Once set up, you will need two different libraries - The first one is easy via Sketch -> Include Library -> Manage Libraries (or CTRL+SHIFT+I)

NRFLite by Dave Parson (version 2.2.2 as of publishing)

The second one will need to be manually installed from https://github.com/MHeironimus/ArduinoJoystickLibr..

Click on 'Clone or Download' then 'Download ZIP and open the downloaded file. You will then have to click through to the folders till you see a 'Joystick' folder - Copy that to your Arduino Libraries folder (On windows, this is usually Under Documents -> Arduino -> Libraries.

Restart the Arduino IDE

If you are using the Pro Micro for the receiver, you will also need to add that board to the IDE.
File -> Preferences -> Additional Boards Manager URLs:

enter: https://raw.githubusercontent.com/sparkfun/Arduino...

Then go to Tools -> Boards Manager, search Sparkfun and install 'Sparkfun AVR Boards'

Now we're ready! Lets start with the transmitter - Connect it to your PC

Under Tools -> Board, select 'Arduino Nano' (or whatever variant you decided to use). Also verify the COM port under the tools menu.

Open the attached Wireless_Wheel_Tx file.

There is only one line that you may want to change in this code and that is:

int nrfChannel = 22;

You have up to 126 channels you can use over the 2.4Ghz spectrum. It should be fine to leave as-is but if you find you have issues with reliability, perhaps change this to a different number.

Then just hit the 'upload' button and wait for it to finish.

The same goes for the Leonardo/Pro Micro/Beetle - Select the board you want - For Leonardo and Beetle, select the Arduino leonardo board. For the Pro Micro, select that and also select the variant/processor Atmega32u4 (5v, 16Mhz) , open the Wireless_Wheel_Rx file, change the nrfChannel setting (if you changed it on the Tx) and program away.

Once the device reboots on programming, your computer should detect a joystick device. If you power up your transmitter as well, you should be able to press the buttons and have it show up in the device status!

A cool incidental feature is that you will get a status light on the Leonardo and Pro Micro - The USB TX led will light up when it has connection to the buttons. This is not present on the beetle however.

UPDATED 13/2/2021

I have added 2 extra files (Tx and Rx) to the instructable here for a version with 4 Analog inputs as well as a 3X8 button matrix. Mostly untested, may have delay. Please try and comment.

Improvements

2020-05-18_14h08_37.png

Power LED
After using this solution for a little while I had a habit of accidentally leaving the wheel on. To help counter this, I added an LED to the front so I could see that the wheel was on. This is just a simple 3mm led run from the 5v on the arduino via a resistor. The top is sanded down to diffuse the light a bit and prevent glare.

Battery level meter
I purchased some battery level meters from BG or Ali but when they arrived they were a lot larger than what I was expecting but this is something I still want to add. There are many options available for this but because the battery lasts so long, I tend to just recharge after a few hours of use.

Extra buttons/encoders/analog inputs
Still thinking about this one. For me, it's not that important for the racing I do but for things like F1 it is probably more useful. I'll consider two versions or adding this if there is enough demand but this may impact the response time on the buttons.