Hello guest, if you read this it means you are not registered. Click here to register in a few simple steps, you will enjoy all features of our Forum.
This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adjusting filters - quick & dirty (work in progress)
#1


   Short tutorial: How to adjust filters  (work in progress)



   DISCLAIMERS:
  1. how to set up / use external blackbox logging devices is not covered in this tutorial
  2. in future versions of betaflight, adjusting notch filters might become obsolete
  3. this is just the way i do it - there might be better ways. Discussion/tipps welcome

   GENERAL WARNING:

More filtering, i.e. filtering at lower frequencies as well as using wider notch filters, will increase the delay between the copter's real movement and the data fed into the PID loop, which can have a variety of negative effects on flight behaviour. I specifically do recommend to NOT use notch filters below ~140Hz. Further, with today's strong motors and possibly heavy props it is highly recommended to softmount fc and/or motors to reduce the amount of filtering needed.

I will add more in-depth details in a second post below.



   What you need:
  • a flight controller capable of logging data internally or on SD card, or an external blackbox logging device 
  • chrome browser to run blackbox explorer as extension
  • blackbox explorer (links: betaflight version  /  cleanflight version  /  iNav version)



   Step 1 - Set up blackbox mode:
  • enable blackbox feature on configuration page
  • in blackbox tab: choose the correct target for your flight controller (internal flash memory or SD card)
  • in blackbox tab: choose an appropriate logging frequency (usually 1kHz is good enough)
  • in modes tab: set blackbox to be used on a switch in order to enable/disable it in-flight
  • in CLI: set debug_mode to "gyro" or "notch" (don't forget "save" after changing things) (warning: "gyro" means much more data)

   Step 2 - Create a log file:
  • take off with a fully charged battery
  • enable blackbox mode in-flight
  • do a clean full-throttle punchout
  • try to bring your quad down again without excessive propwash
  • disable blackbox mode before landing
  • depending on your hardware: export log in blackbox tab or take out SD card
  • if using internal flash memory, you can erase it after exporting

   Step 3 - Set up blackbox explorer:
  • open your log file
  • click "Graph setup", choose the correct graphs (see pic below), optionally edit labels and display options
  • press shift-key together with a number key from 0-9 to save this graph setup (number key to recall it)
           


   Step 4 - analyze log data and adjust filters
  • follow steps in image below to see the noise spectrum of pre-notch or raw gyro graphs
  • in configurator, adjust the gyro notch filters to match the noise peaks in the spectrum graph
  • if the overall noise level is high, lower lowpass filters accordingly
  • repeat step 2, then compare pre-notch or raw gyro to the normal (post-filter) gyro graphs
  • repeat steps 2 and 4 until you think you hit the noise peaks well enough
         



   Extra functions in Blackbox Explorer

   How to measure a frequency:

If you see noise (waves) in the gyro lines you can find out the exact frequency of that noise. To do this, place the time marker at the start of a wave, press "m", then place the marker at the end of a complete wave to measure the time (either peak to peak, or zero-crossing to zero-crossing). The explorer will automatically display the frequency (see attached example pic below).

   

   How to analyze a specific part of the log:

You can analyze the noise spectrum of only a specific region of the log file, for example in order to exclude landing impacts, or to see what happens under specific conditions or movements. To do this, use the "i" and "o" keys to mark the start and end of the region you want to analyze. This will create vertical white lines marking the "in" and "out" and grey out the rest of the log (see attached pic below). If you now click the spectrum analyzer button, it will only use that part to create the graph.

   



   Example pics pre- and post-filter:

       (pre-filter gyro roll)


       (post-filter gyro roll)

   Note: In this example only 1 gyro notch filter was used. Also, dterm notch was not adjusted at all.



That's it, hope it helps. It may look like a lot, but once you have set up blackbox explorer it really isn't. Usually you can adjust notch filters in 2-3 runs. One thing to be aware of is that the PIDs should be set well enough to have the copter rev up fine, otherwise oscillations caused by PIDs could prevent it from reaching high rpm to begin with. Increasing TPA might help here.


TO DO list:
  • add example pics of pre- / post-filtering
  • add more links for blackbox explorer versions for different firmwares
  • add more in-depth details regarding filter delays, different filter types, and d-term filters in 2nd post
[-] The following 7 users Like fftunes's post:
  • hailenp, Kerni_fpv, Oscar, Drone0fPrey, unseen, KonradS, sloscotty
Reply
Login to remove this ad | Register Here
#2
Some more details  (to be continued, work in progress)



Removing notch filters / changing filter lowpass types to reduce delay:

Less filter delay means better response and better propwash handling. For this, you can make notch filters more narrow or remove completely (by setting frequency to zero), and possibly change lowpass filter types (via CLI) from biquad to pt1.

WARNING: Be very careful when trying to change dterm lowpass type to pt1, especially on gyros that are capable of running at 32kHz. I've read several reports where quads instantly went full throttle after arming. It seems that the base noise on those super-sensitive gyros is too much to allow any less dterm lowpass filtering than a biquad-type.

Oscar also made a post about this: http://intofpv.com/t-i-can-t-believe-it-...s-week-lol



Comparison between wide and narrow notch filters (delay and magnitude)
(pictures taken from rcg member r.a.v. from this post)

[Image: lxO0nP5l.png]


[Image: wrYPyOOl.png]


Special Case: Resonating props (and no bb logger available)


if you find that it's your props alone that are vibrating/resonating, there's ways to measure that frequency:



From what i read, the app used in the vid is named simply "FFT spectrum analyzer".
Then you could adjust narrow notch filters covering this frequency.
Reply
#3
Great step-by-step tutorial - can't wait to see more!
[-] The following 1 user Likes sloscotty's post:
  • fftunes
Reply
#4
Thanks! This should be a good start to a very informative thread. For anyone who hasn't experimented with BB logging, you've shown that it's not nearly as complicated as it seems.
[-] The following 1 user Likes RENOV8R's post:
  • fftunes
Reply
#5
(16-May-2017, 07:31 PM)sloscotty Wrote: Great step-by-step tutorial - can't wait to see more!

Thanks, hope it's useful enough for now... regarding actual filter delays i will have to dig through rcg betaflight thread for some pics and quotes of people who actually know what they're talking about Wink which might take a while.

(16-May-2017, 07:48 PM)RENOV8R Wrote: Thanks!  This should be a good start to a very informative thread.  For anyone who hasn't experimented with BB logging, you've shown that it's not nearly as complicated as it seems.

And thank you too. Yes, do it once or twice and it becomes easy routine. Not too much to think of really.
Reply
#6
Great stuff I'll be putting it to the test on Saturday.
carl.vegas
Current Quads: Operational: Diatone GT2 200 In need of repair: Bumble Bee, tehStein,  Slightly modified Vortex 250 
[-] The following 1 user Likes Carl.Vegas's post:
  • fftunes
Reply
#7
Hi! Is it crucial to enable it after takeoff and to disable it before landing?
Reply
#8
(18-May-2017, 11:27 PM)varkokonyi Wrote: Hi! Is it crucial to enable it after takeoff and to disable it before landing?

Keep in mind the blackbox will record landing impacts which can be high amplitude low freq... as well as noise feedback while starting motors on the ground. It all will show up in the noise spectrum.

Enabling/disabling in-flight also allows to keep log files smaller (faster exporting from internal flash memory).

I'd say it's not absolutely necessary but makes reading the noise spectrum a lot easier.
Reply
#9
Okay, got it, thx. Makes sense.

Exporting is not a problem, I have an SD card.
[-] The following 1 user Likes varkokonyi's post:
  • fftunes
Reply
#10
I dont have an option for pre filters but post filters it looked pretty clean so I just tuned pids and its flying great today
carl.vegas
Current Quads: Operational: Diatone GT2 200 In need of repair: Bumble Bee, tehStein,  Slightly modified Vortex 250 
Reply
#11
(20-May-2017, 03:19 PM)Carl.Vegas Wrote: I dont have an option for pre filters but post filters it looked pretty clean so I just tuned pids and its flying great today

In cli, set debug_mode = notch, for example Smile
Reply
#12
I did... in fact... it was the very first command line I've ever sent to a quad
  [Image: d6f83ad32b27e177a88a034b1befb24f.jpg] 
but its flying great now so I am not as worried really. I have propwash issues but that's about it.
carl.vegas
Current Quads: Operational: Diatone GT2 200 In need of repair: Bumble Bee, tehStein,  Slightly modified Vortex 250 
Reply
#13
Oh. I'll add in the guide that you also have to type the "save"-command after changing things in CLI. Big Grin

Also optimizing filter delay can make a big difference regarding propwash, but haven't written anything about this yet. Might try later today. Flying comes first, feel like i haven't been flying for ages... Sad
[-] The following 1 user Likes fftunes's post:
  • Drone0fPrey
Reply
#14
Added "Extra funtions in Blackbox Explorer" in first post, and started on details in second post. Hard to dig through betaflight thread over there... i know the infos are somewhere. Rolleyes


EDIT: Also added a warning regarding dterm lowpass filter type. Be VERY CAREFUL especially when changing it on gyros that are capable of running at 32kHz, i've read reports of quads instantly sky-rocketing upon arming after changing dterm lowpass type.
Reply
#15
BTW I never got back to this but I am curious... if I find very little noise, mostly in the very low end... Should I be considering greatly reducing or removing filters? Will it give me significant improvements in my flight characteristics?

I'll try to post screenshots soon... My pre-filter looks much like post-filter... I'm thinking the nylon standoffs work better than I expected on my build...

Then again, maybe I am doing something wrong... it's almost suspiciously clean if you ask me!
carl.vegas
Current Quads: Operational: Diatone GT2 200 In need of repair: Bumble Bee, tehStein,  Slightly modified Vortex 250 
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Fettec G4 mixed with Betaflight 60 amp 6S esc mattyfleischfpv 0 185 16-Feb-2024, 03:19 PM
Last Post: mattyfleischfpv
  LiPo Voltage Quick Chart peek2much2 4 16,601 11-May-2022, 12:41 AM
Last Post: Pathfinder075
  ESC Quick 1-wire ESC Flashing Harness Aaron 0 2,101 25-Apr-2017, 06:50 AM
Last Post: Aaron
  Accessory Quick & Cheap LED's For Quad lolFPV 8 3,911 10-Aug-2016, 06:30 PM
Last Post: KonradS
  Tutorial Quick Tutorials seafurymike 2 3,142 14-Jan-2016, 05:31 PM
Last Post: Nightcat


Login to remove this ad | Register Here