Arduino Leonardo Usb Steering Wheel
Intro: Arduino Leonardo Usb Steering Wheel
I had an old usb steering wheel laying around that died, i had a freetronics leostick laying around so i made this.
i updated the bootloader to the official leonardo one.
i updated the bootloader to the official leonardo one.
STEP 1: Bootloader Mods
updated the bootloader to the official leonardo one.
for the steering wheel you will need an arduino leonardo compatible board with the leonardo bootloader.
update these files in root folder >hardware > arduino > cores > arduino
i used i.0.5 of the ide
files to download : HID
for the steering wheel you will need an arduino leonardo compatible board with the leonardo bootloader.
update these files in root folder >hardware > arduino > cores > arduino
i used i.0.5 of the ide
files to download : HID
STEP 2: Code and Wiring
here is the code i used, edit it to suit your needs :)
void setup()
{
Serial.begin(57600);
pinMode(13, OUTPUT);
joySt.xAxis = 0;
joySt.yAxis = 0;
joySt.zAxis = 0;
joySt.xRotAxis = 0;
joySt.yRotAxis = 0;
joySt.zRotAxis = 0;
joySt.throttle = 0;
joySt.rudder = 0;
joySt.hatSw1 = 0;
joySt.hatSw2 = 0;
joySt.buttons = 0;
}
void loop()
{
Serial.write("DIY USB joystick V1 by the nerdling");
joySt.xAxis = analogRead(A4)/4;
joySt.yAxis = analogRead(A5)/4;
joySt.rudder = analogRead(A3)/4;
Joystick.setState(&joySt);
}
the wiring is what i used on my wheel, the throttle and brake wiring is what i used because i needed 2 pedals for 1 channel, try it out and see what you need to do to make it suit you
that's all i will tell you because that's all you need figure the rest out e.g to put it all in your wheel each one is your different
void setup()
{
Serial.begin(57600);
pinMode(13, OUTPUT);
joySt.xAxis = 0;
joySt.yAxis = 0;
joySt.zAxis = 0;
joySt.xRotAxis = 0;
joySt.yRotAxis = 0;
joySt.zRotAxis = 0;
joySt.throttle = 0;
joySt.rudder = 0;
joySt.hatSw1 = 0;
joySt.hatSw2 = 0;
joySt.buttons = 0;
}
void loop()
{
Serial.write("DIY USB joystick V1 by the nerdling");
joySt.xAxis = analogRead(A4)/4;
joySt.yAxis = analogRead(A5)/4;
joySt.rudder = analogRead(A3)/4;
Joystick.setState(&joySt);
}
the wiring is what i used on my wheel, the throttle and brake wiring is what i used because i needed 2 pedals for 1 channel, try it out and see what you need to do to make it suit you
that's all i will tell you because that's all you need figure the rest out e.g to put it all in your wheel each one is your different
18 Comments
nohand1 3 years ago
superi1 5 years ago
zeday 7 years ago
Hello Author. Thanks for this tutorial. What about the HID files to download? Whenever I click on the link it fails to download the HID zipped folder. Can you clarify what is contained in this zipped folder, what we need it for and how do I get these files from you or from an alternative source online? Many thanks
IamGhostEA 7 years ago
Hello.I have a question for you.With arduino and this code i have deadzone on steering?(Sorry for my enghish :) )
ArifSae 8 years ago
Made this only using smartphone - no cost - working great. sharing all
places because UNO steering wheel was in my future projects list. due to
costs of commercial gaming wheels. Now using existing smartphone and
app its super easy.
https://www.youtube.com/watch?v=PcFSFCocAPE
Jeroenv26 8 years ago
Would this work with a Optical Incremental Rotary Encoder like this:
http://www.aliexpress.com/item/F85-Free-Shipping-Encoder-600-P-R-5V-24V-Incremental-Rotary-AB-2-Phase-6mm-Shaft/32412236109.html?spm=2114.30010308.3.1.RmyaMu&ws_ab_test=searchweb201556_3,searchweb201644_5_505_506_503_504_502_10001_10002_10016_10017_10010_10005_10011_10006_10003_10004_10009_10008,searchweb201560_3,searchweb1451318400_-1,searchweb1451318411_6448&btsid=0e54ee8f-ee3d-477c-b5aa-0a7959493697
The nerdling 8 years ago
the optical encoder looks like it outputs pulses based off position
you could edit the code but im not sure how
Jeroenv26 8 years ago
Amitesh Dungarshi 8 years ago
is the potentiometer used for steering and can we add a clutch and h shifter which is a diy one. and in the diagram for brake and throttle is potentiometer used or can it be used??
hotwired2 9 years ago
Sorry, this might be not the best idea.
In a specific configuration of the throttle and brake potis there will be
a short circuit between GND and VCC.
Or is this the reason why you are using another GND and this is not a problem?
The nerdling 9 years ago
i used a different ground because it was closer in the diagram
this is how i wired up the throttle and brake pedals, it works fine no short
it should work with a different ground pin
sk8ter122 9 years ago
I cannot get this to work. I get the following error in the compiler:
Controller_3.ino: In function ‘void setup()’:
Controller_3.ino:5:3: error: ‘joySt’ was not declared in this scope
Controller_3.ino: In function ‘void loop()’:
Controller_3.ino:20:3: error: ‘joySt’ was not declared in this scope
Controller_3.ino:23:3: error: ‘Joystick’ was not declared in this scope
what Code do you have before "void setup()"
I swapped out the files in the root folder and used your code. Won't work...
any suggestions? I am also using arduino 1.0.5
sk8ter122 9 years ago
use arduino 1.0.1. Modify the root files as this tutorial states, but for arduino 1.0.1. Secondly, make sure you have the Leonardo selected as the board you are using.
I cannot get this code to work for any other versions of arduino accept arduino 1.0.1.
link to all older arduino versions: http://arduino.cc/en/Main/OldSoftwareReleases
The nerdling 9 years ago
did you put the files in the root folder, eg "arduino-1.0.5" or in these folders?
root folder >hardware > arduino > cores > arduino
MarcosL1 9 years ago
Would a version of this work with an arduino mega? I am rather new to fiddling with Arduinos, got a mega 2560 from a friend and I have a busted steering wheel as well.
The nerdling 9 years ago
is it can act line a USB keyboard then yes it might
I used a freetronics leostick with the Leonardo boot loader for my steering wheel
MarcosL1 9 years ago
Thank you for the reply, after your comment I went googling and there are indeed ways of making the Mega work as a usb HID device, I might do some stuff and try to use your code while I wait for the rest of the hardware I bought for a different project with the same arduino.
The nerdling 9 years ago