Raw IMU Logging for FFT Analysis

Using the IMU Batch Sampler to gather data for spectral analysis of noise to setup notch filtering is the historical method and still valid but with firmware 4.5 and later, and if using an H7-based autopilot, a simpler and better method is to enable Raw IMU Logging combined with the Filter Review tool.

The downside to this method is that it produces very large logs and unless the data gathering is restricted to a single gyro, some slower autopilots (F4-based, for example), may not be able to keep up resulting in logging drop-outs. Also the data produced can only be analyzed by the Filter Review tool on the ArduPilot Firmware “Web Tools” page.

Using this new method greatly simplifies the notch filtering setup. The required data can be gathered in a single test flight and the filters can then be setup interactively with the Filter Review tool.

Filter Setup Process

  1. Select the method that will be used for dynamically adjusting the notch(s) center frequency and do any required setup, ie if ESC telemtry will be used make sure its setup, if Throttle based make sure your motor voltage compensation is setup (see Q_M_BATT_x params for QuadPlane or MOT_BAT_x params for Copter).

  2. INS_RAW_LOG_OPT: any bits set will enable raw IMU logging. To prevent overloading the logging, especially on slower autopilot CPUs, set INS_RAW_LOG_OPT bit 0 and bit 3 (value = “9”). This will restrict logging to the primary gyro and log both pre and post filtering.

  3. Perform a regular flight (not just a gentle hover) of at least 30sec and download the dataflash logs.

  4. Using the Filter Review tool load the log. Select a steady hover portion of the log and press “Calculate”. Then you can enable one or both of the filters in the tool and experiment with the parameters(refer back to the Managing Gyro Noise with the Dynamic Harmonic Notch Filters page for details of what each parameter means) to get the lowest noise in the estimated post-filter spectrum, especially in the lower frequencies of the control band (0-40Hz). Remember that each additional harmonic filter adds cpu computational load. Usually only two or three per filter will be sufficient.


if the FilterReview tool complains that not enough data is in the log, this usually means that logging has not been able to keep up and has dropped some packets. Either reduce the FFT window size to 512 from 1024, or, preferably, try just clearing the pre and post logging option in INS_RAW_LOG_OPT and retry the test flight to log only the input noise and use the estimated post-filter trace to setup the filters.

  1. Save those parameters and load them into the autopilot.

  2. Do another flight to confirm the filter setup. This this flight more normal flight maneuvers can be done.

  3. Once verified, clear the INS_RAW_LOG_OPT parameter to avoid large logs from being saved unnecessarily.