Skip to content

Software Filter Configuration ​

Filters strip the vibration and noise coming from the motors, propellers and the outside world, so the EKF gets clean IMU attitude data. That avoids bad attitude estimates and makes the aircraft steadier and nicer to fly.

ArduPilot has two software filters:

  • Low-pass filter: passes everything below the cutoff frequency (the control signal) and suppresses everything above it.
  • Notch filter: cuts deeply at one narrow band of frequencies (digs a hole) while leaving the rest of the spectrum as intact as possible.

WARNING

Filters add phase delay and CPU load, so use them carefully on slower processors (STM32F7/F4 for example). Software filtering only eases vibration — it cannot fix a serious mechanical problem. If the vibration is severe, change the hardware or add better damping. And tune the PIDs until the aircraft flies steadily before you start configuring filters.

Low-pass filter ​

Match the low-pass filter to the aircraft's weight, inertia and how responsive you want the control. ArduPilot's low-pass filtering is set by INS_GYRO_FILTER (gyro) and INS_ACCEL_FILTER (accelerometer). For manual setup you normally only need INS_GYRO_FILTER; INS_GYRO_FILTER=20 (the default) suits most aircraft.
Mission Planner, LGC and other ground stations can match the filter parameters to the frame, power system and propeller size automatically.

What the wrong value looks like

ValueSettingDownsideUpside
Too highINS_GYRO_FILTER = 60More IMU noise, which can make the aircraft twitch or the motors screech and overheatLess control-loop delay, livelier response; if you want that response, add a notch filter to calm it down
Too lowINS_GYRO_FILTER = 15Large phase lag, sluggish, soft attitudeFilters more noise out

NOTE

The principle is to push the cutoff as high as the filtering allows — find the balance between the two.

Notch filter ​

What the notch filter does

A dynamic notch filter is an adaptive narrow-band filter: it follows the motors' actual speed and moves its centre frequency to stay on the vibration, which is how it suppresses the periodic mechanical noise the motors make. It complements the low-pass filter.

It tracks the motor's fundamental frequency and each harmonic in real time, attenuating energy exactly where the vibration peaks sit, so the rest of the spectrum — the attitude signal you need — comes through untouched and the controller keeps its responsiveness.

Put simply: the low-pass filter pushes the broadband noise down, the dynamic notch cuts out the fixed, periodic motor vibration, and together they give you both quiet data and good feel at the sticks.

How to configure it

  • Before anything else, enable the logging you need (INS_RAW_LOG_OPT = 10).

On firmware before 4.5.0, use the IMU batch sampling instead:

INS_LOG_BAT_OPT= 4    //sample at 1 kHz before and after filtering
INS_LOG_BAT_MASK = 1    //record the first IMU
INS_LOG_BAT_LGIN        //sampling interval; no need to change it normally
LOG_BITMASK             //do not tick RAW IMU; on top of the defaults tick Fast Attitude / PID / Fast IMU / Fast harmonic notch logging
  • If the power system has RPM telemetry (DroneCAN or BDShot ESCs), turn the telemetry on.
  • Hover in Loiter for over 30 seconds, then fly in each direction for several tens of seconds.
  • Download the log and load it into the official filter analysis tool.

Matching the filter in the analysis tool ​

  • Load the log, open the analysis and select the part of the flight to analyse.

  • Look at the IMU spectrum, choose an axis (X is usually enough) and compare before filtering with the predicted after.

The predicted result comes from the filter parameters you enter below.

  • The goal is to bring peaks above 40 down below -40 dB, while disturbing the rest of the spectrum as little as possible so you do not add phase delay.

  • Configure the filter as described under Dynamic notch filter and look at the predicted result.

ParameterWhat it doesHow to set it
INS_HNTCH_ENABLEMaster switch for the dynamic harmonic notch filterSet to 1
INS_HNTCH_MODEHow the notch tracks frequency1: Throttle when there is no ESC telemetry; 3: ESC telemetry is recommended when there is
INS_HNTCH_FREQNotch centre frequency in the hover conditionFrom the motor fundamental peak in the hover IMU spectrum, or from the RPM
INS_HNTCH_BWNotch bandwidthSet to between 1/4 and 1/2 of INS_HNTCH_FREQ; with multi-source enabled, no more than 1/4
INS_HNTCH_ATTNotch attenuationBelow -40 dB is enough; do not set it higher than you need
INS_HNTCH_REFReference throttle in throttle modeEqual to the learned hover throttle, MOT_THST_HOVER, or 1 in ESC telemetry mode
INS_HNTCH_FM_RATMinimum scaling of the notch frequency, which limits how low it goes at low throttleDefault 1; lower it a little if low-throttle vibration is obvious, but never below the gyro cutoff frequency
INS_HNTCH_HMNCSHarmonic bitmask — which motor harmonics to suppressSet per the harmonic table below
INS_HNTCH_OPTSExtra notch options (multi-source and so on)On a multi-motor aircraft, Multi-Source / update at loop rate is required
  • The IMU spectrum plot is your diagnostic: it shows where the vibration comes from and whether the harmonics line up with it.

