Arduino Joystick

Arduino Joystick

I race a simulator for R/C cars called VRC Pro (Virtual Radio Control). It is a very faithful and complex simulation of R/C car racing. The sim allows you to use your real life radio control transmitter and receiver by the use of a dongle that plugs into the USB port of your computer. Unfortunately, the official VRC dongle went out of production due to permanent supply issues: https://www.vrcworld.com/news.aspx?type=none&y=2019&m=1&id=1833

So no official dongles were available anymore, and even some of the 3rd party adapters went out of stock, like the MHW and 9-turbo. VRC did team up with 9-turbo to sell them for 60 Euros after some time: https://www.vrcworld.com/eshop/product.aspx?241 . With all the delays and costs a DIY option was looking good, just in case I need a replacement for my older original VRC dongle.

I was contacted by Joel (another VRC racer) with the idea of using an Arduino Micro (USB enabled dev board). I thought this was a great idea and ordered one right away. A week later I got my board, but it took a couple days to get the time to get the code and libraries set up and uploaded to the Arduino. It loaded up just fine, and after clearing up some confusion on the pinouts used to connect to the receiver, things got up and running quickly. After calibrating the USB Controller (the Arduino Micro) in Windows, I started playing VRC as normal. The first thing I noticed was the sample rate for the controls were higher, which allows for quicker reaction and better feel on the track.


2020 Update: Interesting change: I was looking at the RCUSB4 code and saw that there was "delay(8);" in the void loop, which in Arduino means 8 milliseconds every time it goes through the loop looking for control inputs. I changed this to "delay(1);" and went from resting 100 fps control inputs/230 fps control inputs to resting 400 fps and 700 fps with control inputs. Resting means just sitting there, control inputs means wiggling throttle + steering quickly. The original VRC USB dongle would stay around 60-80fps and going to the Arduino joystick at 100+fps felt better. 30 minutes ago I made this change so it's a bit early to tell if there's any difference. I want to say it feels more responsive and smoother, just in the 20 minutes of practice I've had so far. It's safe to say that the change takes the Arduino joystick bottleneck out and puts it firmly on the radio side.

2020 Update #2: I never have used the 3rd and 4th channels, even though they are in the code. I race right at the computer and rarely crash too ;) I finally hooked them up because there have been many questions about them lately. All it took was scaring up the jumper wire and connecting Ch3 and Ch4 on the RX to the D1 and D0 ports on the Arduino (the next two in line with the D2 and D3 already used for channel 1 and channel 2). Then you need to calibrate in Windows to show it that you have those inputs, and go to the Control Options>Customize in the VRC menu to tell it which channels you want for steering, throttle, etc. The popular options to change will be the "turn marshal" and "refuel" for quick turn marshalling and quick pit stops without slapping the keyboard or missing the default L key. Whether you have a 3 or 4 channel radio and what the settings will be to tickle VRC controls will depend on the radio, of course.

2020 Update #3: I note that I use an Arduino Micro (actually a Micro SS - not from Arduino) but I should say that the Arduino you use must have the ATmega16U4/ATmega32U4 microcontroller to work. These include the Micro, Leonardo, Micro SS, Pro Micro, etc

Link to the original project: https://kekse23.de/2017.02.22/778/diy-rc-usb-adapter-fuer-vrc-pro/ (this is where the RCUSB files came from)

Here is another link to the RCUSB folder: https://drive.google.com/drive/folders/1HIwaj1XJrNql6Rqe_d6EsVy2A4UVJ6G8?usp=sharing

How to:

  1. Have Arduino IDE
  2. Download the RCUSB4 zip
  3. Extract the zip to your preferred documents area
  4. Download the Arduino Joystick Library https://github.com/MHeironimus/ArduinoJoystickLibrary
  5. Extract the zip to your preferred documents area
  6. Add the Joystick library from the ArduinoJoystickLibary folder. I did this by copying the Joystick folder and pasting it into the Libraries folder of my Arduino documents.
  7. Start Arduino IDE and open the RCUSB sketch
  8. Plug in Arduino Micro into USB port
  9. Select Tools>Board>Arduino/Genuino Micro
  10. Select Tools>Port>Arduino Micro
  11. Select the “Check” Verify button to compile the sketch
  12. Select the “Arrow” Upload button to upload to the Arduino
  13. Connect a 2-pin battery lead or a 3-pin standard servo lead to the 5V and GND pins on the board. Red wire to 5V and black to GND. Connect the other end to the RX, with black to GND and red to “+”, this will power the receiver, no other red/black/+/gnd connections should be made.
  14. Connect to the D3 pin on the board with just the white wire end of the next servo lead, and connect the other end as normal to CH1 of your receiver.
  15. Connect to the D2 pin on the board with just the white wire end of the next servo lead, and connect the other end as normal to CH2 of your receiver.
  16. Type controller or USB game controller in your Windows search
  17. Arduino Micro should show up as a controller
  18. Properties>settings>calibrate and follow the prompts to calibrate the controller
  19. Start VRC
  20. In VRC Options>control options and check that it’s working 100% throttle/brake/steering and the other settings are as you like them
  21. Enjoy!