Arduino USB adapter for connecting a real analog slot car controller to PC (game Virtual SlotCars).
- Use an analog slot car controllers with a resistor. But do not connect electronic or digital slot car controllers, they can be destroyed.
-
Not all Arduino types can be used! Arduino Pro Micro Sparkfun clone 5 V 16 MHz used (costs less than EUR/USD/GBP 10,-).
- For a complete list of compatible boards see the 'supported boards' file. https://github.com/dmadison/ArduinoXInput/blob/master/extras/SupportedBoards.md
-
27 Ohm resistor, use minimal a 1 Watt type not a common 1/4 Watt.
-
Two linear potentiometers 10k Ohm with knobs or 5k Ohm as alternative, only to calibrate (crop) the input range between brake and full throthle. The actual brake settings for Virtual SlotCars are still set ingame (B + up/down arrow keys per lane). However the default 50% brake is good to go.
-
USB A to Micro USB cable used 1 meter / 3 feet.
- Cable clamp for USB cable (for example from an AC mains power connectors)
- Plastic plate for mounting the cable clamp on 6 mm / 2/8 inch thick.
- Rubber cable grommet for USB cable protection. Large enough to pull over the micro USB connector.
-
Soldering iron with fine tip, if you don't have one you can wrap some copper wire tightly around it and cut it off at an angle to make a fine tip.
-
Casing used 10 x 6 x 2.5 cm / 4" x 2.5" x 1" (l x w x h).
-
Connector(s) for your slot car controller.
-
Thin stranded copper wire various colors used to simplify problem solving.
-
Circuit diagram
-
Install the free Arduino IDE on your PC https://www.arduino.cc/en/software/
-
Open the IDE program and install the free Xinput library
-
Always install the core board package
-
Download ArduinoXinput_AVR_v.zip board package https://github.com/dmadison/ArduinoXInput_AVR/releases/latest
-
Unzip, copy and move xinput as direct subfolder in the hardware folder of your IDE installation, see screenshot:
-
-
Also install the specific board package if you don't use an original Arduino
-
Download Code .zip board package (Sparkfun used) https://github.com/dmadison/ArduinoXInput_SparkFun
-
Unzip, copy and move xinput_sparkfun also as direct subfolder in the hardware folder, see screenshot:
-
Delete the folder "ArduinoXinput_Sparkfun-master" with the remaining content. It comes with the download but doesn't belong anywhere.
-
-
Restart the IDE
-
Select the used board w/Xinput, processor and port
-
Download the code from this page and open the sketch file slotcar_controller.ino in a text editor
-
Connect a USB A to Micro USB cable from you PC to your Arduino
-
Before you can upload the sketch from the IDE to your Arduino you need to mention the following:
- After you pressed the Upload button and uploading of the sketch just starts you allways need to make a short (time) connection between the reset (RST) and ground (GND).
- You can use a piece of wire for this, temperory soldered to the RST pin and touch the other side of the wire to GND.
- On an original Arduino Micro there is a white reset button for this. But that you will have to press twice.
- There is no problem if the upload isn't right the fist time (lot's of error messages), just try again and adjust your reset timing.
-
After uploading with the Xinput library, your Arduino can't possibly be programmed as a normal Arduino anymore!
- But who cares? 😉
- The 27 ohm 1 Watt resistor is the smalest possible resistor for 1 Watt at 5 Volts (P = VxV/R => 0.93 Watt = 5x5V/27R).
- It's maximum current is reached when the controller has full throttle and nearly no resistance.
- The smaler this resistor is the more range there is for reading the slot car resistor.
- The resistor puls the wiper voltage to the ground. Which is intended to stop the car when the wiper is at the electrical isolated brake part of the slot car resistor or has bad electrical contact.