DIY FFB Wheel based on Arduino Leonardo

U

User 13336

FFB RFR Wheel based on Arduino Leonardo

Hi everyone,

I created this topic to describe my FFB Wheel based on Arduino Leonardo, IONI + Cube1x + Mige 130ST-M10010.

Summary :
- Internal refresh rate of 500 Hz
- Wheel position has 16 bits precision, and there is one additionnal input in 16 bits (for a Load Cell eg) + 2 other 12 bits inputs (for the accelerator and the clutch for example) + 32 buttons.
- A total of 12-15 inputs, with 9 to 11 of them being analog (depending on configuration).
- HX711 chip support, to connect load cells.
- Ability to set nonlinear functions on the inputs (exponent function type) -> useful for a brake pedal with progressive hardness for example.
- Supported effects (for now): Friction, Spring, Damper, Sine, Constant power, Ramp, Square, Triangle, SawtoothUp, SawtoothDown, Inertia
- 4 PWM mode supported: Single PWM (zero setpoint -> 50% duty ratio), PWM + Dir, two PWM signals +/- (for AMC drives for examples), and Ultrasonic PWM for H-bridges (like VNH5019).
- Possibility to adjust the frequency of the PWM (8 KHz PWM modes for simple, PWM + Dir, PWM +/- 20 KHz for the bridge control H)
- Ability to set the PPR of your motor if you use a quadratic encoder.
- Possibility to add several user effects, that are added on top of the game effects.
- Profile management settings, with the option of auto-detecting of the game.

First some pictures:

GS_Wheel.jpg
The steering wheel

Shield_Ioni+LoadCell.jpg
The shield that I've build to connect the load cell and IONI

LoadCellWiiBalance_H.jpg
The Wii Balance Load Cell

Shopping list :
- Arduino Leonardo
- IONICube + 1x IONI pro kit
- 48V 600W Power supply
- 24V 100W Power supply
- Mige 130ST-M10010 Motor
- 300 mm Wheel
- Power Resistors
- Male + Female DB15 connectors with their covers
- 8200 uF 80V Capacitor
- Power switching diode
- HE10F20 Female Connectors
- Cables to connect the motor and the encoder to the IONI
- Option: HX711 load cell shield + WiiBalance to get 4 quality load cells for 15 €.

Note for the yourduino HX711 load cell shield, to have 80 SPS (samples per second) instead of 10 SPS, you must unsolder the pin 15 of the chip (RATE) which is welded to the ground, and connect to 5V (pin 16). There is a similar shield at Sparkfun, or another one here, with just a bridge to solder instead, but I haven't tried them yet.

CablageLeonardoIoni_small.jpg

If you want to connect multiple buttons on a single analog input, use the following wiring (I called it the BoDAC) :

Boutons_4.jpg

Other buttons multiplexing solutions will be proposed later.

The IONI settings are "classic" except "Bandwidth Limit Torque" that I've put to 100 Hz:

Granity_Connect.jpg


Granity_Goals.jpg


Granity_Machine.jpg


Granity_Tuning.jpg


Granity_FaultLimits.jpg

It is absolutely necessary to update the IONI firmware because the PWM + Dir function was no longer working in the latest versions. It is here: http://granitedevices.com/wiki/IONI_firmware_releases
The IONI firmware I used is 1.2.3.

The configuration software can be downloaded here:
http://www.aiwave.fr/wc_updates/1033/WheelConfig_0.18.exe

Mini tutorial:
Primarily Install the latest version of the Arduino IDE: https://www.arduino.cc/en/Main/Software#
You'll need it to install the drivers of the Leonardo.
Instructions for installing the drivers are here: https://www.arduino.cc/en/Guide/ArduinoLeon...oLeonardo#toc10
Once the drivers are correctly installed, you can continue.

