Betaflight 4.0 RPM Filter HOW-TO
Updated: Mar 4, 2019
Betaflight 4.0 is set to release in April 2019 and there are some really exciting new features coming with it. Inarguably the most anticipated new feature coming with version 4.0 is Bidirectional DSHOT and with it, RPM Filter.
In this write-up, I will go through the setup process for Bidirectional DSHOT and the RPM Filter. It is intended for those of you, like me, who can't wait to try it. It is still in development and trying it will come with certain dangers. TRY AT YOUR OWN RISK.
The geniuses at Betaflight depend on us for feedback to perfect these new features and that is why I do encourage as many people as possible to try it out. So let's go.
What is Bidirectional DSHOT and RPM Filter?
From Betaflight WIKI:
“Bidirectional DSHOT is a new feature in Betaflight 4.0 which enables the flight controller to receive high-frequency RPM telemetry for each motor on the ESC motor signal line.”
“The RPM filter is a bank of 36 notch filters on gyro and Dterm which takes advantage of this high frequency RPM telemetry data to implement a motor harmonics filter which removes motor noise with surgical precision. In its default configuration it runs 12 notch filters each on pitch, roll, and yaw, covering the first 3 harmonics of each motor's RPM for the gyro filter bank.”
What does this do for flight performance and characteristics?
In essence, the gyro is constantly telling the flight controller what the quadcopter is doing in physical space. The data from this sensor is fed into the PID controller so that corrections to flight characteristics can be made and verified. The cleaner and more accurate the information is from the gyro, the better and faster corrections can be made.
Vibrations caused by motor and prop movement are also detected by the gyro and this creates problems for the gyro in the form of noise. Betaflight uses filters to smooth out gyro data and tell the flight controller to ignore the noise from motors. This is what the “Filters” tab is all about in Betaflight Configurator.
These filters work great but they create latency between when something physically changes with quad and the output of a correction by the flight controller. - The “disconnected” feeling pilots try to minimize.
The RPM filter receives RPM information from the motors in the form of telemetry data from the ESC’s. The data is sent to the flight controller via the signal wire using Bidirectional DSHOT. (no extra telemetry wires are required) With this data, the flight controller can almost completely eliminate motor noise from the gyro with extremely low latency giving the PID controller very clean information to work with.
How to enable Bidirectional DSHOT and RPM Filter
First you will need to download special firmware for your flight controller and BLHeli32 ESC’s.
Latest successful build for flight controller: https://ci.betaflight.tech/job/Betaflight/lastSuccessfulBuild/artifact/obj/
Download the correct hex file for your flight controller
BLHeli32 test firmware:
Download the test code hex files.
Flash these firmware’s to your flight controller and BLHeli32 ESC’s
For flashing instructions, check out these how to’s.
Flight Controller - https://oscarliang.com/flash-update-betaflight/
Setup your flight controller as normal and test fly to be sure there are no problems before enabling Bidirectional DSHOT. If you would like to read about the reasoning and descriptions of the following changes, go here. https://github.com/betaflight/betaflight/wiki/Bidirectional-DSHOT-and-RPM-Filter
Go to CLI
Type the following commands:
(be sure to count the poles of your motor or look up the specs, most 5in motors use 14 poles)
After your flight controller reboots, go back into the CLI and type
Now find the (Gyro/PID) line and verify your rate is reading at what you set your PID loop to. For example, 4k/4k should be close to 4000hz. You need the value to be less than 1% off of your loop time. If your value deviates further, you need to lower your loop time until it's within 1% of what you set. (Lower loop times have very little effect on flight performance when using the RPM Filter)
Go fly it. If your flight is successful, congratulations, you must be feeling great. Now you can begin to tweak the settings to get even more out of it.
*THE FOLLOWING SETTINGS ARE INTENDED FOR USE WITH A VERY CLEAN AIR FRAME AND VERY SMOOTH PROPS. BE VERY CONSCIOUS OF YOUR QUADCOPTER'S CONDITION BEFORE PROCEEDING*
They are calling this the “Sugar_K” tuning. At this point, I recommend saving a dump of the CLI so if you need, you can revert back to good settings. In case your quad doesn't like something, you have the stock values.
I also recommend reading the "Sugar_K" section of this page:(https://github.com/betaflight/betaflight/wiki/Bidirectional-DSHOT-and-RPM-Filter)
to understand what the following changes are actually doing as this has the potential of damaging quads with less than great components. Be mindful of your motor temp and sound when proceeding.
Go back to CLI and enter these commands:
set dterm_lowpass2_hz = 0
set dyn_notch_width_percent = 0
set dyn_notch_range = medium
set dyn_notch_min_hz = 200
set dyn_notch_q = 200
Go fly these with these settings and verify nothing weird happens. If you are still good, you can take it even further.
Go back to CLI and enter these commands:
set gyro_lowpass_hz = 0
set dyn_lpf_gyro_max_hz = 0
Go fly and pay attention to your motor temperatures. If they get too hot, try this:
Go back to CLI and enter:
set gyro_lowpass_hz = 150
set gyro_lowpass_type = PT1
At this point, you would be done, but if your quad wants more…
Go back to CLI and enter these commands. I recommend a test flight after each of these changes:
set dyn_lpf_dterm_max_hz = 300
set dyn_lpf_dterm_min_hz = 200
set tpa_rate = 60
set tpa_breakpoint = 1750
If you try this and have problems or suggestions, please join the Betaflight Slack group to offer feedback. This is how new features either become a success or failure so please contribute.