What are filters and why do we need to tune them ?
✅ Filters are good
Your gyroscope is sending a noisy signal to your flight controller, but Betaflight’s filters will “clean” this data.
Without filters, your motors would try to react to these fast oscillations. They would heat and eventually burn! Filters are basically there to protect your motors.
❌ Filters are bad
Due to their nature, filters have to wait for a short period of time before being able to process the signal and remove undesirable noise. This is called the phase delay.
The phase delay is only a few milliseconds, so that’s not something you will notice as a pilot, but when your quad has to react very quickly, this small delay can cause troubles to adapt fast enough to the oscillations. It’s exactly what’s happening during propwash.
➜ Filters need to be tuned
Most of the time, Batflight’s default settings apply much more filtering than we actually need.
Reducing the amount of filters also reduces the phase delay, which means better overall performance. But we also need to keep enough filtering to prevent our motors from overheating.
Filter tune will be about finding the right balance.
BETAFLIGHT FILTER SETTINGS
(This tune was made on Betaflight 4.2. Remember to update to the last version if you want the best performance)
You can find the filter settings in Betaflight under PID Tuning > Filter Setttings.
The section A contains all the gyro filters. They will be controlled by the top slider.
The section B is about D-term filtering which will be controlled with the bottom slider.
The RPM filters are very efficient. In order to activate them, you first need to go to the configuration tab and make sure that “Bidirectional DShot” is enabled (only supported by BlHeli_32 ESC). You don’t need to change the default settings for this section.
But the dynamic filter is not set to the optimal value! These settings are trying to track the motor noise, but it’s already been cleaned by the RPM filter (if you enabled it). Let’s adjust the value to track anything else we would like to filter like a frame resonance, a bent propeller, …
The recommended settings are:
- 0 Width Percent
- 250 Notch Q
- 90 Min Hz
- 350 Max Hz
Pushing the filter sliders to the right will increase the filter frequency: that is what we call “reducing filters”. A higher frequency means a smaller phase delay.
At some point, Betaflight gives you a warning message because reducing the filters too much can be dangerous for your quad, as explained in the introduction. If you want to go above 1.5 on these sliders, you first need to enable “expert mode”.
To get the right tune, you want to increase the sliders together a few notches at a time and then make sure your quad can handle it. That’s where Blackbox Explorer will come in very handy. But for the first test flight, we want to leave them at default for now.
SET THE BLACKBOX
The last thing we want to set is the blackbox.
You need to go to the black box tab, enable the recording, set the logging rate at 2KHz and finally set the debug mode to Gyro_Scaled. This option will record the gyro data before the filtering, so we can compare it with the filtered signal. And finally, hit “Save and reboot”.
To get a good log file, here is what you will try to do:
- Fly FPV or line of sight if you can, preferably in acro mode
- Use the whole range of your throttle: go for some throttle punches a few times
- Get data across all three axes (even though yaw is not the most important): do some flips and rolls
- Try to get some propwash
- Fly like this for about 2 minutes
When you land, check the temperature of your motors by pinching them.
If they are slightly warm it’s ok, but if they are so hot that they hurt, you may need to apply more filtering rather than reducing them.
Open your log files
If you used your flight controller flash memory, you need to go to Betaflight and get to the Blackbox tab. There, you can activate “mass storage device” which will let your flight controller become a classic storage device. You can now easily access the flash memory of your flight controller and copy your log from there.
Then, you need to download the Blackbox Explorer and install it.
Download Blackbox Explorer
You can now easily open your file by double-clicking on them.
Setup the Blackbox Eplorer
Let’s get the data we need for filter tuning. Click on “Graph setup” and remove all the graphs. You can now add the graphs: Gyro, Debug, and a custom graph. For this custom graph, select PID D in the dropdown menu, and hit “Save changes” when you’re done.
You can also isolate a specific part of the flight. It’s better to remove the takeoff and the landing which can cause weird oscillations and could pollute our data.
The timeline at the bottom of the screen displays your throttle value over the flight. Click a bit after the beginning of the flight and hit “I” on your keyboard for the in point, then click near the end and hit “O” for the out point.
Analyze the first test flight
If you click on any of those buttons, it will show the graph analyzer from the selected data.
Let’s see the Gyro Scaled [roll] first so we can have a look at all the noise from our quad before the filtering.
On the horizontal axis, you can see all the different frequencies, and the vertical axis is the amplitude of those frequencies. The left part of this graph is the actual quad movements (your stick movements). That’s why there is so much of it, so you don’t have to worry.
Anything above that will represent the oscillations we want to deal with.
If you have a spike around 70 or 100 hertz, it will most probably be the propwash.
And finally, the wide noise you can see in the middle is the mother noise. There will always be that kind of noise on every quad, but depending on your motors, your quad size, or weight, it will look different and can be at higher or lower frequencies. The reason why it is so wide is because the motor noise frequency rises with your throttle.
Now that you have an idea on how to interpret this data, let’s check what the filtered signal looks like by clicking on the Gyro [roll] graph analyzer.
As you can see, the filters did a great job here: there is no noise at all on any axis. But if we compare the Gyro [roll] for example with the PID D [roll], you can see that it got amplified a little bit.
This is because of the nature of the D-term which is extremely sensitive! Even the slightest noise can be amplified and will be sent to the motor as a noisy signal. But in this case it is still being filtered quite well.
That means we have some room to reduce our filtering by moving the sliders to the right. I will increase them to 1.2 and do another test flight.
Analyze the second test flight
Here is what my test flight with the sliders at 1.2 looks like:
Since there is not much difference, I will keep going.
You can keep pushing your sliders to the right one or two notches at a time depending on the amount of noise that is ending up in your gyro signal, on your D-term, or also if your motors are getting hot.
If you think you reached a point where you went a bit too aggressive with your tune, you can always go back by lowering the sliders by one notch and then make a comparison with a new test flight.
Repeat until you’re good
Doing these steps a few times will allow you to find a “sweet spot” where the motors are not too hot and the Blackbox doesn’t show excessive noise.
Remember that you also need to leave some room for occasional noise. For exemple, if you crash and damage a propeller, it will cause oscillations that you didn’t have during this test. You still want your filters to be able to remove that excessive noise.
It is possible to reach the end of the slider range and have good results, if your quad components are reliable. But I also recommend to check if it really gives you better flight performance. It’s not necessary to go further if your propwash already disappeared and you feel like your quad performs really well.
For all of these reasons, I left my slider at 1.5 and I’ve got very good results with a cinematic FPV quad. Here is my final log:
That’s it for the easy method. You should now have an increased performance while still making sure your motors are safe. If you want to push your tune even further, the next article of the series will cover more advanced tool like PID Toolbox, so stay tuned !