Table of Contents

PID & Filter Tuning for Drones

PID (Proportional, Integral, Derivative) control and gyro/D-term filtering govern how a flight controller translates pilot stick inputs and gyro sensor data into motor commands. Proper tuning eliminates oscillations, reduces motor heat, sharpens stick response, and unlocks smooth, locked-in flight performance.

Motor & ESC Thermal Warning: Aggressive PID gains (especially high D-term) combined with insufficient filtering can pass high-frequency mechanical noise directly to your motors. Always perform 15–20 second hover and throttle-blip tests after tuning changes, and check motor temperatures by hand—if motors are too hot to touch comfortably (>60°C / 140°F), lower D-gains or increase filtering immediately.

1. Anatomy of a PID Controller

A PID loop continuously calculates the error (the difference between your desired rotation rate from the sticks and the drone's actual rotation rate measured by the gyro) and applies three corrective forces across Pitch, Roll, and Yaw.

Term Full Name Primary Function Too Low Symptoms Too High Symptoms
P Proportional Immediate muscle/authority to reach the target setpoint. Sluggish response, drifting in turns, washout on throttle cuts. Fast, sharp oscillations/shuddering during quick maneuvers.
I Integral Corrects long-term drift caused by external forces (wind, off-center CG). Nose dips on punch-outs, wandering attitude in wind, poor hold. Slow, sluggish bounce-back after flips; stiff, robotic feel.
D Derivative Dampens P-term overshoot and cushions sudden movements. Bounce-back at the end of flips/rolls; propwash oscillations. Hot motors, audible high-pitched motor whine/trill, twitchy feel.
FF Feedforward Boosts initial stick response based on how fast the sticks move (not error). Slight delay between stick movement and aircraft reaction. Overshoot at the start of flips; twitchy center-stick behavior.
The Spring Analogy: Think of P as the stiffness of a spring pulling the drone toward your stick command, D as the shock absorber preventing that spring from bouncing wildly back and forth, and I as a steady hand holding the drone level against constant wind or weight imbalance.

2. Understanding Gyro & D-Term Filtering

Before the PID loop can calculate clean motor outputs, the flight controller must scrub mechanical vibrations (frame resonance, bent props, rough bearings) from the raw gyro signal.

Why Filtering Matters

Common Filter Types (Betaflight / INAV / ArduPilot)

Filter Before Tuning: Always optimize your filters first before pushing PID gains upward. A noisy airframe will hide bad filter settings behind hot motors and false oscillations, making accurate PID tuning impossible.

3. Pre-Tuning Mechanical Checklist

Software cannot fix a mechanically compromised aircraft. Verify these hardware items before touching firmware sliders:

4. Step-by-Step Tuning Workflow

Follow this methodical sequence using Blackbox logs (or careful line-of-sight/FPV testing) to dial in a clean, locked-in tune.

Step 1: Establish a Clean Filter Baseline

  1. Enable Bidirectional DShot and RPM Filtering (typically 3 harmonics per motor).
  2. Set the Dynamic Notch Filter count to 1 or 2 (with RPM filtering active, fewer dynamic notches are needed).
  3. Test hover and perform brief full-throttle punch-outs. Check motor temperatures—motors should feel cool to slightly warm.
  4. Optional (Blackbox Tuning): Inspect the Gyro Scaled vs. Gyro Filtered frequency spectrum. Gradually move the Gyro and D-Term Filter sliders toward less filtering until noise just begins to appear above 100Hz, then back off 10%–15%.

Step 2: Tune Master Multiplier & P/D Balance

  1. Increase Master Multiplier (or P & D together): Raise gains in increments of 0.1–0.15 while performing quick, sharp flips and rolls.
  2. Watch for Bounce-Back:
    • If the drone bounces back slightly at the end of a sharp roll stop, increase D (or lower P slightly).
    • If the drone feels sluggish or washes out in hard turns, increase P (and raise D proportionally to keep it damped).
  3. Check Motor Heat: After each adjustment, fly aggressively for 20 seconds, land, and touch all four motor bells.

Step 3: Dial In I-Term & Feedforward

  1. I-Term: Perform fast forward flight followed by a sudden throttle cut, or fly in gusty wind. If the nose pitches up or drifts off-axis, increase I-gain slightly until the attitude stays locked on rails.
  2. Feedforward (FF): Perform rapid stick snaps. Increase FF for sharper, more immediate stick-to-frame connection. Reduce FF if the quad twitches nervously around center stick or overshoots the start of flips.

Step 4: Propwash Handling Optimization

Propwash oscillations occur when descending through your own turbulent air (e.g., pulling out of a steep dive or sharp hairpin turn).

5. Tuning Profiles by Drone Class

Different airframe sizes and mission profiles require vastly different baseline approaches:

Drone Class Prop Size Filter Strategy PID Characteristics
5“ FPV Freestyle 5.0” – 5.1“ RPM filter + minimal low-pass filtering for ultra-low latency. High P & D for crisp propwash control; moderate-high Feedforward.
Micro / Tiny Whoop 31mm – 2.5” Higher filtering required due to high-RPM vibration and flexible frames. Very high P & I relative to D; high Feedforward for snappy indoor agility.
7“ – 10” Long Range 7.0“ – 10.0” Lower low-pass cutoff frequencies (more filtering) to block low-Hz arm flex. High I-term for wind stability; lower D-term and smoother Feedforward.
Heavy-Lift Cinelifter 7“ – 13” X8 Heavy low-pass & notch filtering to tame dual-prop turbulence. High P & I to handle heavy camera payload inertia; cautious D-gains.

6. Quick Troubleshooting Reference

Symptom Likely Cause Recommended Adjustment
Rapid high-frequency shudder on throttle P-gain too high, or loose frame hardware. Tighten frame/motor screws; lower P-gain by 10%–15%.
Bounce-back after sharp flips/rolls D-gain too low relative to P, or excessive FF. Increase D-gain slightly, or reduce Feedforward.
Hot motors + faint high-pitched trill Excessive D-term noise reaching motors. Lower D-gain or move D-Term Filter slider toward more filtering.
Shaking when descending into own wash Filter latency or insufficient D-term damping. Enable RPM filtering, set Dynamic Idle, or increase D-gain.
Nose pitches up/down on throttle punch I-term too low, or off-center battery CG. Center battery weight; increase I-gain by 10%–20%.
Rule of Thumb for Tuning: Change one parameter at a time, keep notes (or use firmware presets/CLI diffs) before making major changes, and always prioritize cool motors and clean mechanical builds over chasing aggressive numbers.

Step-by-Step Blackbox Log Analysis Instructions

Follow these exact instructions to record, export, and analyze Blackbox flight logs using Betaflight Blackbox Explorer and PIDtoolbox.

Part 1: Exporting Your Flight Log

  1. Connect to Betaflight Configurator: Plug your drone into your PC via USB (no battery required for onboard flash; plug in a battery if your SD card reader requires 5V rail power).
  2. Open the Blackbox Tab: Click Blackbox in the left-hand navigation menu.
  3. Download the Log:
    • For Onboard Flash: Click Save Flash to File… and save the .bbl or .bfl file to a dedicated folder on your computer.
    • For SD Card: Click Activate Mass Storage Device (or remove the microSD card and insert it into your PC) and copy the latest LOG000xx.BFL file.
  4. Clear Storage for Next Flight: Click Erase Flash (or delete old logs from the SD card) so your next test flight starts with empty memory.
File Naming Habit: Immediately rename your downloaded log file to include the slider values used during that flight (e.g., 2026-11-19_5inch_Filters1.3_Master1.2.bbl). Without clear filenames, comparing back-to-back test flights becomes nearly impossible.

Part 2: Inspecting Traces & Spectrums in Blackbox Explorer

Use Betaflight Blackbox Explorer to check mechanical health, motor saturation, and raw vs. filtered noise frequencies.

Step 1: Load and Configure the Workspace

  1. Open Betaflight Blackbox Explorer and click Open Log File (top right) to load your .bbl file.
  2. If your file contains multiple flights (multiple arm/disarm cycles), use the Log Selector dropdown in the top bar to pick the specific test flight.
  3. Click the Graph Setup button (top bar) and load a clean workspace layout containing:
    • Graph 1: Gyro [roll, pitch, yaw] + Setpoint [roll, pitch, yaw]
    • Graph 2: PID P, I, D (select Roll or Pitch axis)
    • Graph 3: Motors [1, 2, 3, 4]
    • Graph 4: Debug [0, 1, 2] (this displays raw GYRO_SCALED if enabled before flight)

Step 2: Check Noise Frequencies (Spectrum Analyzer)

  1. Hover your mouse over the Debug [0] (Raw Roll Gyro) trace and click the Spectrum / Analyzer icon (or press F on your keyboard) to open the frequency graph.
  2. Look at the peak frequencies between 0Hz and 500Hz:
    • Note any sharp spikes below 100Hz: These indicate frame resonance or loose screws.
    • Check the high-frequency floor (>150Hz): Note how tall the noise floor is before filtering.
  3. Now open the Spectrum Analyzer on Gyro [roll] (Filtered Roll Gyro) and PID D [roll]:
    • Verify that the sharp motor noise spikes seen in Debug [0] are gone in the filtered Gyro trace.
    • Check PID D [roll]: The area above 120Hz should be flat and quiet. If you see large peaks above 120Hz on the D-term spectrum, increase D-term filtering (move the D-Term Filter slider left).

Step 3: Check Motor Saturation & Balance

  1. Scrub through the timeline to a full-throttle punch-out and a sharp flip/roll.
  2. Inspect the Motors [1, 2, 3, 4] graph:
    • Check for Clipping: If any motor trace hits the flat ceiling at 100% (2000) during maneuvers, your motors are saturating. Lower your Motor Output Limit slightly or use lower-pitch props.
    • Check Trace Thickness: Zoom in closely (scroll wheel up) on a steady hover section. Motor lines should look like thin, crisp threads. If they look like thick, fuzzy markers, high-frequency noise is vibrating your motors.
Single-Motor Anomaly Check: Compare the average percentage of all four motors during a level hover. If one motor consistently runs 10%–15% higher than the others, inspect that arm for a bent motor shaft, damaged prop, twisted arm, or unbalanced battery placement before changing any PIDs.

Part 3: Analyzing Spectrograms & Step Response in PIDtoolbox

Use PIDtoolbox (PTB) to turn your test flight into clear visual heatmaps and step-response curves.

Step 1: Import the Log

  1. Launch PIDtoolbox and click Select File(s) to load your .bbl log.
  2. Select the desired sub-log number if multiple flights exist in the file, then click Load.

Step 2: Generate & Read the Noise Spectrogram

  1. Click the Spectral Analyzer button on the main dashboard.
  2. Set the columns to compare side-by-side:
    • Column 1: Gyro Pre-Filt (Debug) — Shows raw physical vibration.
    • Column 2: Gyro — Shows what remains after your Gyro filters and RPM filter.
    • Column 3: D-Term — Shows what actually reaches your motors.
  3. How to Interpret the Heatmap:
    • Look at the D-Term column above 100Hz. It should be almost entirely dark blue/black.
    • If you see bright yellow or green streaks above 100Hz in the D-Term column, your filters are too loose—move your D-Term Filter Multiplier slider to the left by 0.1–0.2.
    • If the D-Term column is completely dark blue/black all the way down to 80Hz and your motors came down cold, you have headroom to move your filter sliders to the right by 0.1–0.2 for sharper response.

Step 3: Generate & Read the Step Response Curve

  1. Close the Spectral Analyzer and click Step Response on the PIDtoolbox dashboard.
  2. Ensure your log contains at least 3–4 sharp roll and pitch stick snaps (PIDtoolbox automatically isolates high-rate stick movements to calculate the curve).
  3. Inspect the Roll, Pitch, and Yaw response curves against the dashed 1.0 target line:
    • Latency Check: Look at the horizontal time axis (in milliseconds). A well-tuned 5“ quad reaches 1.0 within 40ms to 60ms. If it takes >80ms, increase Master Multiplier or Feedforward.
    • Bounce-Back Check: If the curve climbs above 1.0 (e.g., peaks at 1.15) and dips back down, increase the P and D Gain (Damping) slider by 0.05–0.1 (or lower Feedforward slightly).
    • Oscillation Check: If the curve waves up and down multiple times like a sine wave after hitting 1.0, lower the Master Multiplier slider by 0.1.
Log-Based Tuning Loop: Make one slider adjustment based on your PIDtoolbox graphs, flash the change, fly the exact same 30-second test routine, and compare the new Step Response curve directly against the previous log using PIDtoolbox's multi-file overlay feature.

Step-by-Step Betaflight Slider Tuning Workflow

Modern Betaflight firmware simplifies tuning by grouping complex filter cutoffs and PID ratios into intuitive sliders. Always follow the golden sequence: Hardware Check → Filters First → PIDs Second → Fine-Tuning.

Pre-Tuning Safety Rules:
  • Remove propellers whenever working at the bench with a battery plugged in.
  • Never change filter sliders and PID sliders on the same test flight.
  • Fly short 20–30 second test hops and touch-check all four motor bells immediately upon landing. If motors are too hot to hold comfortably (>60°C / 140°F), land immediately and increase filtering or lower D-gain.

Phase 1: Baseline Setup & Pre-Flight Prep

Before moving any sliders, establish a clean baseline on a mechanically sound quad.

  1. Mechanical Inspection: Tighten all frame bolts, arm screws, and motor screws. Install fresh, undamaged propellers and secure the battery firmly with a non-slip pad and strap.
  2. Enable Bidirectional DShot & RPM Filtering:
    • On the Motors tab, enable Bidirectional DShot and set the correct Motor Poles count (typically 14 for standard 22xx/23xx motors, 12 for micro motors).
    • Verify the error percentage reads 0.00% at idle.
  3. Reset to Defaults: On the PID Tuning tab, click Reset Settings to start from clean Betaflight defaults (all sliders centered at 1.0).
  4. Configure Blackbox (Optional but Recommended): Set Debug Mode to GYRO_SCALED at a 1kHz or 2kHz logging rate.

Phase 2: Filter Slider Tuning (Filters First)

The goal of filter tuning is to reduce filtering (lowering phase delay and propwash) as much as possible without letting high-frequency noise overheat your motors.

Relevant Sliders (Filter Settings Sub-Tab)

Step-by-Step Filter Procedure

  1. Baseline Flight (Sliders at 1.0): Fly for 30 seconds (hover, full-throttle punch, sharp turns). Land, disarm, and feel motor temperatures.
  2. Reduce Filtering Gradually: If motors are cool/barely warm and you have RPM Filtering enabled, move both the Gyro Filter Multiplier and D-Term Filter Multiplier to the right in 0.1 or 0.2 increments (e.g., 1.0 → 1.2 → 1.4).
  3. Listen & Feel: After each increment, fly a 20-second test. Listen for high-pitched motor trilling/whining and check motor heat upon landing.
  4. Dial Back for Safety Margin: The moment motors become noticeably hot or emit a faint high-frequency trill on throttle punches, move the D-Term Filter Multiplier back to the left by 0.1–0.2 to leave a safe thermal margin for bent props or windy days.
Typical Target Range: On a clean, modern 5” freestyle build with RPM filtering active, both filter sliders typically land comfortably between 1.2 and 1.5. Older, noisier frames or 7“+ long-range quads often stay near 0.8 to 1.0.

Phase 3: PID Slider Tuning (PIDs Second)

Once filters are locked in and motors run cool, tune your PID sliders to achieve crisp stick tracking and zero bounce-back.

Relevant Sliders (PID Settings Sub-Tab)

Slider What It Controls When to Increase (Move Right) When to Decrease (Move Left)
Master Multiplier Scales P, I, and D together proportionally. Quad feels loose, floaty, or lacks authority in propwash/wind. Rapid high-throttle shuddering or high-frequency ringing.
P and D Gain (Damping) Controls balance between P (snappiness) and D (braking/damping). Quad bounces back at the end of sharp flips/rolls. Motors run hot or D-term noise increases without improving bounce-back.
Tracking (Feedforward) Direct stick-to-motor response before gyro error occurs. Quad feels sluggish or lags behind rapid stick movements. Quad feels twitchy/nervous around center stick, or overshoots stops.
I Gain Attitude hold strength against drift and throttle punches. Nose pitches up on full-throttle punches or drifts in wind. Slow, robotic wobble or stiff rebound after maneuvers.

Step-by-Step PID Procedure

  1. Step 1 — Raise Master Multiplier:
    • Increase the Master Multiplier in 0.1 steps (1.0 → 1.1 → 1.2…).
    • Test with full-throttle punches and hard propwash turns.
    • Stop and back down by 0.1 if you hear/feel fast shuddering at high throttle or if motors get hot.
  2. Step 2 — Eliminate Bounce-Back (P and D Balance):
    • Perform sharp roll and pitch snaps, returning the stick dead-center instantly.
    • If the nose bounces back after stopping, move the P and D Gain (Damping) slider slightly to the right (increasing D relative to P) in 0.05–0.1 increments until stops are crisp and flat.
  3. Step 3 — Dial In Stick Feel (Feedforward / Tracking):
    • Adjust the Tracking (Feedforward) slider to match your flying style.
    • Raise it (1.1–1.3) for ultra-locked-in racing/freestyle response; lower it (0.7–0.9) for smooth cinematic flying.
  4. Step 4 — Check Attitude Hold (I Gain):
    • Do a sustained full-throttle climb and a fast forward pass. If the nose pitches up or down on its own, increase I Gain by 0.1–0.2.
Dynamic Idle Check (Crucial for Propwash): If you still experience propwash oscillation in low-throttle dives after tuning sliders, go to the Motors tab and enable Dynamic Idle (typically 30–40 for 5” quads). This prevents motor RPMs from dropping too low during zero-throttle descents, giving the PID loop instant stabilization authority.

Phase 4: Final Verification Checklist