Dette reoet implementerer Field Oriented Control (FOC) for vanlige hoverboards. Sammenlignet med kommuteringsmetoden (som de kommer med) tilbyr denne FOC-kontrollmetoden overlegen ytelse med:
- redusert støy og vibrasjoner
- jevnt dreiemoment og forbedret motoreffektivitet. Dermed lavere energiforbruk
- feltsvekkelse for å øke maksimalt hastighetsområde
- Mulighet for å kontrollere motorene over seriell komunikaskjon.
- [Planen fremover](#Planen fremover)
- Hardware
- FOC Firmware
- Flashing
- Troubleshooting
- Diagnostics
- Projects and Links
- Contributions
Dette er bare noe av det man kan bruke den til:
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
**BILDER**
- (DONE) Gå over til "tank" mode slik at leg slipper å bruke hoverbordet sin mixer og jeg kan gi helt konkret fart på hvert hjul -- implement Emanuels suggestion for tank mode
- Imoplementere ROS til å gjøre det samme som nå
- Få ROS til å kontrollere roboten enten inne med lidar eller ute med GPS
Stepp 2 og videre blir inspirasjon fra: Converting a hoverboard into a self-driving mobile robot with ROS
The original Hardware supports two 4-pin cables that originally were connected to the two sideboards. They break out GND, 12/15V and USART2&3 of the Hoverboard mainboard. Both USART2&3 support UART, PWM, PPM, and iBUS input. Additionally, the USART2 can be used as 12bit ADC, while USART3 can be used for I2C. Note that while USART3 (right sideboard cable) is 5V tolerant, USART2 (left sideboard cable) is not 5V tolerant.
Typically, the mainboard brain is an STM32F103RCT6, however some mainboards feature a GD32F103RCT6 which is also supported by this firmware.
For the reverse-engineered schematics of the mainboard, see 20150722_hoverboard_sch.pdf
In this firmware 3 control types are available:
- Commutation
- SIN (Sinusoidal)
- FOC (Field Oriented Control) with the following 3 control modes:
- VOLTAGE MODE: in this mode the controller applies a constant Voltage to the motors. Recommended for robotics applications or applications where a fast motor response is required.
- SPEED MODE: in this mode a closed-loop controller realizes the input speed target by rejecting any of the disturbance (resistive load) applied to the motor. Recommended for robotics applications or constant speed applications.
- TORQUE MODE: in this mode the input torque target is realized. This mode enables motor "freewheeling" when the torque target is
0
. Recommended for most applications with a sitting human driver.
Jeg har valgt å bruke FOC i VOLTAGE MODE for nøyaktighet
Control method | Complexity | Efficiency | Smoothness | Field Weakening | Freewheeling | Standstill hold |
---|---|---|---|---|---|---|
Commutation | - | - | ++ | n.a. | n.a. | + |
Sinusoidal | + | ++ | ++ | +++ | n.a. | + |
FOC VOLTAGE | ++ | +++ | ++ | ++ | n.a. | +(2) |
FOC SPEED | +++ | +++ | + | ++ | n.a. | +++ |
FOC TORQUE | +++ | +++ | +++ | ++ | +++(1) | n.a(2) |
(1) By enabling ELECTRIC_BRAKE_ENABLE
in config.h
, the freewheeling amount can be adjusted using the ELECTRIC_BRAKE_MAX
parameter.
(2) The standstill hold functionality can be forced by enabling STANDSTILL_HOLD_ENABLE
in config.h
.
In all FOC control modes, the controller features maximum motor speed and maximum motor current protection. This brings great advantages to fulfil the needs of many robotic applications while maintaining safe operation.
- By default the Field weakening is disabled. You can enable it in config.h file by setting the FIELD_WEAK_ENA = 1
- The Field Weakening is a linear interpolation from 0 to FIELD_WEAK_MAX or PHASE_ADV_MAX (depeding if FOC or SIN is selected, respectively)
- The Field Weakening starts engaging at FIELD_WEAK_LO and reaches the maximum value at FIELD_WEAK_HI
- The figure below shows different possible calibrations for Field Weakening / Phase Advance
- If you re-calibrate the Field Weakening please take all the safety measures! The motors can spin very fast!
- All the calibratable motor parameters can be found in the 'BLDC_controller_data.c'. I provided you with an already calibrated controller, but if you feel like fine tuning it feel free to do so
- The parameters are represented in Fixed-point data type for a more efficient code execution
- For calibrating the fixed-point parameters use the Fixed-Point Viewer tool
- The controller parameters are given in this table
Right to the STM32, there is a debugging header with GND, 3V3, SWDIO and SWCLK. Connect GND, SWDIO and SWCLK to your SWD programmer, like the ST-Link found on many STM devboards. If you have never flashed your sideboard before, the MCU is probably locked. To unlock the flash, check-out the wiki page How to Unlock MCU flash. Do not power the mainboard from the 3.3V of your programmer! This has already killed multiple mainboards. Make sure you hold the powerbutton or connect a jumper to the power button pins while flashing the firmware, as the STM might release the power latch and switches itself off during flashing. Battery > 36V have to be connected while flashing.
Det flere forskjellige måter å kompilere repet men jeg valgte å bruke: RoboDurden's online compiler:https://pionierland.de/hoverhack/
Videre fulgte jeg en guide av skaperen Niklas Fauth som forklarer hvordan man skal gjøre det: http://bauhausinteraction.org/opl/how-to-control-a-hoverboard-with-an-arduino/
The errors reported by the board are in the form of audible beeps:
- 1 beep (low pitch): Motor error (see possible causes)
- 2 beeps (low pitch): ADC timeout
- 3 beeps (low pitch): Serial communication timeout <-- Skjer ofte/arduinoen mister kontakten med hoverbordet
- 4 beeps (low pitch): General timeout (PPM, PWM, Nunchuk)
- 5 beeps (low pitch): Mainboard temperature warning
- 1 beep slow (medium pitch): Low battery voltage < 36V
- 1 beep fast (medium pitch): Low battery voltage < 35V
- 1 beep fast (high pitch): Backward spinning motors
For a more detailed troubleshooting connect an FTDI Serial adapter or a Bluetooth module to the DEBUG_SERIAL cable (Left or Right) and monitor the output data using the Hoverboard Web Serial Control tool developed by Candas.
- Original firmware: https://github.com/NiklasFauth/hoverboard-firmware-hack
- Candas Hoverboard Web Serial Control: https://github.com/Candas1/Hoverboard-Web-Serial-Control
- RoboDurden's online compiler: https://pionierland.de/hoverhack/
- Hoverboard hack for AT32F403RCT6 mainboards: https://github.com/cloidnerux/hoverboard-firmware-hack
- Hoverboard hack for split mainboards: https://github.com/flo199213/Hoverboard-Firmware-Hack-Gen2
- Hoverboard hack from BiPropellant: https://github.com/bipropellant
- Hoverboard breakout boards: https://github.com/Jan--Henrik/hoverboard-breakout
Every contribution to this repository is highly appreciated! Feel free to create pull requests to improve this firmware as ultimately you are going to help everyone.