Skip to content

Arduino USB adapter for connecting a real analog slot car controller to PC (game Virtual SlotCars)

Notifications You must be signed in to change notification settings

HansVGinkel/USB-slot-car-controller-adapter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 

Repository files navigation

USB slot car controller adapter

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.

vsc usb controller adapter klein

Hardware

  • Not all Arduino types can be used! Arduino Pro Micro Sparkfun clone 5 V 16 MHz used (costs less than EUR/USD/GBP 10,-).

  • 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

    Arduino USB slot car controller adapter

Software

  • Install the free Arduino IDE on your PC https://www.arduino.cc/en/software/

  • Open the IDE program and install the free Xinput library

    image

    image

  • Always install the core board package

  • 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:

      image

    • 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

    image

  • Download the code from this page and open the sketch file slotcar_controller.ino in a text editor

    • Delete de default code in your IDE first.
    • Now copy paste the code from the text editor into the IDE.
    • Press the Verify button image to see if the code is OK.
    • Save your sketch file with a new name.
  • 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 image and uploading of the sketch just starts image 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? 😉

Explanation

The use of minimal a 1 Watt resistor, not a common 1/4 Watt resistor!

  • 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.

20210305_135558 20210305_135456 20210305_135420 20210305_135437

About

Arduino USB adapter for connecting a real analog slot car controller to PC (game Virtual SlotCars)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages