A stand-alone DirectInput USB device is recognized in Windows as a joystick with force feedback functionality, based on BRWheel by Fernando Igor in 2017.
Firmware features:
- supported Arduino boards: Leonardo, Micro, and ProMicro (ATmega32U4, 5V, 16MHz)
- 4 analog axes + 1 for an optical or magnetic encoder, 2 FFB axes (only 1 has PWM or DAC output)
- automatic or manual analog axis calibration
- up to 16 buttons by 4x4 matrix or via button box firmware uploaded to Arduino Nano/Uno
- analog XY H-pattern shifter (configurable to 6 or 8 gears + reverse gear, XY axis invert, reverse gear button invert)
- fully supported 16bit FFB effects (custom force effect not implemented)
- envelope and conditional block effects, start delay, duration, deadband, and direction enable
- FFB calculation and axis/button update rate 500Hz (2ms period)
- many firmware options (external 12bit ADC/DAC, automatic/manual pedal calibration, z-index support/offset/reset, hat switch, button matrix, external shift register, hardware wheel re-center, xy analog H shifter, FFB on analog axis)
- RS232 serial interface for configuring many firmware settings (10ms period)
- fully adjustable FFB output in the form of 2-channel digital 16bit PWM or analog 12bit DAC signals
- available PWM modes: PWM+-, PWM+dir, PWM0.50.100, RCM
- available DAC modes: DAC+-, DAC+dir
- load cell support for 24bit HX711 chip (for brake pedal axis only)
- all firmware settings are stored in EEPROM (and automatically loaded at each Arduino powerup)
- original wheel control user interface Arduino FFB gui for an easy configuration and monitoring of all inputs/outputs
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.
Due to the 32k flash memory limitation in Arduino Leonardo (ATmega32U4), each HEX file is compiled with a certain firmware option. A one-letter abbreviation for each option is placed in the firmware version string and one needs to consider carefully which one to choose. In the release, I've compiled for you a few of the most often-used firmware option combinations.
The firmware version string consists of 3 digits and some letters (example: fw-v240ahz). The first two digits (XX) are reserved for major firmware versions, while the 3rd digit (0,1,2,3) stands for:
- fw-vXX0 basic version (1 optical encoder, 4 analog axes, 8 buttons, 2ch PWM output)
- fw-vXX1 adds support for shift register
- fw-vXX2 adds support for shift register+HX711
- fw-vXX3 adds support for shift register+HX711+MCP4725 analog DAC's
Here is the complete list of all available options that may be added to any of the above firmware*:
- "a" pedal axis autocalibration enabled (otherwise a manual calibration is enabled)
- "w" magnetic encoder AS5600 support
- "z" Z-index support for optical encoders
- "c" hardware wheel re-center support
- "h" Hat Switch (D-pad) support
- "s" external ADC support for pedals with ADS1015
- "i" averaging of Arduino analog inputs (4 samples running avg)
- "t" 4x4 button matrix support
- "f" analog XY H-shifter support
- "e" two extra digital buttons enabled (clutch and handbrake axis are unavailable)
- "x" enables to select which (analog) axis is tied to the FFB
- "m" replacement pinouts for Arduino ProMicro
note* some combinations are not possible at the same time, like "fw-vXXXzs", or "fw-v243z" because they would use the same hardware interrupt pin for more than 1 function, while some are not possible due to ATmega32U4 32k memory limit
You can use XLoader:
- set 57600baud, ATmega32U4 microcontroller and select desired HEX
- press the reset button on Arduino (or shortly connect the RST pin to GND)
- select the newly appeared COM port (Arduino in bootloader mode*) and press upload, you will only have a few seconds
*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
In order to compile the firmware yourself you may use Windows, 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 later, 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 into the newly created "arduino" folder each time.
If you used some of the earlier firmware versions before fw-v22X, windows remembered the axis raw HID calibration which was +-32k. This issue occurs when you upload the latest firmware with new X-axis calibration 0-65k, which is incompatible with the 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 reset the device calibration in Windows. This can be done by using the program DXtweak2. Open the program and select Arduino Leonardo as a device if you have more than one FFB-capable device. Click on the device defaults button, then click the apply button and close the program. That's all.
- FFB HID and USB core for Arduino by: Peter Barrett
- BRWheel firmware by: Tero Loimuneva, Saku Kekkonen, Etienne Saint-Paul, and Fernando Igor https://github.com/fernandoigor/BRWheel/tree/alphatest