This is a fork of the hoverboard-firmware-hack-FOC project that adds AB encoder support and brake resistor functionality for precision motor control applications.
For instructions please check wiki
For general setup instructions, hardware information, and base firmware features, please refer to the original repository.
- Smooth Torque Output at Zero RPM
Encoder feedback enables true zero-speed torque control with no cogging or vibration. Perfect for FFB devices like direct drive wheel base, ffb joystick, seatbelts.
- PSU Support
Integrated brake resistor support allows safe operation from bench power supplies. The brake resistor dissipates regenerative energy that would otherwise cause voltage spikes and damage PSUs or trip overvoltage protection.
- High-Quality Input Control Performance
Enhanced PWM input processing (both hardware and software implementations) provides:
- low latency 1000hz polling
- Noise-free
- High Resolution
For information on all improvments see Pull Request #3.
Wheelbase and Joystick project Arduino-FFB-wheel by Miloš Ranković
Wheelbase compatible project OpenFFB by Yannick Richter
Any usb controller capable of outputting PWM and Reading ab encoder signals will work, in this case I am using Rane's firmware with arduino pro micro. For exact wiring connections and components to get check wiki page
20251106_053714_1_H264_1080p.mp4
In platformio.ini, uncomment your desired configuration:
default_envs = ONE_AXIS_VARIANT ; Single motor with encoder
;default_envs = TWO_AXIS_VARIANT ; Dual motors with encodersEdit Inc/config.h with your specific parameters:
#define BAT_CELLS 10 // Your battery cell count:
// 6s = 24V (22.2V - 25.2V)
// 10s = 36V (37V - 42V)
// 13s = 48V (48.1V - 54.6V)#define ENCODER_X
#define ENCODER_X_PPR 2048 // Your encoder pulses per revolution
#define ALIGNMENT_X_POWER 6553 // Sensor alignment voltage out of 16000 for HW & SW-PWM, out of 1000 for the othersUses the left motor driver as a brake resistor (left motor must be disabled).
#define INTBRK_L_EN // Enable internal brake on left driverContributions are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.
This project inherits the GPLv3 license from the original hoverboard-firmware-hack-FOC repository.
For issues, please open an issue in this repository.
For general hoverboard firmware questions, refer to the original repository and its wiki.
- Original FOC firmware: EFeru/hoverboard-firmware-hack-FOC
- Added AB quadrature encoder support for precise motor control
- Implemented internal and external brake resistor functionality
- Enhanced PWM input processing (hardware and software)
- Added ADC watchdog handling
- Performance, safety and reliability improvements
For more changes, see Pull Request #3.