PID Article by Justin Davis of Drone Camps RC, USA.
PID and Tuning explained for the beginner in plain english.
What are PIDs?
And why do we need to tune learn these numbers?
P.I.D. Table of Contents
PID Explained |
Does my quad need tuning? How to tell. |
First step before you mess with the PID numbers in Betaflight |
Propellers, motors, CG, escs |
Tuning your quad |
Summary |
Let's get into it ...
PID tuning is a lot like finishing a RUBIK'S Cube.
Some people can do it. Others can't. It's not impossible.
Welcome to the most confusing subject in the FPV/Drone Hobby ! ! !
To save you some giant headaches and frustration that will have you putting down your fpv drone and walking away forever... I will keep this as basic as possible. After all. That is our goal at "Drone Camps RC." Helping foster new guys into our hobby and keeping the current pilots in the know about what is new. Now "PID Tuning" is an art form for sure. And something that you will grow better at as you get into using Betaflight and flying. Eventually you will be able to "hear" your tune on your drone.
Before you read further understand this :
PIDs are not Rates. Rates are not PIDs.
Lots of new guys confuse themselves by thinking this. They are two different things.
P.I.D. Basics / Explained for the average guy.
Oh look! A fancy scientific graph! Don't be scared away yet! This will be easy.
This graph is a simple way of showing of how each process of the algorithm executes the code and comes together to process the final output results to the flight controller.
When you move your sticks on your drone. This all happens at light speed from your stick command to the flight controller and your drone parts respond to these outputs. Literally in milliseconds. This process happens in a loop. Over and over. Hence a PID Loop.
Every person likes a different tune. Some like a smooth flowy tune. Others like Mr. Steele like a quick snappy responsive tune. I happen to like a tune somewhere in the middle. Smooth but quick. not too quick though.
Sometimes if you build a new quad or buy one. On the first flight it shakes horribly and maybe you can even hear the props making a buzzing sound. In your FPV camera view in your goggles my vibrate and make jello on the screens. Jello is a term for what looks like horizontal waves in the video you see.
What is P.I.D.?
P = Proportional
I = Integral
D = Derivative
Each part of the algorithm helps to collect data for a final output. At the end of the process it tells the motors how to rotate and how to react to a physical movement. This is a set point. There is always some difference between the gyro sensor and the measurement. This is called the error. The PID looks to react to that error and smooth it out adjusting the speed of each motor.
P = Proportional
What is proportional? Proportional is the "present". What error data happening now.
P examines what is currently happening. And works to correct it with new data. Seeing the present error and looking to help.
I = Integral
What is Integral? Integral is the "past". What error data happened before.
"I" examines what is past data. It sees what happened on a physical movement of the drone and looks to correct this movement. Correction bringing the drone closer to level.
D = Derivative
What is Derivative? Derivative is the "future". What error data might happen in the future based on the present and past.
"D" examines and reacts to what it sees happening next after past and present data. Generally D looks to make sure the data does not peak too high resulting in an overshoot.
How do I know my Quad / Drone needs to be tuned?
Overshoots / See the title graph above.
The black line reaching far above the blue line is an overshoot.
An overshoot will cause that pesky drone oscillation. Sometimes you can hear oscillation in your props. Sometimes on spool up. Or after a crash and you have a bent prop. The PID process is throw off by the extra forces from the bent prop being thrown into the PID loop set numbers. It basically says hey! I don't like that and fights harder to correct it. Thus an overshoot happens. Resulting in bad vibrations.
There are 101 ways that you might need a quad tuned. Sometimes a quad flies perfect and after a crash it starts vibrating. Or it was flying fine and then not. First you look for physical hardware problems.
First physical things to check after a crash or vibrations occur :
- Bent Propellers
- Missing bolts or nuts
- Loose quad arm or frame part
- ESC Firmware not set to the right version. Needs update.
- Center of Gravity ( CG ) thrown off center axis. Battery slide or camera?
- Broken stand offs
- Flight controller loose, or moving
- Loose Motor
- Loose proppeller
- Prop not tightened enough. Spinning loosely.
- Dirt, grass, or hair in a motor
- Stuck motor
- Hardware or bolt stuck to a motor magnet
- Motor bolt screwed to far into a motor base. Touching copper coils. Bad!!!!
- Loose fpv camera
- Too much wind. Higher winds can effect a quads tune
- Etc. Many things can happen.
TUNING YOUR DRONE P.I.D.s
Note : *** Make sure as you are tuning and testing your quad you are in acro mode.
Also I can't say this enough...
A good tune starts with good propellers!
Most times in modern Betaflight stock firmware a quad will fly relatively great. But there are exceptions.
For a 5" Drone I recommend the DalProp Cyclone props.
My all time favorite props... Link here. $4.99 a set.
A good prop is everything. Also when you "tune" a quad you are tuning it to that propeller. So if you change a brand or style of propeller to another propeller. The tune changes for better or for worse. I have switched props before and seen a much better flying quad immediately. Trash props will result in a terrible experience.
To start go to a safe open space outside with your drone and your laptop and get comfy. Also you'll need patience and some time.
Your goal of a tune session is to try to find the best set point for the average of the numbers interacting in the PID tune. A commonality all of the data crunchers can eliminate your specific quad vibes. Every quad is different. Although Bind and fly quads can generally use the same PID numbers. Thats why people ask for a tune online or share tunes. However when you use different props, escs, add extra weight, high wind, or motors... LOL things can change! This is where people get really frustrated.
Where I start PID tuning.
I start by connecting my quad to Betaflight. Now go to the PID tuning tab.
Now that you are there. You will see a set of numbers that will confuse the hell out of any intelligent person. Get ready. We are about to get as simple as possible for your first tune session.
Before you start fiddling with numbers. Make a back up of your quads settings to your computer desktop. That way if you really screw things up you can reflash your old settings. Screen shot the current PIDs also. As you progress in your tuning process things should get better. If things get worse. You will start over!
What to look at first.
A lot of times if a quad comes to me brand new with a bad tune on it. I immediately suspect that the numbers in the PID are just too high. This means the FC is over correcting at a high speed. Think of it as having too much espresso in the morning and feeling jittery. The quad acts the same way. Jitters occur. So our goal is to find that sweet spot and remove the jitter.
First. If the numbers are relatively high. Say up in the 80s or 90s. I start turning the numbers down. Remember also if the numbers are too low an FC can also throw the quad off. This is a balance game. That's why many call PID tuning a dark art or mystery. Learning to PID tune takes time many don't want to spend.
The more you try it. The better you will get. At a point with enough practice you'll be tuning your friends quads.
Adjusting "P" Proportional
ROLL, PITCH, and YAW column.
P is how quickly the quad reacts. The numbers for each value are in a vertical layout. Change the numbers down or up 5 at a time. Above you see the YAW is set to 70. For example if you have vibrations bring that number down by 5 to 65. PITCH say bring down to 53. ROLL to 35. And click SAVE. Now you can move over the "I" Integral Column.
Adjusting "I" Integral
ROLL, PITCH, and YAW column.
"I" will generally wobble with throttle adjustments quickly up and down. Adjust integral the same way as you would P. Look at the numbers and generally speaking if you have bad vibes and it's not physical. It's high PID values resulting in overshooting. Too much gyro compensation. So again we will gently turn down some of the numbers. 5 or so a time in each column. Click SAVE.
Adjusting "D" Derivative
ROLL, PITCH, and YAW column.
Adjust derivative is the final step. The icing on the cake. I usually don't move these values too much. Unless they are extreme. Like the manufacturer "tester" put some insanely high values in there. I have seen some crazy numbers come into my shop. At first glance I know the quad will fly wrong based on the high numbers.
Now starting with D values you want to be gentle. This is where we will help eliminate prop was on hard turns. And smooth things out at the high end of the throttle. If the D gain numbers are too high you'll actually hear a vibe in the props on take off. A WARBLE or BUZZING noise. After over 10 years of flying FPV I can go to a field and hear someone's quad take off and hear a bad tune. This is something you'll pick up on.
You want to adjust the D numbers down until you get rid of the wobble or buzz in the propellers. Go gently down by 3 to 5 numbers at a time. After each number is saved. Re-fly the quad. You can even practice listening to a tune by flying it line of sight first. Then goggle up to check for vibes. Learn to hear your tune. The propellers should do what we call sing. A smooth precise sound of pure goodness!
Racers prefer a snappy edgy quad. So generally they tune their quad D numbers as low as they can get. For some freestyle pilots they love a "flowy" tune. So they try to go a little higher to smooth out the tune for flow.
If you screwed up your quad. Reenter your screenshot numbers and start over.
PID Tuning Summary - You did it! Or Didn't! ;)
My final advice in your journey to becoming a PID tuning Jedi is this.
Be patient Luke. 🔥
The force doesn't come all at once. It takes time to perfect. Learn and master. In no time with practice you will be "hearing" a good or bad tune. Just the slightest vibe I can now hear. My ears are masters of this aspect of aviation. For me it started back when I used to "tune" nitro and gas engines for RC Airplanes. A good tune on an RC Airplane engine should also purr and sing. To rich and it bogs and chokes out. To lean and it just burns and won't run. All things with RC systems are a balancing act. This act is very similar. I learned to love it. Like studying a new art form. Good luck with your skills.
Enjoy your journey. Grow with it. Learn to love it.
Nurture it. Persist. And it will love you back.
Much the same as all things in life.
Hope this helps you, Justin.
If you need more help please join our Discord Group here : https://discord.gg/j9jVjvA
Article by Justin Davis of Drone Camps RC on Youtube. ® Rights Reserved 2023.
Comments