1 ) Connect your Arduino Leonardo. No need to install a sketch, it may be blank.
2 ) Disconnect the cable connected to your wheel if you have one (in case you do not have wired the encoder or the motor phases in the same order as me).
3 ) Install the app. On Windows 8 (and possibly in other versions) it must be installed as administrator (right click on the exe -> execute as administrator). It is best not to install in the "Program files", but rather in a folder that does not have safety problems for Windows (Windows 8 creates a "Virtual Store" folder if the program tries to write in it, eg for a config file).
4 ) Then at the end of the installation, leave "Run WheelConfig" checked , it will launch the app (watch out, the window can be hidden, I did not manage to put it in front yet).
5 ) Choose the serial port that is connected to your Arduino Leonardo.
6 ) Click "Check Now".
7 ) If you have a connection alert on your firewall, allow the connection.
8 ) It should tell you that there is a firmware update available, click "Yes".
9 ) The Leonardo should automatically be detected and the firmware should be installed.
10) If the steering wheel does not calibrate properly and goes into infinite rotation, select "Invert" under "Wheel".
11) At this stage is should calibrate the steering wheel and seek the index. The Leonardo LED blinks at different frequencies depending on the status.
12) Put the "Main Gain" slider at zero, center your steering wheel and click on "Wheel Center". Reput "Main Gain" at 100%
13) Set the "Max angle" as you wish.
14) By clicking on "Advanced Settings", you can configure specific parameters for your drive, input pins mappings and external gain adjustment.
15) If you want to adjust the gain with an external potentiometer, connect the pin on the Leonardo A5 (or the pin you selected in the previous step). If not, set the pin "External Gain" to "None" in "Advanced Settings".
16) If you want to play with the dev version, there is a shortcut in the start menu.

Glossary
- Main Gain: Master Gain, acts on all effects simultaneously, including desktop, but not the steering stops
- Spring Effect spring: brings the wheel to a position as if a spring was attached.
- Friction: simulates a static friction, eg when trying to drag a heavy object over a surface that does not slip too much, you must push a certain minimum force before the object moves. Then once it moves, friction is limited (to some extent).
- Damper: Simulates a damper. Opposes the speed. The more quickly the wheel turns, the more it tries to slow it down.
- Inertia: simulates the inertia due to the mass of the wheel (and wheel train, etc ...). "adds weight to the wheel." A greater force will be needed to move or stop the wheel.
- Constant: it in fact it is a direct torque control on the steering wheel. This is used by some games to directly drive the wheel or to emulate some effects, and also for shocks.
- Sine: This setting affects all periodic effects (sine, ramp, square, triangle, sawtooth). Mostly used for vibration (engine, bumpers, etc.). Sometimes used for something else.
- Strength Table: not implemented yet, but it's the equivalent of an audio sample. To generate vibrations a little richer than the sinuses, but until now a lot of wheels did not support this effect.

Here's a screenshot of the dev release:

WheelConfigDev.jpg

WheelConfig_as.jpg


WheelConfig_le.jpg


What remains to be done :

Hardware: put it all in a box with clean connectors and everything. Make a plate for buttons and palettes. Mount the wheel on one of my motion simulators ...

Software:
- Implement the "Custom Force" (strengths table) effect which is the only one missing.
- Implement saturation parameter for effects.
- Make a driver on Windows to optimize information transfer FFB and improve system responsiveness.
- ADC Calibration
- Management of conventional buttons assemblies on analog inputs
- BODAC and conventional assemblies Configuration / Calibration
- French translation (and eventually German ;) )
- H Box Management with potentiometers
- Buttons matrices Management
- Management of multiplexing circuits in SPI or I2C for buttons
- Management of LED displays and touch screens for telemetry and / or configuration
- Management of Fanatec wheel
- and many other things...

