Skip to content

Firmware

Kristian Jörg edited this page May 14, 2026 · 6 revisions

The microcontroller has to be a SparkFun Micro Pro or a clone which works just as well. It has to be the 5V, 16 MHz version! The firmware is compiled and uploaded by using a programming IDE (Integrated Development Environment). There are two options:

  1. Microsoft Visual Studio Code with the PlatformIO extension. VS Code can be downloaded and used free of charge. Visual Studio Code with PlatformIO extension has been used under the development of this fork and provides a much more helpful interface and functionality than Arduino IDE. However, VS Code has a steep learning curve and if the intention is to just compile the firmware code and upload to the yoke, then I would suggest using Arduino IDE.
    There are numerous videos on how to get started in VS Code, but here is a good YT video on the subject.

  2. ArduinoIDE can be used by simply renaming the topmost "src" folder to "Arduino_FFB_Yoke".

Using Visual Code and PlatformIO

This is a more advanced option with better functionality and also integration with Git and Github.

  1. Download VS Code
  2. Download PlatformIO extension
  3. Get started with PlatformIO
  4. Download the latest release source code from the GitHub Repo found in the Release section, or use the git clone functionality in VS Code.
  5. Compile and Upload to the microcontroller.
  6. Optionally use the Serial Monitor for debugging

Using Arduino IDE

Arduino IDE is recommended for simplicity. It does not have all the bells and whistles of VS Code though.
Download https://www.arduino.cc/en/software/

Libraries

Start the Arduino IDE and open the Library Manager. picture 0

In "Filter your search", search for and install:

  • AS5600 by Rob Tillaart
  • TCA9548 by Rob Tillaart
  • digitalWriteFast by Watterott

Board Manager - SparkFun Pro Micro support

It is optional to download the SparkFun board files, the compiling will work just fine either way. But if you want to have the "proper" board configuration then follow this guide.

Important

Make sure you select the correct version of the board in the last step, i.e the 5V, 16 Mhz version!

Otherwise it is fine to use the Arduino Micro board in Board Manager, which comes preinstalled in the IDE.

Source Code

Note! The screenshots used here are from an older version of the source code.

Download the latest release source code from the GitHub Repo found in the Release section. Extract the Zip file.

The Arduino_FFB_Yoke.ino is the main project file and must be in a directory with the same name (without .ino). This is very important, otherwise the compiling will not work! All other files in this directory and src directory are also needed. Simply renaming the topmost "src" folder to "Arduino_FFB_Yoke" will make the src directory compatible with Arduino IDE.

picture 0

Open this file with Arduino IDE and choose the Arduino Micro Board (doesn't matter if you're using micro pro or not)

Click Verify to test if everything is all right.

Connect the Arduino Micro Pro to the computer and choose the right COM Port.

Upload the code to the Arduino.

Multiple Devices

If you want to use multiple devices then you can change the Joystick ID in the Joystick.h file.

define JOYSTICK_DEFAULT_REPORT_ID 0x04

Different Name

If you want to change the name of the device in the Gamecontroller list open the boards.txt file with a text editor (like Notepad++)

C:\Users<your username>\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.5\boards.txt find: micro.build.vid=0x2341
micro.build.pid=0x8037
micro.build.usb_product="Arduino Micro"

and change it to (use at your own risk), you can comment out the old value by using a hash symbol

micro.build.vid=0x9998
micro.build.pid=0x9998
micro.build.usb_product="Arduino FFB Yoke"

Experimental speed control feature

A configurable max velocity setting to stop overspeed on unloaded (i.e hands off) yoke. When there are strong forces and not holding the yoke it can get to a high speed that when slamming into a physical end stop may damage the yoke itself (or you). This configurable setting detects high velocity and brakes the motor until speed decreases. If hands are on yoke and kept in control, the FFB forces are in full unhindered effect.

The speed limiter functionality is initially disabled as it can cause electrical interference due to high frequency motor power fluctuations and a processor crash! This in turn may cause the motors to run with full power slamming into an endstop. It can be speculated that keeping the 24V cabling well separated from any 5V or sensor cables may help prevent these problems. I had this working by doing just that, moving all 24V cables away. Before that I did also encounter crashes. However, since this has been reported from users, I decided to remove this feature. By reducing the travel distance on the pitch axis somewhat it creates a "cushion" that help catch the yoke when it is moving quickly anyway, so the feature is not critical.

It can be re-enabled in define.h to try this feature out.:

// #define ENABLE_SPEED_LIMITER // commented out to disable by default

The settings tool contains a slider that may be enabled by commenting out the .hide() lines in tool/YokeTool.py for the speed control slider.

# Comment out to enable, but note that the functionality
# must also be enabled in defines.h in the firmwware code
self.slider_maxVelocityPcnt.hide();
self.label_maxVelocity.hide();
self.label_maxVelocity_2.hide();

Warning

Take care if you enable this and test it out out with hands on the yoke to catch it if it runs away. These runaways happen when an axis is moving rapidly and the speed control engages and starts turning power off and on in rapid succession. This seems to induce(?) voltage interference on the 5V Arduino which makes it crash. It remains unclear what the problems are caused by though. When the speed control works, it is a very helpful feature.

Clone this wiki locally