Skip to main content

Force Feedback

Force Feedback (FFB) is the closed loop between the simulator and the steering wheel: the game tells the wheel "you just hit a curb", the wheel cranks a motor to push back against the driver's hands, and the driver feels the kerb through their grip. NodeBlue exposes that loop as two modules — nFFBHID (the USB endpoint that talks the FFB-class HID dialect) and nFFBEngine (the math engine that turns the host's FFB messages into a torque command for a motor).

This page is the deep-dive that the Sim-Racing tutorial pointed at. If you haven't read HID and Motors yet, start there — FFB rests on both.

How a PC-FFB session unfolds​

Before looking at the modules, the protocol on the wire:

  1. The wheel enumerates over USB as an HID device with the Force Feedback usage page. Its report descriptor declares not just axes/buttons but also a control report (effects, gains, conditions) and a state report (effect status).
  2. The game discovers the device through DirectInput (Windows) or evdev's FF interface (Linux) and uploads effect descriptors — a constant force, a damper, a spring, an inertia coefficient, a periodic. Each effect gets an effect ID.
  3. The game then sends real-time messages: start effect 3, stop effect 7, modulate effect 5's gain to 80 %. These messages arrive at the wheel as bytes on the control endpoint.
  4. The wheel's firmware reads those messages, maintains an internal table of active effects, and on each control tick computes a combined torque across every active effect, then drives the motor with that torque.
  5. The wheel reports its steering position back to the game in its input report. The game uses that position both to update the simulation and to compute position-dependent effects (a spring force depends on offset from centre).

The math in step 4 is what nFFBEngine does. Steps 1, 2, 3 and the report flow at step 5 are what nFFBHID handles.

nFFBHID — the USB endpoint​

nFFBHID is a specialised cousin of nHID / nHIDPro. The HID modules can only declare input axes and buttons; nFFBHID adds the bidirectional FFB report stream to the descriptor — a separate Out endpoint the host writes effect commands into, plus the matching In endpoint the firmware uses to report effect status.

It forces the board's USB type to customhid (or the serial*customhid* siblings) because the descriptor it builds isn't one of the standard pre-baked ones — the FFB report descriptor is custom-generated from the dialog's checkboxes.

The Type selector​

A single setting drives almost every other field:

TypeWhat it means
GenericA vanilla DirectInput / Windows-Force-Feedback wheel. Most fields visible in the dialog. The descriptor is built from your axis selection (X/Y/Z/Rx/Ry/Rz, two sliders), button count, hat config, plus the standard FFB effect set. Pick this unless you have a specific reason not to.
Fanatec BaseA pre-baked descriptor that mimics a Fanatec ClubSport / DD-class base. The Fanatec driver picks it up as one of its own — useful for slotting a NodeBlue board into a Fanatec ecosystem (custom base for a Fanatec wheel, for instance).
CustomLets you specify every field of the descriptor by hand — VID/PID/bcdDevice, input/output report sizes, vendor-defined input/output regions. Reach for it when you're trying to mimic a third-party wheel whose protocol you've sniffed. Most of the safety-rails the Generic mode provides are off in Custom mode.

Identity fields (Generic / Custom)​

FieldDescription
NameThe string the OS shows.
Vendor ID / Product IDThe USB IDs the host uses to match drivers. A self-signed wheel often borrows a known wheel's VID/PID to inherit its driver; a bespoke wheel uses NodeBlue's allocated range.
ID (bcdDevice)The two-byte device-release field of the USB descriptor — the host uses it to disambiguate firmware revisions sharing the same VID/PID. Bumping this lets the OS treat a re-flashed wheel as a "new" device that needs re-pairing in the game.

The same VID/PID hierarchy applies as for ordinary HID — see the HID tutorial's identity discussion.

Axes (Generic)​

The visible axes are the same selectable set as nHID: X, Y, Z, Rx, Ry, Rz, two Sliders. Each can be s8 (8 bits signed) or s16 (16 bits signed). Axes you don't pick are absent from the descriptor — the host won't see them.

The steering axis (X) is the one the FFB Engine reads back as position. Two-axis FFB (paddle-shifter rumble, for instance) uses nFFBEngine with Nb Axis = 2 and a second axis declared here.

Buttons, hat, vendor regions​

FieldDescription
ButtonsNumber of HID buttons declared. The matching bit-packed field is in the input report just like ordinary HID.
Hat0 or 1 — adds a 4-bit hat usage if enabled.
Vendor input 1 / 2Bytes of "vendor-defined" input region — opaque to standard drivers, used to carry telemetry to a vendor-specific driver.
Vendor outputSame, for the output direction (vendor-specific commands from the host).
Config ReportBytes of vendor configuration report — driven by nFFBHID's second input/output port pair (Conf In / Conf Out). Useful for in-band configuration channels separate from the FFB stream.

Inputs / outputs​

PortDirectionWhat it carries
InBuffer inputThe HID input report you assemble downstream of nBitPacker + nSerializer — axes, buttons, hats. Identical packing rules to nHID.
ConfBuffer inputThe vendor-config input report (when Config Report > 0).
OutBuffer outputThe HID output report from the host — this is where the FFB effect commands arrive. Wire this into nFFBEngine's Report input.
ConfBuffer outputThe vendor-config output report (when enabled).