Preview video (sorry it's in French):

 
Zuletzt bearbeitet:
U

User 13870

Great tutorial and nice to see that OSW is improving all the time.

I assume that "Leonardo" OSW would also work with people using Argon? With different connections and setup of course, but software should work?
 
U

User 13336

Thanks
Yes, I guess it should work, as the Argon is very close to IONI. But it has to be confirmed yet.
 
U

User 10296

Do you have effect saturation implemented? That was a vital part of preventing oscillations in a few sims (especially iRacing) without having to apply heavy damping on the whole system.

Gesendet von meinem XT894 mit Tapatalk
 
U

User 11065

I can imagine to design the future adapter pcb which can hold both boards, but not at the same time or maybe, but with a switch in between
 
U

User 11835

Great tutorial and nice to see that OSW is improving all the time.

I assume that "Leonardo" OSW would also work with people using Argon? With different connections and setup of course, but software should work?

Ich kann sagen das es geht mit der Argon. Etienne war auch sehr erfreut darüber das ich es getestet habe.
 
U

User 13336

No, Saturation is not implemented yet. But it's on the todo list ;) I know it's important, especially with powerfull motors.

I can imagine to design the future adapter pcb which can hold both boards, but not at the same time or maybe, but with a switch in between
What do you mean by "both boards" ? The Leonardo + Hx711 or Leonardo + IONI ?
In any case, it's very interesting !
 
U

User 11065

something like discovery + leo + hx711 ;) so you can use the discovery ffb version or your leo version :)

could be better than a wire construction
 
U

User 13336

Great tutorial and nice to see that OSW is improving all the time.
Please note that this is not an evolution of the OSW ;). No offense, but I would like to pay tribute to RacingFR community (including Beano's postings on RFR forum), and also to the project "Adapt-FFB-Joy". Without all the help, sharing and work done by these guys, it would have been much longer and harder for me to build my RFR wheel and to get all this software working. :daumen: :aufdiekniefall::aufdiekniefall::aufdiekniefall:
 
Zuletzt bearbeitet:
U

User 841

Ja, Dennis, ran an die Planungstafel!

Oder vorab an André: Hattest Du auch die Platine von Dennis? Oder wie hast Du das eingebaut? Mit "losen" Kabelverbindungen?

S.
 
U

User 11065

sobald ich etwas zeit finde, klick ich mal was zusammen.. kann aber noch etwas dauern..

@etienne: if you like, I could translate the program into german, thats no problem, french or english source would be great :)
 
U

User 10296

Great tutorial and nice to see that OSW is improving all the time.
Please note that this is not an evolution of the OSW ;). No offense, but I would like to pay tribute to RacingFR community (including Bernhard's postings on RFR forum), and also to the project "Adapt-FFB-Joy". Without all the help, sharing and work done by these guys, it would have been much longer and harder for me to build my RFR wheel and to get all this software working. :daumen: :aufdiekniefall::aufdiekniefall::aufdiekniefall:
That's something I wanted to point out earlier: you need a name for your project and make this exactly clear :-)

MMos got sucked into the OSW domain as well without him having anything to do with the project.. OSW somehow became a synonym for any DIY wheel effort..

Gesendet von meinem XT894 mit Tapatalk
 
U

User 10296

..oh and btw. one more I wanted to ask: do you have an RTOS running on your leonardo? I somehow gave up on my teensy project ages ago because I couldn't get it running with a realtime OS which led to having jittery sensor filtering all the way.. just wondering how you got around that..

Gesendet von meinem XT894 mit Tapatalk
 
U

User 10444

Endlich kommt wieder Leben in die Bude
Hab grad mal ne Steckplatine gelötet, mit Dennis Adapterplatine eigentlich alles easy.
Morgen bekomme ich nen Leonardo zum testen, bin gespannt

ImageUploadedByTapatalk1443867960.222267.jpg
 
U

User 13336

@etienne: if you like, I could translate the program into german, thats no problem, french or english source would be great :)
Yes thanks ! I have yet to clean the code in order to make translation easy. As soon as it's ready I'll get back to you.
That's something I wanted to point out earlier: you need a name for your project and make this exactly clear :-)
Yes you're right, I first called it Arduioni wheel, but as it's now working with other drives, I dropped this name. I will probably call it ESP Wheel, although my goal is not to be percieved as a rock star ;).
..oh and btw. one more I wanted to ask: do you have an RTOS running on your leonardo? I somehow gave up on my teensy project ages ago because I couldn't get it running with a realtime OS which led to having jittery sensor filtering all the way.. just wondering how you got around that..
No, I didn't even know that you could run RTOS on a Lonardo ! On Ardunios, I'm coding in "low level", trying to optimize as much as possible. For example the encoder pins needs to be on D0 and D1, so the code in the interrupt is as short an efficient as possible. I have put more flexibility on other pin configurations (including dealing with the Hx711), it's a little bit less efficient, but it's still ok. You can have a look at the initial sources here :
http://www.aiwave.fr/downloads/ESP_WHEEL_0.3.zip