HarmonicFrequencyWhat causes itRecommendation
1st (fundamental)1× motor RPM frequencyMechanical imbalance in the rotating motorAlways enable
2nd2× fundamentalPeriodic disturbance from a two-blade propeller4 motors: 1 + 2; add 3rd if the spectrum shows it
3rd3× fundamentalPeriodic disturbance from a three-blade propeller6 to 8 motors: 1 + 2 + 3
4th4× fundamentalHigher-order coupling in blades, motors or structureSet from the spectrum
… intermediateN× fundamental (5~15)Blade wake, motor cogging, frame resonance — usually weakNormally not needed
16th16× fundamentalVery high-order coupling in the motor and propeller-

NOTE

Only enable the harmonics you need. In the example above the 3rd harmonic is weak, so 1 + 2 + 4 is fine.

WARNING

Keep the bandwidth as narrow, the attenuation as low and the number of notches as small as the result allows. Filters are expensive in CPU; too many will saturate the processor and the system will misbehave. On an STM32H7 controller, three harmonic filters on an octocopter is safe.

Multi-source notch, INS_HNTCH_OPTS

With multi-source, each motor gets its own notch matched to its own average throttle or RPM. On a multi-motor aircraft — especially one where the motors run at noticeably different speeds — the vibration frequencies differ, and multi-source tracks each one precisely. The cost is more CPU load.

  • On a quadcopter with INS_HNTCH_HMNCS = 3 (1st and 2nd harmonic), ArduPilot runs 4 motors × 2 = 8 notch filters.
  • On an octocopter with INS_HNTCH_HMNCS = 7 (1st, 2nd and 3rd), it runs 8 × 3 = 24 notch filters.

Dynamic notch filter ​

Almost all drone vibration comes from the motors and propellers, and its frequency scales linearly with RPM. A dynamic notch moves its centre frequency with the throttle or motor RPM so it always sits on the peak — suppress the noise wherever it happens to be.

Tracking ESC RPM (recommended) ​

If the ESCs provide telemetry (DroneCAN or DShot), the harmonic notch reference frequency can come from that telemetry. This is the simplest and best-performing setup.

Working out the fundamental

  • In the flight log, look at ESC > X (X is the motor number) > RPM

fundamental = average motor RPM in hover / 60

For the example above:

fundamental = (2500 + 2900 + 3000 + 3200) ➗ 4 ➗ 60 = 48.3, so about 48.

Notch settings

INS_HNTCH_ENABLE=1                     //Enable the notch filter.
INS_HNTCH_MODE=3                      //Notch mode: ESC telemetry.
INS_HNTCH_FREQ=48                    //Fundamental from the RPM; confirm it on the IMU spectrum.
INS_HNTCH_BW=10                      //With multi-source on, keep it below a quarter of the fundamental.
INS_HNTCH_ATT=8                     //Set from the IMU spectrum; anything below -40 dB is acceptable.
INS_HNTCH_REF=1                     //Scale of 1 in ESC telemetry mode
INS_HNTCH_FM_RAT=1                   //Set to 1
INS_HNTCH_HMNCS=11                   //1st and 2nd are required on a quadcopter; 3rd and 4th depend on the spectrum — here the 4th had strong noise.
INS_HNTCH_OPTS=6                     //Multi-Source / update at loop rate is required
  • Generate the predicted spectrum.

  • Adjust the parameters until the prediction looks right, then check the spectrogram to confirm the notches are tracking the high-amplitude vibration.

  • Connect the controller to the ground station and write the matched parameters from the full parameter list.

Throttle-based notch ​

Without ESC telemetry, drive the notch from throttle instead.

Finding the fundamental

Using a Raefly CP900 quadcopter as the example.

  • The first vibration curve above the low-pass cutoff appears around 50 Hz, and above it you can see harmonic orders at multiples of about 50 Hz.
  • So the reference frequency goes around 50 Hz; in this case 48 Hz was chosen.
  • Adjust the notch settings until the prediction looks right.
INS_HNTCH_ENABLE=1                     //Enable the notch filter.
INS_HNTCH_MODE=1                       //Notch mode: throttle.
INS_HNTCH_FREQ=48                    //Fundamental from the RPM; confirm it on the IMU spectrum.
INS_HNTCH_BW=10                      //With multi-source on, keep it below a quarter of the fundamental.
INS_HNTCH_ATT=10                     //Set from the IMU spectrum; anything below -40 dB is acceptable.
INS_HNTCH_REF=MOT_THST_HOVER         //Equal to the throttle in hover
INS_HNTCH_FM_RAT=0.8                 //Notch starts scaling once throttle drops 20% below hover; lower it if low-throttle vibration is bad, but never below the cutoff
INS_HNTCH_HMNCS=11                   //1st and 2nd are required on a quadcopter; 3rd and 4th depend on the spectrum — here the 4th had strong noise.
INS_HNTCH_OPTS=6                     //Multi-Source / update at loop rate is required

  • Connect the controller to the ground station and write the matched parameters from the full parameter list.

Checking the result ​

Once the notch is set up, fly for at least 30 seconds and load the log. Everything above the low-pass cutoff should now sit below -40 dB.

Second notch filter ​

With more than one vibration source, a single notch may not be enough. A second notch filter (INS_HNTCH2) can be enabled.

Configure it as you need; a fixed-frequency notch (INS_HNTCH2_MODE = 0) is the usual recommendation.