Arduino Joystick
Arduino Joystick
2022 November update!
(same as 2021 November update!)
New V2.0 with updated code, new board that eliminates the USB cord, new connectors for easier channel connections. Solid 700+ frame rate showing in VRC instead of variable. You can use the same DIY instructions below or I build, program, test, and ship one to you for just $40 in the US!
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.
Version 1 from 2020
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 make your own:
Have Arduino IDE
Download the RCUSB4 zip
Extract the zip to your preferred documents area
Download the Arduino Joystick Library https://github.com/MHeironimus/ArduinoJoystickLibrary
Extract the zip to your preferred documents area
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.
Start Arduino IDE and open the RCUSB sketch
Plug in Arduino Micro into USB port
Select Tools>Board>Arduino/Genuino Micro
Select Tools>Port>Arduino Micro
Select the “Check” Verify button to compile the sketch
Select the “Arrow” Upload button to upload to the Arduino
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.
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.
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.
Type controller or USB game controller in your Windows search
Arduino Micro should show up as a controller
Properties>settings>calibrate and follow the prompts to calibrate the controller
Start VRC
In VRC Options>control options and check that it’s working 100% throttle/brake/steering and the other settings are as you like them
Enjoy!
Arduino USB joystick adapter for 4 channels
Thank you for your purchase!
1: Connect the adapter to your receiver, and the adapter to your PC. A notification of installing driver(s) could/should appear and happen automatically, like plugging in any USB device to your PC for the first time.
Channel 1: White/Red/Black like normal
Channel 2: White (in the "signal" pin position, same row as white from channel 1)
Channel 3: Red(in the "signal" pin position, same row as white from channel 1)
Channel 4: Black (in the "signal" pin position, same row as white from channel 1)
2: Transmitter setup
I recommend using a fresh model in your transmitter, with all the default settings to start. That way trims and exponential settings don’t interfere with set up. Make sure your EPA’s are set to 100% (or 150% on some radios) to give the full PWM signal range to the adapter and PC in calibration.
3: Calibration
The easiest way to get to calibration and confirm it is working is starting from the VRC game. In the VRC game select Options>Control Options>Calibrate, and it will take you out of the game to the USB controller calibration dialog. You can also type “controller” or “USB game controller” in your Windows search, select “Set up USB controller”, select the Arduino Micro (or Leonardo) controller, then Properties>settings>calibrate and follow the prompts to calibrate the controller.
4: Customize
You can go to the Options>Control Options>Customize menu and set the turn marshal and pit/refuel commands by clicking on those commands in the menu with your mouse while pressing the button/switch on your radio. It may take different combinations depending on your radio and which channels are mapped to switches/buttons, but there are many combinations that will work.
Thanks again, and Good Racing!
Gary Crowell