Understanding how PID works is a vital aspect of unlocking your FPV drone’s true potential. In this comprehensive guide, we’ll dive into the world of PID tuning, exploring how it affects flight performance, stability, and handling. Learn the ins and outs of P, I, and D gains and how they impact your FPV drone’s flight characteristics. We’ll also cover when to re-tune your PID settings and provide insights into the various factors that influence tuning.
Table of Contents
PID Tuning vs Betaflight Presets
Using Betaflight presets can be a convenient option, and might deliver results right away (sometimes), especially for beginners and those flying five-inch freestyle or racing quads. Presets offers better tune than the Betaflight Default (most of the times), providing a good overall tune for most situations. They are well-suited for pilots who prioritize a smooth and enjoyable flying experience without delving into the intricacies of PID tuning. If you’re content with a good tune and don’t feel the need to delve deeper, sticking with presets can save you time and effort. Learn about Betaflight Presets here: https://oscarliang.com/betaflight-presets/
However presets don’t always work on all quads because every quad is different in some way. And as you venture beyond the realm of five-inch quads or explore different types of drones, such as long-range, larger or smaller rigs than 5-inch, you may encounter challenges in finding presets that work optimally. In such cases, you may need to fine-tune the PIDs yourself. Knowing how to tune PID also enables you to troubleshoot specific problems such as excessive prop wash or overshoot that presets can’t address.
The Art of Quadcopter PID Tuning
PID tuning for an FPV drone is truly an art form. Learning how to balance various flight characteristics to achieve the ideal response for your specific flying style requires time, patience, and practice.
Whether you want the drone to feel snappy without oscillations, or a smooth stick response without feeling sluggish, the key lies in finding the perfect balance.
In the early days of the hobby, flight controller firmware were less refined, causing FPV drones to perform poorly with default PID values. This made PID tuning an absolute necessity. However, thanks to advancements in noise filtering and optimized algorithms in modern flight controller software, quadcopters can now fly reasonably well with default settings.
While these improvements don’t negate the importance of PID tuning, they have made it less critical for basic flight. Still, there’s always room for improvement, and individual preferences for handling and flight characteristics vary. Mastering PID tuning enables you to transform a drone that “flies well” into one that “flies perfectly” according to your unique style.
Understanding PID in FPV Drones
PID, which stands for Proportional, Integral, Derivative, is an algorithm within a flight controller’s software that reads data from sensors and processes radio stick commands to calculate the required motor speed for achieving the desired rotational rate.
There are a few key terms that you should familiarize yourself with before delving deeper into this article: set-point, error, control loop, and looptime.
The desired rotational rate is called “set-point”. The “error” is the difference between set-point (how fast we want the drone to rotate), and the gyro sensor’s measurement (how fast the drone is actually rotating).
A PID controller’s primary goal in an FPV drone is to correct the “error” by adjusting motor speeds. The control loop continuously reads sensor data and calculates motor speeds to minimize the error. Betaflight can perform up to 8000 control loops per second (by setting PID Loop Frequency to 8KHz in the software).
The PID algorithm is a crucial part of the control system. There are three terms in a PID controller: Proportional (P), Integral (I), and Derivative (D).
- P (Proportional) relates to the present error. The larger the error, the harder it pushes – in math term, it’s proportional to the error.
- D (Derivative) predicts future error. It considers how quickly the set-point is approached and counteracts P to minimize overshoot when nearing the target – in math term, it’s the derivative of the error.
- I (Integral) accumulates past errors. It addresses external forces that occur over time, such as a drone drifting away from set-point due to wind or an off-centered weight, by adjusting motor speeds to counteract it – in math term it’s the integral of the error.
Users can assign a gain to each term, with higher gains increasing the term’s influence on flight characteristics.
These principles apply to any flight controller firmware that uses a PID controller, such as Betaflight, Ardupilot, KISS, iNAV, Cleanflight, EmuFlight, Baseflight, etc.
The Objective of PID Tuning
Imagine trying to get a golf ball into the hole (setpoint). Each time you hit the ball, it might overshoot or undershoot the target, but with every attempt, it gets closer. You continue until the ball reaches the hole.
The objective of PID tuning is to achieve the perfect strike that gets the ball into the hole as quickly as possible. When tuned correctly, your drone will track the stick movements accurately, providing a direct and responsive feel without wobbles or oscillations.
The Impact of PID Terms
Tweaking PID gains influences a quadcopter’s flight behavior. While understanding the inner workings of PID is not necessary, it is crucial to know how changing these gains affect your drone’s performance.
P gain determines the intensity with which the flight controller works to correct errors.
Consider P gain as a responsiveness setting. A high P gain creates a snappy response, making it feel as though your rates have increased.
If P gain is too high, the quadcopter tends to over-correct, resulting in sharp bounce-backs during flips and rolls. Excessively high P gain can even cause oscillations. Conversely, when P gain is too low, the quadcopter feels sloppy and slow to respond.
I gain determines the flight controller’s effort in maintaining the drone’s attitude against external forces, such as wind and off-centered CG (center of gravity).
Think of I gain as a stiffness setting, affecting how well the quadcopter holds its attitude. Higher I gain improves tracking setpoints during sweeping turns but also stiffens the quad’s entry into a move.
Similar to P gain, excessive I gain can cause bounce-backs and oscillations, although at a noticeably slower (lower frequency) rate. If I gain is too low, the quad will experience wobbles and “nose dips” during rapid throttle changes. Extremely low I gain results in poor angle-holding during windy conditions, causing the drone to feel drifty and requires constant pilot input for corrections.
D gain acts as a damper for P gain, reducing overshoots. Like a shock absorber dampens suspension bounce, D gain softens and counteracts oscillations caused by excessive P gain and minimizes propwash oscillations.
When D gain is too low, the quadcopter will exhibit significant bounce-backs after flips and rolls and experience worse propwash oscillations during vertical descents.
Increasing D gain can mitigate these issues; however, excessive D gain can amplify vibrations and noise in the quadcopter, causing trilling oscillations and motor overheating. A separate post details why excessive D gain can lead to drone vibration: https://oscarliang.com/excessive-d-gain-cause-oscillations-motor-overheat/
P gain is the primary control of the drone, but it’s often not fast enough, as it only reacts to errors, creating a delay between setpoint and gyro.
Feedforward aims to reduce this delay. Essentially, the flight controller observes how quickly you move the stick and helps initiate the quad’s movement earlier without relying on gyro data. This can significantly improve setpoint tracking. However, setting feedforward too high may cause bounce-backs at the end of flips and rolls, similar to excessive P gain.
Factors Influencing Optimal PID
Each quadcopter will have unique optimal PID values, influenced by various factors, including:
- Overall weight and weight distribution
- Thrust-to-weight ratio
- Motor torque, which affects how fast RPM can change
- Propeller weight and pitch, which impacts motor response
No PID setting is universally perfect. For instance, crashes may slightly damage propellers, frames, or motors, altering the resonance frequency and optimal PID values. Additionally, battery placement can affect mass distribution. Ideally, you want to fine-tune your PID settings to accommodate a wide range of situations.
Precautions Before Adjusting PID
Before you start making any changes to your PID settings, follow these steps to ensure a smooth tuning process:
- Back up your current PID values: This allows you to revert to previous settings if something goes wrong during the tuning process. And you have something to compare to if you are unsure about your final tune.
- Always tune your quad in Acro Mode: this ensures accurate tuning without interference from auto-leveling features.
- Balance your quadcopter’s center of gravity (CG): Proper CG significantly affects flight performance. Adjust your battery placement to shift the CG forward or backward until it is centered.
A Simplified Tuning Process
For a more in-depth look, refer to my FPV Drone Tuning Guide in 10 steps without using Blackbox: https://oscarliang.com/fpv-drone-tuning/
The basic idea of this simplified tuning process is to find the optimal ratios between P, I, and D gains. This can be achieved by following these steps:
- Find a good balance between P and D gains.
- Determine the right ratio between P and I gains.
- Maximize all PID gains.
You can easily adjust these settings by using the sliders in Betaflight, eliminating the need to input numbers manually.
While it’s ideal to tune PID values using Blackbox logs, it’s still possible to achieve decent results by closely observing your drone’s flight behavior through your FPV goggles and listening to the motor sounds. But if you want to tune your quad as perfect as it can get, using Blackbox is the way to go: https://oscarliang.com/pid-filter-tuning-blackbox/
Tuning Tiny Whoops
For whoops, switch to RP mode in PID tuning tab, so you can set Yaw PID separately. Tiny whoops tend to have little yaw authority due to the ducts, so you want to set it really high. Set Yaw P and I to 100.
Also if you get yaw washouts coming down, try running props in, sometimes it fixes it.
Remember, Not Every Problem is PID-Related
While PID tuning plays a significant role in your quadcopter’s performance, it’s essential to recognize that hardware factors can also affect it. Before blaming PID values for performance issues, check the following aspects of your drone:
Not all jello and oscillations are due to PID gains being too high. It’s crucial to eliminate as many vibration sources as possible in your quadcopter before tuning PID. Factors that contribute to vibrations include motor and propeller condition, proper soft-mounting of flight controllers, and frame rigidity.
Center of Gravity
Ideally, your quadcopter’s center of gravity (CG) should be right in the middle, where the four motors intersect on a horizontal plane, and as close as possible to the propeller line on the vertical plane.
An off-centered CG causes some motors to work harder than others, negatively affecting stability.
Mass Distribution and Moment of Inertia
FPV drones with centralized mass generally feel more precise, snappy, and responsive. When there’s more mass on the outside of a quad, it takes more force to rotate and longer to accelerateto the desired velocity. Due to higher angular mass and inertia, stopping the rotation becomes more challenging as well.
When to Re-tune PID?
Making changes to your drone? You may need to revisit your PID tuning.
Various factors can impact PID tuning, such as using a different battery, adding a GoPro camera, using different motors and propellers, or even external factors like wind, humidity and altitude.
In essence, whenever you make significant changes to your quadcopter, it’s a good idea to check and adjust your PID values as needed.
Mastering PID tuning is an essential skill for any advanced FPV drone enthusiast seeking to optimize their quadcopter’s flight performance. By understanding the intricacies of P, I, and D gains and their impact on your drone’s behavior, you can tailor your drone’s responsiveness to suit your flying style and preferences. Don’t forget to consider hardware changes when fine-tuning your PID settings. With this knowledge at your fingertips, you’re now equipped to transform a well-flying drone into a perfectly-tuned machine, ready to deliver an unparalleled FPV flying experience. Happy flying!
- Oct 2013 – Article created
- Dec 2015 – Added examples how PID affects flight characteristics in Cleanflight/Betaflight
- Jan 2018 – Updated article for the latest Betaflight firmware, simplified section “What’s PID Tuning”, and merged with article “My Simple PID Tuning Guide”
- Feb 2018 – Added info about Setpoint Weight/Transition
- July 2018 – Added Golf Analogy
- Sep 2022 – Revised
- Mar 2023 – Revisited