This is not the latest version, but it will give you an idea of how I did this. I had to close the sources when I saw in my server log that some companies working on steering wheels were trying to get undisclosed versions :mad:, and I don't want commercial use of this work (at least not without my agreement).

Also, the Leonardo is obviously a lot inferior to the discovery board, but as I couldn't get easily a FFB device working on the disco (I'm doing this on my spare time), I decided to keep the Leonardo. But I'm hoping to be able one day to get it working on a more powerful board, in order to reach a 1000 Hz refresh rate, and to reduce the control jitter.
 
Zuletzt bearbeitet:
U

User 10296

Maybe the teensy would be a good starting point for you as if I remember correctly a lot of the Leonardo was ported back from the Teensy and vice versa..

Gesendet von meinem XT894 mit Tapatalk
 
U

User 13336

If you're talking about the teensy 2.0, it's exactly the same chip as the Leonardo (32U4), so I won't gain anything.
There are a lot of USB devices examples that are proposed with the Teensy, but none of them is dealing with FFB (USB going from the PC to the MCU)...
Also the problem is that teensys are partly closed source (especially the USB part I think), so I would like to avoid it for now.
I was rather interested in the Arduino Due or Zero, as you can debug for real on them, and they are much more powerful than a Leonardo.
 
U

User 10296

No, I was talking about the 3.1. It's been quite some time since I've looked into this, but as far as I remember the USB Stack of the 3.0 is still open source..

The best bet would probably still be a STMF4 or even F7 based chip. The real advantage is that almost all STMFx chips are pin2pin compatible (afaik) and debugging is easy as sh*t on them. They even have their own eclipse based IDE for this stuff..

Gesendet von meinem XT894 mit Tapatalk
 
U

User 13336

Yes, I agree I should have a look at the Teensy 3.1 too (now there's the new 3.2 btw).
But I already have the Discovery with the STM, and I agreee too that I should try first to get it working on it. The problem is that I can't afford at the moment to spend 1 month to set up a proper developping environment and a FFB device on these boards...
What I've seen so far is a big mess, with differents cores comming from different places (I've tried visual GDB, I'm working with Visual Studio for 15 years now).
I'll have a look at eclipse, but learning a new IDE is really something I'd like to avoid. I have so much things to do that I don't want to waste time on that kind of thing.
If I could find a code base with a working basic FFB on the STM32, just like I found on the Arduino, I would jump into it.
 
U

User 10444

So, ich lass da erstmal für heute, habe alles angeschlossen, bekomme aber den Leonardo nicht richtig zum laufen.
Nach der Arduino-Installation findet Windows nur mit Hängen und Würgen den Treiber für den Leo.
Beim Versuch via WheelConfig die Firmware aufzuspielen läuft zwar die ganze Routine ohne Fehlermeldung ab im Fenster ab, danach wird aber der Leo nicht als Gaming Device erkannt und ich habe nur die Möglichkeit die Firmware erneut zu flashen.
Ich probiere nächste Woche mal einen anderen Leo aus...
 

Ähnliche Themen

Oben