ranenbg / Arduino-FFB-wheel

Stand alone directInput USB device recognized in Windows as a joystick with force feedback functionality, based on BRWheel by Fernando Igor from 2017.
146 stars 20 forks source link

Arduino-FFB-wheel

Stand alone directInput USB device recognized in Windows as a joystick with force feedback functionality, based on BRWheel by Fernando Igor from 2017.

Firmware features:

Detailed documentation and more information about the firmware can be found in txt files inside docs folder. Compiled firmware in HEX format for Arduino Leonardo and Micro can be found in leonardo hex, while firmware for Arduino ProMicro (with replacement pinout) is located in promicro hex folder. All necessary wiring diagrams are in wirings folder.

Firmware pinouts and wiring diagrams

plot

Encoder and LED wiring

plot

Motor driver wiring

plot

Button box firmware pinouts - for Arduino Nano/Uno

plot

Button matrix pinouts

plot

External i2C device pinouts

plot plot

HX711 and load cell wiring

plot

XY shifter wiring

plot

Firmware option description

Due to 32k flash memory limitation in Arduino Leonardo (ATmega32U4), each HEX file is compiled with a certain firmware option. A one letter abreviation for each option is placed in the firmware version string and one needs to consider carefully which one to chose. In the release, I've compiled for you a few most often used firmware option combinations.

Firmware version string consists out of 3 digits and some letters (example: fw-v210ahz). The first two digits (XX) are reserved for major firmware version, while the 3rd digit (0,1,2,3) stands for:

note* some combinations are not possible at the same time, like "fw-vXXXzs", or "fw-v213z" beacause they would use the same hardware interrupt pin for more than 1 function, while some are not possible due to ATmega32U4 32k memory limit

Firmware download

Firmware upload procedure

You can use XLoader:

*It is possible that some cheap chinese clones of Arduino Leonardo, Micro or ProMicro do not have a bootloader programmed. In that case you need to upload the original Arduino Leonardo bootloader first. You can find more details about it here: https://docs.arduino.cc/built-in-examples/arduino-isp/ArduinoISP

How to compile the source

In order to compile the firmware yourself you may use windows7, 8, 10 or 11, you need to install Arduino IDE v1.8.19 and Arduino Boards v1.6.21. You must place all libraries in your .../documents/Arduino/Libraries folder. In windows folder options set to show hidden files and folders then navigate to C:\Users\yourusername\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\cores. Rename the folder "arduino" as a backup as we will need some files from it latter, I just add "arduino_org" to the filename. Create a new folder called "arduino" and place the entire content from modified core into newly created "arduino" folder. Navigate back to "arduino_org" folder and copy files "IPAddress.cpp", "IPAddress.h", "new.cpp" and "new.h", then paste and replace the ones inside the "arduino" folder. That should fix all errors and you should be able to compile the code. Bare in mind that if you make any changes to HID or USB core files you will need to repeat the procedure and paste all modified files in the newly created "arduino" folder each time.

Troubleshooting X-axis stuck at -540deg

If you used some of the earlier firmware versions prior to fw-v22X, windows remembered the axis raw HID calibration which was +-32k. This issue occurs when you upload lattest firmware with new X-axis calibration 0-65k, which is incompatible with previous HID calibration that windows remembered for this ffb joystick device. However, there is a very easy fix for it, all we need to do is to reset the device calibration in windows. This can be done by using program DXtweak2. Open the program and select Arduino Leonardo as a device if you have more than 1 ffb capable devices. Click on device defaults button, then click apply button and close the program. That's all.

Credits