The Type selector in the dialog hides every field that isn't relevant for the chosen mode — the field count on Generic is large because it has the standard set; Custom shows them all; Fanatec Base shows almost none (the descriptor is fixed).

nFFBEngine — the torque computer​

nFFBEngine is a single fixed-rate state machine. It consumes the host's FFB report stream and the live encoder position, and emits a torque command on every Sync tick.

Inputs​

InputTypeWhat it is
ReportcBufferThe FFB output report as it arrives from the host through nFFBHID.Out.
X (and Y for 2-axis)s32The current shaft position, as a counter value. Typically wired from nHWEncoder for a quadrature encoder, or from an nAS5600 for a magnetic absolute sensor — anything that gives a per-tick integer position.

Outputs​

OutputTypeWhat it is
Cmd X (and Cmd Y)s32Signed torque command. Negative = "push the shaft anti-clockwise", positive = "push it clockwise". The absolute magnitude is the strength of the command — its scale depends on the motor driver downstream.

Parameters​

ParameterDescription
Nb Axis1 or 2 — a one-axis wheel is the common case; two-axis projects are rare (a steering + pedal force-feedback combo, an aviation yoke).
Control Freq.The torque-compute rate, in Hz. Default 1000 Hz — the gold standard for FFB. Lower freqs (250, 500) work but lose detail in the high-frequency effects; higher freqs (2 kHz) need a fast MCU.
Encoder PPRPulses per revolution on the full mechanical revolution of the shaft. Critical for the engine to know "how big is one degree" — the spring / damper / inertia maths is in encoder-units internally, but the user-facing parameters (game's spring stiffness, etc.) are in physical units. Default 10 000.

The engine maintains the complete DirectInput effect set internally — Constant, Ramp, Spring, Damper, Inertia, Friction, Sine, Square, Triangle, Sawtooth Up / Down. The game uploads them, the engine adds them to its table; on each tick it walks the table, computes each effect's contribution at the current shaft position, and sums them into the Cmd output. No NodeBlue-side configuration of effects is necessary — the game owns them.

Per-effect tuning (host-side)​

The way an end user tunes feel ("less spring", "kill rumble", "scale all effects to 70 %") is via the DirectInput effect parameters set by the game — most simulators expose a menu for this. NodeBlue doesn't second-guess the game; if you want a master-gain knob in firmware, drop a multiplier between nFFBEngine.Cmd and the motor driver.

The full FFB chain​

A minimal one-axis wheel:

Position read-back: shaft encoder → nHWEncoder (Out = counter, s32) → nFFBEngine.X and → nRange → nFFBHID.In (the X axis declared as s16).

Buttons / hat: nButton × N → nBitPacker → nSerializer (same as ordinary HID) → nFFBHID.In (assembled with the axis bytes upstream).

FFB downward: nFFBHID.Out (host effect report) → nFFBEngine.Report.

Motor command: nFFBEngine.CmdX (s32 torque) → motor driver input (see Motors) — e.g. an nSimpleMotion's Torque input, or a closed-loop DC servo driver.

USB-type-side, set customhid (no extra interfaces) or one of the serialcustomhid* variants if you also want a debug-serial port active.

See Examples/09-USB/FFBWheel for a complete minimal project, and Examples/09-USB/FFBWheel_Test for a test rig with simulated inputs.

Tuning notes​

  • Encoder PPR mismatched with the actual mechanical ratio gives surreal feel. A spring effect with the host expecting "5° = full force" becomes "0.5° = full force" if PPR is wrong — the wheel snaps to centre with violent torque on any tiny offset. Calibrate PPR against the physical rotation range before fighting effect strengths.
  • Control freq lower than 1 kHz produces audible artefacts in periodic effects (Sine, Square — felt as a buzz at the alias frequency). Stay at 1 kHz unless the MCU can't keep up with the rest of the project at that rate.
  • The motor driver must accept signed torque commands at the same rate. A driver that only updates at 100 Hz throws away most of what nFFBEngine computes — pair the engine with a driver running at ≥ Control Freq.
  • Position read-back accuracy bounds effect quality. A noisy or low-PPR encoder makes the spring feel grainy. The order-of-magnitude target for a competitive wheel is 10 000+ PPR on the shaft side.

When to pick FFBHID vs the ecosystem-specific modules​

nFFBHID is a generic DirectInput FFB device — works in every sim that supports FFB, no driver needed beyond the OS's HID stack. The trade-off is that the user has to pick effect strengths inside the game's own settings menu (the wheel doesn't expose a driver UI).

If you're building a wheel that needs to integrate with a specific ecosystem (Fanatec, Thrustmaster, Simagic) — for tighter integration, the driver UI showing your wheel as "Fanatec ClubSport", per-game profiles managed in the vendor app — use the ecosystem-specific modules from the Sim-Racing tutorial instead.

nFFBHID Type = "Fanatec Base" is the middle ground: a Fanatec-flavoured descriptor without the full Fanatec ecosystem protocol underneath — works for simple integrations but not for full driver-UI fidelity.

Telemetry-driven add-ons (next page)​

A common upgrade once the wheel works in-game is to add telemetry-driven LEDs and a dashboard screen — driven by game telemetry, not by FFB messages. That layer is what SimHub Integration covers next.