Mamba F405 FC Item name: F405 Betaflight Flight Controller Input power: 12.6-25V (3-6S) BEC: 5V/1.5A MCU: STM32F405 Gyro: MPU6000 Flash: 16MB OSD: AT7456 Mounting hole: 30.5.30.5mm Weight: 6g Mamba F40 ESC Item name: Mamba F40HV ESC Input voltage: 3-6S (12.6V25V) Continue current: 40AA×4 Burst current: 40/50A (6S) BEC: NO Mounting: 30mm / φM3 Weight: 10g. Betaflight supports nearly all flight controllers on the market having at least an STM32F4 Processor. The Betaflight Configurator runs on Windows, Mac OS, Linux, and Android. The Betaflight Firmware supports all major Remote Control manufacturers like FrSky, Graupner and FlySky. ESCs are directed using PWM, OneShot, MultiShot, DShot or even. The Betaflight Configurator runs on Windows, Mac OS, Linux, and Android. The Betaflight Firmware supports all major Remote Control manufacturers like FrSky, Graupner and FlySky. ESCs are directed using PWM, OneShot, MultiShot, DShot or even ProShot. Not even less-related components stay untouched, so Betaflight allows to control VTX and Camera. Nov 28, 2017 Betaflight ESC telemetry is also very limited in terms of what you can display in the OSD at the moment (Nov 2017). The featured image on the top of the article, which shows RPM, temperature and current draw of each individual motor, is from my KISS quad running KISS FC and KISS ESC’s. New in Betaflight 4.2 Overview. Betaflight 4.2 Loop Rate Optimization. Betaflight 4.2 and Betaflight Configurator 10.7 Features Review. BAD TX Rate AND Betaflight 4.2 Settings to Improve. OpenTX ADC Filter: Disabling for Smoother Sticks. Betaflight Actual Rates Quick Rates & EmuFlight Dynamic Rates. Betaflight 7' Quad Tuning (6',7',10' etc.
What is CLI ?
CLI is abbreviation of the a Command Line Interface. It is special configuration mode where commands are given insted of the dedicated setting controls and inputs. Every flight controllers firmware configurator (Cleanflight, Betaflight, Butterflight, iNav, etc) has this mode. It is useful for more specific change of settings and detailed configuration the Flight Controller. It is also usefur for dumping the whole flight controller configuration, backuping and restoring the settings in the easy way. Read more about it below.
How to use CLI?
In order to start using CLI you have to connect to your flight controller with configurator software (See here how to install the standalone configurator software). Click on the “CLI” tab – this will enable flight controllers CLI mode. Write the command in the input field and hit the [Enter] to execute it.
You need to execute save
command if you want all the commands and changes to be saved into Flight Controllers memory. Saving will reboot the flight controller. Close the CLI tab or send the exit
command to exit the CLI mode without saving.
CLI Dump
or Diff
?
dump
command dumps all the setting of the flight controller. This can be quite a long listdiff
command was introduced in the BetaFlight version 3.0 and it dumps only the settings that are different from the defaults. diff all
command dumps only differencies from the defaults but also dumps all the PID profiles.
It is highly recommended to use diff
instead of the dump
as it results in the significant smaller settings list and only the ones that were changed or differ from the defaults.
How to Backup/Restore the settings using CLI?
Sometimes it is usefull to save the Flight Controller settings and restore them in case you need. These cases include FC firmware upgrade, restoring the FC to the point where it worked and etc. Backuping and restoring is very simple task.
Backup: Go to CLI, enter diff
(or diff all
if you have multiple PID profiles) and copy the provided text to anywhere just to save it for later use.
Restore: Go to CLI, paste the saved settings text to the command input field, hit [Enter]. Your FC settings are restored. Don’t forget to save the settings.
CLI commands list
Command | Description |
---|---|
1wire <esc> | passthrough 1wire to the specified esc |
adjrange | show/set adjustment ranges settings |
aux | show/set aux settings |
color | configure colors |
defaults | reset controller to defaults and reboot |
dump | print configurable settings in a pastable form |
diff | dump only the settings that are different from the defaults. Includes only the current PID profile. |
diff all | dump only the settings that are different from the defaults. Includes ALL PID profiles. |
exit | exit without saving |
feature | list or -val or val |
get | get the value of the specified variable |
gpspassthrough | passthrough gps to serial |
help | lists all commands |
led | configure leds |
map | mapping of rc channel order |
mixer | mixer name or list |
mode_color | configure mode colors |
motor | get/set motor output value |
play_sound | index, or none for next |
profile | index (0 to 2) |
rateprofile | index (0 to 2) |
rxrange | configure rx channel ranges (end-points) |
rxfail | show/set rx failsafe settings |
save | save settings and reboot |
serialpassthrough | serial passthrough mode, reset board to exit |
set | set the the given value to the variable. (name=value or blank or * for list) |
status | show system status |
version | show version |
serial | configure serial ports |
servo | configure servos |
sd_info | sdcard info |
tasks | show task stats |
mmix | design custom motor mixer |
smix | design custom servo mixer |
Note that specific command list depends on the type of the firmware (BetaFlight, Butterflight, iNav) and firmware version you are using. For exact list of the commands type help
in CLI mode.
Usefull CLI commands
bl
or dfu
command to enter the DFU mode without pushing the button. Reboots the FC board in bootloader mode.
set small_angle = 180
– sets any angle your quadcopter will be able to arm. Usefull when you land unexpectedly severely angled and you are unable to re-arm.
set ledstrip_visual_beeper = ON
– When set to on, and the LEDLOW mode is active (i.e. LED strip off), blink the LED strip in synch with beeping, as a visual indicator in cases where the craft is too far away for the beeper to be heard / multiple craft are flying. Values available: [ON,OFF (default)]
Binding with integrated Receivers (connected via SPI):
For Betaflight 4.x – command bind_rx_spi
For Betaflight 3.x: – command frsky_bind
Don’t forget to issue save
command after the sucessfull bind.
History:
2018-05-23 – article created
2019-02-13 – Usefull CLI commands updated
2019-07-01 – Usefull CLI commands updated
- Guide: How to Arm, PreArm and start your quad What is Arm and why do we need it? All modern quadcopters (or any
- ExpressLRS – Open Source Long Range radio control system – Complete Guide ExpressLRS is the Open Source Long Range radio control system, developed by Alessandro Carcione (aka AlessandroAU)
Keeping devices firmware updated is always important, especially when awesome new features are out. This is the case of Betaflight quadcopter firmware, which has introduced incredible improvements in 4.2 version allowing to better control drone movements and trace smoother trajectories due to improved noise handling through the use of advanced control algorithms.
Moreover Betaflight Configurator interface has gone through some changes since the last configuration article on this blog, so it is a nice opportunity to take a look at the updated version.
This is why in this article we are going to take a look at Betaflight 4.2, in particular version 4.2.8 (which at the time of this writing is the latest available), and how to setup and configure it.
Betaflight Configurator
As seen in some previous articles, Betaflight Configurator is a really popular application that allows to configure aircrafts loaded with Betaflight firmware via GUI.
Latest application version is available for download at this link for free. If you are using Windows, choose betaflight-configurator-installer_10.7.0_win32.exe, where 10.7.0 indicates the current Betaflight Configurator version: downloading this specific version (or above) is important in order to flash Betaflight firmware version 4.2 or above.
Once the application is correctly installed, it is possible to launch it. Then, it is just a matter of connecting the quadcopter to the PC using a micro USB (Flight Controller) to USB (PC) cable and clicking on “Connect” to establish the connection.
If you do not know how to install drivers to properly connect your drone to the PC in order to use DFU (Driver Firmware Update) mode, you can take a look at the “Drivers installation” section of this article.
Here is the Welcome screen of Betaflight:
Before proceeding, it is a good idea to click on Settings icon on the top right and enable permanently Expert Mode: in this way we can see all possible menus and options available in Betaflight Configurator, otherwise some of them are hidden. Another good move is to enable dark theme, since it reduces eyes strain.
In the bottom right corner of the window it is possible to verify Betaflight Configurator current version.
Betaflight Firmware Flashing
Before starting this process, remember to always backup your configuration. Betaflight 4.x PIDs configuration is completely reworked with respect to version 3.x, so it is not recommended to reuse old set up for PIDS parameters; however, having a backup is useful in case the quad is going to have issues with new version and we want to go back to the previous one. Moreover, LED strip or OSD configurations can be reapplied, so remember to launch a “diff” command in CLI tab and copy the output to a .txt file for eventual later use.
In order to install Betaflight latest firmware we need to know which flight controller board is mounted on our quad. If you do not know, you can simply navigate to the CLI tab, which is the Command Line Interface on the Betaflight Configurator and launch the “version” command (“Current firmware version check” section of this article).
In this article, the quad we are working on is the Eachine Wizard X220S (of course same following steps can be applied to every quad, just be careful selecting the correct hardware), which is equipped with OMNIBUSF4SD control board (F405), so we are going to select this board from the drop down menu combined with latest firmware version available:
Then we can click on the “Load Firmware [Online]” button to load the firmware. Once operation is completed, Betaflight firmware is ready to be flashed on the board, so we can click on “Flash Firmware”. The quad will go automatically on DFU mode and flashing procedure starts.
Betaflight Download Windows
If the procedure ends correctly we can “Exit DFU Mode” and start navigating through Betaflight Configurator tabs.
Betaflight 4.2.8 installed
Once Betaflight firmware is installed, when connecting the drone with the new firmware for the first time we could get the following message:
Just click on “Apply Custom Defaults” to start with the suggested default configuration for the board.
Moreover some warnings could pop up:
The most common is the one presented in the previous image, which tells us to calibrate the accelerometer.
Betaflight Setup Tab
Accelerometer, like magnetometer, can be calibrated in the Setup tab by just clicking on the related button:
In Setup tab we can also reset settings to default, backup/restore configuration (even if CLI settings are not included, for that we must use “diff” command) and reboot the board into bootloader / DFU mode.
Moreover drone current attitude (roll, pitch and yaw) is shown in real time through a 3D image.
In all the tabs we are going to review, changes are applied only after Save button at the end of the page is clicked.
If you do not plan to use Angle mode (stable / auto level) it is a good idea to disable accelerometer since this saves a good amount of resources reducing CPU Load, which should stay as low as possible. CPU Load should not go over 11-12% when the quad is sitting at the bench considering that during flight this value increases dramatically.
Betaflight Ports Tab
In Ports tab we set ports to be used by the board. In this case we have enabled USB port and UART6 serial port for receiver connection:
On OMNIBUSF4SD board UART6 is configured for SBUS, which is the protocol used by FrSky transmission systems: this is the configuration we have to use since on this X220S there is an XM+ receiver installed communicating with FrSky Taranis X9D Plus SE 2019 transmitter.
Betaflight Configuration Tab
In Configuration tab, in Mixer section it is possible to set quad type and reverse motor rotation direction. System configuration allows to set Gyro update frequency and PID loop frequency. Generally this is related to ESC/motor protocol chosen in ESC/Motor features section: if we set DSHOT600 we should go for 8KHz update frequency, while DSHOT300 is more suitable for 4KHz. Higher values are preferred, but this is a good choice only if CPU Load does not go over 11-12%. This is why at every configuration change comporting an increase in computational workload on the CPU, we have always to keep an eye on the bottom of the page where CPU Load value is reported: in this case it is at 9%.
Remember also to disable MOTOR_STOP because we want motors to spin when armed; even if this is a security option, we are going to address this issue by setting up a prearm switch in Modes tab, so motors do not start spinning if we inadvertently flip the arm switch.
Bidirectional DSHOT is not enabled by default, but it is a very nice feature. Basically it enables the capability to receive telemetry from the ESCs, so the flight controller can use the information received to better control the PID loop. This is why enabling bidirectional DSHOT allows RPM filtering settings (configuration is made on PID Tuning tab -> Filter Settings -> Gyro RPM Filter). Be careful to set the correct number of motor poles, i.e. the number of magnets on the motor bell (generally motors on 5 inch quads have 14 magnets). Bidirectional DSHOT can be enabled only if ESCs have been flashed with supported firmware and this can be done both for BLHELI_32 and BLHELI_S: for BLHELI_32 this can be done by updating the firmware through BLHeli Suite, while for BLHELI_S (which is the case of the Eachine Wizard X220S) we need to download JazzMaverick firmware (free) and flash it on the ESCs using BLHeli Configurator. We just need to download version 16.73 for our ESCs, because versions after 16.73 are declared incompatible with RPM filtering from Betaflight developers. In the case of the Eachine Wizard X220S correct firmware is A_H_30_REV16_73.HEX. To download the firmware just select the correct firmware from the list by left clicking it and then, on the page that opens, right click on the “Raw” button on the right selecting “Save link as” to save the file on your computer. Once done, you should find the .HEX file in the path you specified during the save.
Then it is just a matter of flashing the firmware on the ESCs using BLHeli Configurator by selecting the downloaded .HEX file with “Select File Manually” option.
Remember to always keep an eye on CPU Load when enabling this feature since it is computationally intensive.
Motor Idle Throttle Value indicates the percentage of throttle in idle: 6%-8% is generally a good compromise also in order to avoid death rolls and have more floating time when cutting off throttle.
Set 180° in Arming section so as to enable arming of the quad even if the aircraft is upside down (useful if quad crashed and it is stuck somewhere with a certain angle).
The other two important parameters we need to set are in Receiver section to complement what we have already set in Ports tab, i.e. our receiver configuration: since, as stated before, we are using FrSky XM+ receiver, we have to choose Serial-based receiver (SPEAKSAT, SBUS, SUMD) from the first drop down menu (Receiver Mode) and SBUS from the second one (Serial Receiver Provider).
In Other Features just remember to enable AIRMODE, OSD and DYNAMIC_FILTER. Airmode is a must since we need and want control of the quad at zero throttle. In this case, also LED_STRIP is enabled since Eachine Wizard X220S has a led strip on the back indicating aircraft movements.
Betaflight Failsafe Tab
In Failsafe tab we set failsafe stages: Stage 1 is generally entered when TX loses connection with receiver. At that moment, channel fallback settings are applied to all channels. From that moment there is a time, called guard time, until Stage 2 is entered: guard time is configured in Stage 2 - Settings section where a value of 1 means 0.1 sec, so a value of 10 means if Stage 1 is triggered then there is a guard time of 1 second to recover connection between transmitter and receiver (and the quad is armed) before Stage 2 is entered.
In Stage 2 - Failsafe Procedure we can configure the action to take when Stage 2 is entered; there are three options:
- Drop: quad turns off motors and drops down
- Land: quad attempts an emergency landing
- GPS Rescue: basically a “return to home point” like feature, available only if drone is equipped with a GPS module
Choosing one instead of the other is a matter of preference, however “Land” option is not recommended. “Drop” option is preferable for short range freestyle flights, while “GPS Rescue” is a must for long range builds.
On Channel Fallback Settings it is possible to set the value the channel will get when a failsafe happens: here it is a good idea to change the settings for the RSSI channel (AUX12) so RSSI value goes to zero when connection to the receiver is lost (otherwise by default it will “Hold” on that value). Since the value of 1000 corresponds to the minimum, i.e. zero, we are going to change “Hold” to “Set” and type this value.
Betaflight PID Tuning Tab
PID Tuning tab contains three sub tabs:
- PID Profile Settings
- Rateprofile Settings
- Filter Settings
PID Profile Settings
PID Profile Settings allows to configure PID (proportional, integral, derivative) values and Feedforward for each one of the rotational axes (x, y, z) by means for roll, pitch and yaw.This can be done by changing singular values in the table or using the four sliders:
- Master Multiplier: increases all PIDs in a balanced way (having a 5 inch quad as reference, for bigger quads -> slider to the right, for smaller quads -> slider to the left)
- PD Balance: slider to the right progressively increases P (in case we need more responsiveness)
- P and D Gain: this is the most important slider, from this one we get the compromise between responsiveness and oscillations/propwash occurrence; the good thing is that P and D values automatically balance while moving the slider
- Stick Response Gain: this slider modifies feedforward values; basically feedforward reduces PID controller action latency, i.e. how fast the quad responds to our commands. How to set this parameter depends from the flight style: slider to the right means a more nervous behavior for aggressive maneuvers; sliders to the left for a smooth/cinematic flight style.
Sliders are particularly useful for users new to tuning and largely simplify the process. While moving sliders to left or right, variations on PIDs can be seen in the table above. The fundamental step is to change sliders with small steps, flying after every change to test the difference in quad response. If Expert Mode is not enabled, sliders movement is reduced.
In PID Controller Settings section it is possible to set Feedforward transition, which represents how feedforward control acts and can vary from a minimum of 0 to a maximum of 1: higher values determine a more relaxed action (a value of zero gives more reactivity to input controls).
Dmin sets a minimum value for D parameter, so it will vary from a minimum to a maximum value depending on how we move the sticks, for example how fast we move them: this means that D parameter is dynamic. Personally I do no use this functionality, so I keep it disabled.
When changing values in PID Tuning tabs it is important to always check motors temperature: if they are getting too hot, by means it is uncomfortable to hold them with hands, that is an indicator that they are not able to handle that configuration and we should go back to the previous one.
Before starting to play around with these parameters, testing a first flight with defaults is recommended. Betaflight developers have done a great job with Betaflight 4.2 version and you will be amazed to find that even with default values the quad flies great.
Betaflight 4.2 Tuning Notes
Before proceeding to the next tab, it is worth to take a look at the following page that reports tuning configurations for different fly styles directly made by Betaflight developers: Betaflight 4.2 Tuning Notes.
The following one, as stated, is made for HD (smoothed FF for HD cameras, strong low turn rate smoothness, low iterm relax to minimize bounce back):
To use a certain configuration, it is just a matter of going in the CLI tab, copying and pasting the code snippet and pressing Enter. Then we have to save the parameters by simply writing the “save” command and pressing Enter again.
However, in case we do not like the feeling with a particular setup, we can always go back to the default configuration by copying and pasting the default parameters setup in the CLI and then saving the changes.
Return to defaults:
Rateprofile Settings
In Rateprofile Settings tab we can set rates and expos, i.e. the relation between stick movements and rotational velocity of the quad along its axes.
The graph is really useful since it show how roll/pitch/yaw profile curves modify after changing RC Rates, Rates and RC Expo values.
The configuration above gives a good rotational speed smoothing stick sensitivity for central movements.
Filter Settings
In Filter Settings tab, sliders come back. Be really careful when playing with them and always keep attention when you turn on motors after changes. If after turning on everything looks ok, it is a good practice to fly for 30 seconds and check motors temperature.
Gyro RPM Filter is displayed if we have enabled Bidirectional DSHOT in Configuration tab and this is a must have, especially if our build and motors have some flights on the back since it does a great job handling noise.
Having Dynamic Notch Filter at zero is another must have.
Betaflight Receiver Tab
In Receiver tab, if we have correctly setup the receiver in Ports and Configuration tabs, we should see channel values changing when moving the sticks on the transmitter. So it is just a matter of setting the Channel Map to map correctly sticks movements to channels based on transmitter sticks mode (Mode 2 in this example): for this FrSky Taranis X9D Plus SE 2019 it is TAER1234 and RSSI Channel is mapped to AUX 12 for XM+ receiver.
Take a look at how to setup and configure switches for the FrSky Taranis X9D SE 2019 on Betaflight article if needed. This is also useful for next tab.
Betaflight Modes Tab
In Modes tab it is possible to map transmitter switches to Betaflight flight modes or features.
Here there are the most useful: ARM, ANGLE, HORIZON, BEEPER, FLIP OVER AFTER CRASH, PREARM.
Betaflight Motors Tab
Betaflight Configurator
Motors tab is useful to check motor errors percentage, which is the value in red after “E:”. You have to connect battery to the quad in order to make this test. It should always stay under 1% while moving the sliders up and down.
Always make sure propellers are removed when testing and never run motors for more than few seconds or you can burn them since propellers are not there to cool them down.
Betaflight OSD Tab
OSD stands for On Screen Display: here we can set all the informations we want to visualize on the FPV Goggles.
The most useful are for sure battery voltage, RSSI and flight time.
Betaflight LED Strip Tab
Since Eachine Wizard X220S has led strips on the back, we need to reconfigure their values. Thankfully we have saved the previous configuration through “diff” command, so we can just use CLI to bring it back:
On LED Strip tab we can verify the success of the operation:
Betaflight Blackbox Tab
Betaflight Blackbox is a must have, since it can help us evaluating how good are the parameters we have set in PID Tuning tabs.
In fact, having Blackbox enabled allows the quad to write flight logs on SD card, so we can check them post flight to verify if there is something wrong with the quad: we can do this by feeling it, but this is definitely the best way to finely tune the quad.
If you are interested, check this simple example of how Betaflight Blackbox is useful to analyze quad problems.
Betaflight CLI Tab
Like stated before, in CLI we can insert commands and set parameter values.
Betaflight Wiki
After setting values it is important to use “save” command to commit changes.
Conclusions
Betaflight Camera Control
In this article we have seen Betaflight 4.2 firmware features, in particular 4.2.8 version, and how to setup and configure them using Betaflight Configurator 10.7 on the Eachine Wizard X220S equipped with OMNIBUSF4SD board and FrSky XM+ receiver. This firmware is a real game changer with improved algorithms and parameters control allowing smoother flying and better handling of propwash effects.