How chrgri/diy-sim-racing-ffb-pedal works
Major components and layers
• Hardware Layer:
• Mechanical and electrical aspects (as documented in the separate “Mechanical Design” repo).
• Sensor interfaces: load cell, pedal geometry measurement, force feedback sensors.
• Actuators: High-power servo (or stepper motor in some variants) driven via dedicated power/control boards.
• Custom PCBs and wiring (as seen in the “Wiring” and “OTA” folders).
• Embedded Firmware Layer (ESP32/ESP32_master directories):
• Core firmware modules (found in ESP32/src and ESP32_master/src) including:
• Controller (handles overall control logic)
• Signal processing modules such as CycleTimer, SignalFilter, SignalFilter_2nd_order
• Sensor interfacing modules (LoadCell, PedalGeometry, etc.)
• Feedback modules (ForceCurve, Modbus, OTA update routines, etc.)
• Communication and connectivity modules (ESPNOW, USB and wireless interfaces)
• Communication and Integration Layer:
• SimHub integration: a PC-side plugin (SimHubPlugin directory) that communicates with the pedal.
• OTA update scripts and helper modules (in Helper and OTA folders).
• Possibly external simulation/control board interfaces (e.g., Fanatec integration, as well as stepper parameterization tools and test modules for validation).
Lay out the relationships and data flows
• The sensors (Load cell, pedal geometry sensors, etc.) send raw signals to the microcontroller.
• The firmware’s signal processing modules apply filtering (using SignalFilter or 2nd order algorithms), and the processed data is passed to the Controller.
• The Controller uses control loop strategies (possibly referenced in the CycleTimer and ForceCurve modules) to compute the appropriate feedback force.
• The computed control commands are then sent to the actuator drivers (StepperWithLimits/Servo controllers) on the hardware PCB.
• In parallel, communication modules handle bidirectional communication with the PC:
– Sending telemetry and pedal status to the PC (for simulation feedback).
– Receiving calibration settings / profile updates (e.g., through Modbus protocols or USB commands).
– Supporting OTA updates and version string generation (using the Helper scripts, for instance).
• At the PC level, the SimHub plugin uses the received data to render additional force feedback effects in conjunction with in-game data.
Architectural patterns and design principles
• Modular design: The firmware is divided into clearly separated modules (Controller, Sensor Interfaces, Signal Filtering, Communication, etc.) enabling clear layering.
• Feedback and control loop: There is an inherent closed-loop control structure where sensor input, signal processing, and actuator commands are all tied together.
• Hardware abstraction: Separate layers abstract low-level sensor handling and actuator control, making it easier to swap or upgrade hardware components.
Relevant technologies, frameworks, or libraries
• Arduino/PlatformIO environment for the firmware.
• ESP32-specific libraries and components (note: directories indicate PlatformIO and Arduino projects).
• Custom libraries for signal filtering, interpolation (e.g., InterpolationLib in the Arduino_outdated/lib folder) and possibly a fast stepper control library (FastAccelStepper).
• SimHub Plugin framework on the PC side (written in C#).
Essential elements
• Hardware Subsystem:
• Sensors – load cell, pedal position sensor.
• Actuators – servo/stepper and their drivers.
• Supporting circuitry – power boards, PCBs, wiring (from the Wiring and OTA sections).
• Embedded Firmware Subsystem:
• Core Controller module.
• Signal Processing (Filters, CycleTimer).
• Sensor Interface Modules.
• Actuator control modules (StepperWithLimits, ForceCurve).
• Communication Interfaces (USB/Wireless, OTA routines, Modbus).
• Boot and version management (Helper scripts for version string, build directories).
• PC Integration Subsystem:
• SimHub Plugin – handles user interface, telemetry, and effect profiles.
• Firmware Updater (OTA procedures).
• Annotations and Legends:
• Interactions (e.g., “Control Loop Feedback”, “Profile Data Transfer”, “Firmware Update”).