Update 5/28/2014 – I built this quadcopter back in 2012. Since then a lot has changed. Quadcopter kits with more capabilities are now available for a similar cost. For example, the Quanum Nova FPV GPS Waypoint QuadCopter is $269 with free shipping. It has full GPS waypoint capability and has a GoPro mount. I haven’t tried the Quanum Nova quad, but it is based on the proven APM controller.
The parts were ordered in Part 1, the quadcopter was assembled in Part 2, and in Part 3 I covered the steps I followed to set up the quad for its maiden flight. Now, in part 4, I will show how I tuned the quad’s PI settings to optimize its flying capabilities. Later, in Part 5 I will cover how I attached a GoPro camera to the quad to get some video from the air.
KK2.0 PI Tuning
Tuning was the most important part of getting my quadcopter to fly right. Without tuning, the quadcopter is very hard to control. I chose to use the KK2.0 flight control board for my easy DIY quadcopter build. PI tuning is accomplished on this board by setting gain variables used by the firmware loaded on the board. The gain variables are set through the lcd menu system on the board. Correctly setting these variables helps the quad fly much better. This wiki is a good read for those interested in PI controller logic.
The creator of the the KK2.0 board and its firmware is Rolf Bakke aka KapteinKUK. This RCGroups forum thread is a great place to download the latest firmware for the board and communicate with others about the board. In KapteinKUK’s forum post he gives very specific directions on setting the gain variables to do PI tuning. I followed his directions to tune my quad. I am not a very good pilot and always fly in self-level, however, the tuning process was done with self-leveling off.
Continue reading to see how I tuned my DIY quadcopter…
PI Gain Defaults
The default PI gain values that came on my board loaded with version 1.2 firmware were set as follows:
Roll/Pitch P-gain: 50
Roll/Pitch I-gain: 25
Yaw P-gain: 50
Yaw I-gain: 50
Self-level P-gain: 40
Before starting the tuning process, KapteinKUK suggests the following:
Set the gains and limits to the following values:
Roll/Pitch P-gain: 30 (For a small 25cm size set to 20)
Roll/Pitch P-limit: 100
Roll/Pitch I-gain: 0
Roll/Pitch I-limit: 20
Yaw P-gain: 50
Yaw P-limit: 20
Yaw I-gain: 0
Yaw I-limit: 10
So, according to his instructions, I went into the first menu item called “PI Editor” and changed all of the variables to the values above. I did not change any of the limit values during the tuning process.
Roll and Pitch Tuning
The right and left roll angle of the quadcopter is controlled by the radio’s aileron stick movement. This is done by moving the right stick on my Mode 2 radio right and left. The forward and back angle of the quadcopter is controlled by the radio’s elevator stick movement. This is done by moving the right stick up and down. By default the KK2.0 links the tuning for roll and pitch together and I left it that way for my quad.
Roll/Pitch P Gain Tuning
Here is what KapteinKUK has to say about tuning the P gain value:
Increase Roll/Pitch P-gain by 10 (5 or less for a small aircraft) at a time, and test your aircraft response by hovering and move the left stick in short and fast movements.
As you increase the gain you will notice:
1: The aircraft reacts faster and feels more connected to the stick movement and wander less on its own.
2: The aircraft may oscillate for a short time. Usually a few oscillations, but may be more if gain is high. If it oscillates continually the gain is too high.
3: The aircraft may be harder to land, it bounces back when touching down.
4: The aircraft may climb.
When the aircraft has a good response and does not oscillate or climb when testing, P-gain is good.
I believe when he says “left stick” above, he is using a Mode 1 radio, where the roll and pitch are set up on the left stick. I use a Mode 2 radio where the pitch and roll are on the right side. As I moved the P gain value up by 10 it became more responsive. When I got my P value up to 80 the quad was much more responsive to my stick movements so I left it there. Some folks recommend raising the P value until the quad oscillates and then backing it off a bit, but I just stopped when it felt dialed in after raising it to 80.
Roll/Pitch I Gain Tuning
Here is what KapteinKUK said about tuning the I gain value of the pitch and roll:
1: Trim it level.
2: Fly fast forward and center the stick.
If it level itself, increase I-gain.
If it stays in attitude, I-gain is good.
Alternatively setting I gain to 50-100% of P-gain does the trick.
Here, I started with an I gain of 40 which was 50% of the 80 I chose for the P gain. When I got to 60, I noticed it would hold the angle I set by moving the right stick from side to side or forward and back.
The rotation of quadcopter is controlled by the radio’s rudder stick movement. The rudder is controlled by moving the left stick on my Mode 2 radio right and left.
Yaw P Gain Tuning
Here are KapteinKUK’s suggestion on tuning the P gain value for the yaw:
Increase Yaw P-gain by 10 (5 or less for a small aircraft) at a time, and test your aircraft response by hovering and move the Yaw control stick until it have yawed about a quarter of a circle, and then center it.
As you increase the gain you will notice:
1: The aircraft start and stops faster.
2: The aircraft overshoots less.
2: The aircraft may start to climb or descend.
When the aircraft has a good response, has a minimum of overshoot and does not climb or descend, P-gain is good.
Alternatively, set it to 100% of Roll/Pitch P-gain
I set the P gain to 60. This is where it stayed the most level while yawing.
Yaw I Gain Tuning
Finally, here is what KapteinKUK has to say about tuning the P gain value for the yaw:
Increase Yaw I-gain by 10 (5 or less for a small aircraft) at a time, do the same test as above.
When the aircraft overshoots even less, I-gain is good.
Alternatively, set it to 100% of Yaw P-gain.
If you have a small and not dangerous aircraft, you can disturb it around the yaw-axis and see if it returns. increase if not.
It is generally good to keep the gain values in the low range. Excessive gain may introduce vibration and control issues.
I also set the yaw I gain to to 60 to match the P gain.
Self-Level P Gain
Under the self-level settings menu there is another P Gain value that is specific to self-level mode. It defaulted to 40 with the version 1.2 firmware that shipped with my board. Version 1.5 of the firmware has an improved self-leveling algorithm. Since I prefer to fly in self-level mode, I upgraded my firmware. Though it is a little more advanced and not required, a USBasp AVR can be used to easily load newer versions of the KK2.0 firmware using the LazyZero KKMulticopter Flashtool. The later versions of the firmware have much better self-leveling capability, so I always upgrade my firmware. Here are the pins to connect the USBasp to the KK2.0.
The self-level P Gain was set to 100 after I changed the firmware to version 1.5. At 100 the quad leveled too quickly and became a little jerky. When I lowered it to 60 it behaved much better.
Final Tuned Settings
So, my final tuned PI gain settings were:
Roll/Pitch P-gain: 80
Roll/Pitch I-gain: 60
Yaw P-gain: 60
Yaw I-gain: 60
Self-level P-gain: 60
Tuned flight Video
The video below uses all of the tuning values listed above running the version 1.5 firmware in self-level mode:
After tuning, my quad flies much better. It is nimble and responds quickly to my controls, holds an angle and maintains altitude when yawing. After getting it dialed in with self-level mode off, I can now turn self-level mode on and it flies great! The advantage to self-level mode is that it stays level with the ground when the aileron/elevator stick is centered. While these setting work great for me, other pilots may have their own tuning values that work best for them.