Jan 062013
 
 January 6, 2013  Posted by  Add comments

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.

DIY Quadcopter Part 4

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.

Yaw Tuning

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:

Conclusion

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.

Share

  67 Responses to “Easy DIY Quadcopter Build (Part 4) – Tuning”

  1. I’m new to RC flight. I’ve been flying a Syma X1 to get used to it. I followed this tutorial, which is awesome, by the way. I ended up with a KK 2.1. On my maiden flight I noticed that my quad immediately yaws clockwise (from the top) and begins to drift away. After much experimentation with P and I values, it still yawed. The KK 2.1 reads 0 from the controller and I calibrated it on a flat surface (3 times to be sure). So, I tried to trim the controller so it would not yaw. This only partially worked. If I hover is stays still but when I ascend or descend it begins to yaw again. Any ideas on what I should check next?

  2. Hi, in my first flight I felt the quad too much sensitive to the commands from the sticks, then I reduced the weight of the channels in the transmitter (80% for the throttle and 50% for the others). But until that time I didn’t make any tuning on PI values.
    So, only tuning the kk2 by the PI values I can reduce the sensitivity of the quad, or should I keep the weight of the channels reduced on the transmitter too?

    Thanks for the explanations!

  3. Hi, Britt. Your guide is so great. I have one question about the flight. My quadcopter always go backward when it lifting up. Is there anything I can do to avoid this situation? Thank you.

  4. Hi Britt,

    Your guide is great! I order exactly the parts you recommend, I had to wait some weeks for back ordered stuff
    and finally, I assembled everything and start the maiden flight today.
    The quad is crashing as soon as it is about 1 inch from the ground. It doesn’t stay horizontal and stable.
    Maybe I did something wrong in the settings. I will re check everything this week. I will let you know how it works.
    It’s my first experience with quadcopters. I wanted to try an inexpensive one before going to a bigger one for shooting with bigger camera. Your blog is fantastic and very easy to understand.
    Thanks again. You do a great job.

    Oh, just to let you know, I had a lot of problems with Hobby King. I received everything from Hong Kong, they did mistake, they didn’t want send the correct order back…. These people really sucks!

  5. I am looking forward to see part 5 :-)

  6. Whatever happened to part 5?

  7. Hi Britt,
    Thanks for the guide. I am a newbie and i have built the quad by using your instructions. I used multistar esc s. Everything was ok untill the first flight :-)

    When the quad rises about 20 cm above the surface, it starts swinging slowly. Then the swinging increases and the quad crashes.

    I used your pi settings with firmware 1.6 . What may be the problem, do you have any idea?

    • Have a video? Did you do the Esc throttle calibration and make sure all your trim values on the receiver test are trimmed to zero?

    • Is your board level, centered and facing the right direction? Are your motors spinning in the correct direction and responding correctly to appropriate stick movements? I like to test that everything is spinning and reacting correctly by removing the props and putting a piece of tape on the shaft. Props are dangerous and I don’t put them on until I know everything is set up correctly.

  8. Hi,
    Thanks for the guide, I now have a built and flying QC

    On my maiden flight I had a lot of trouble as the thing just started spinning. I found that this was due to one prop not being level. Of course the KK2.0 tries to correct this by spinning the AC props faster which only makes it spins it faster.

    Do you have any tips for ensuring the motors mounts (and therefore props) are level?

    Thanks

    Alan

    • In have never done anything special. I don’t balance my props, but I like a sturdy frame that is level.

      • Ok, I used a straight peice of wood in the end to make sure that the props were level on the round shaft, and now it doesnt spin around.

        Of course I have broken the landing gear – its not fit for purpose. So i am looking at modfiying it with a springy coathanger.

        • Did you see how I fixed my landing gear here?

          http://oddcopter.com/2013/01/04/easy-diy-quadcopter-build-part-3-5-landing-gear-fix/

          I am not sure I understand your leveling problem. Is the frame bent?

          • Thanks for the reply Britt, yes, I saw your reply and I may use that fix later, but for the moment I have removed the landing gear altogether and have pushed pipe lagging directly onto the stubs that the landing gear attaches to (works well).

            The leveling problem was due to the tubular arms . The motor mounts seem to need to be leveled by eye? or did I miss something in the instructions?

            Anyway, some success this evening, I managed short flights and have made a start on tuning as above.

            Any hints on gettng the motors level, greatefully received,

    • Hi, I have just finished building mine and test flying it last weekend.
      First question I have is a simple one. Is the self level controlled by the AUX channel?
      And secondly, what sort of flight times are you getting?
      Thank you for creating a really helpful thread build.
      I just love flying my quad.

      Ray

      • It can be set up to be controlled with an aux channel, but since the 4 channel radio I used in the post doesn’t have one, I control it with the sticks. About 5 minutes flights I think, you?

  9. Hey Britt,

    What “altitude hold / barometric” sensor would you use with this KK2??

    Thanks, Aiden

  10. Do the values set in the PI editor affect self-level mode at all, or do the values in the self-level option completely replace them?

  11. Thanks a lot for this tutorial! It is one of the few I’ve read that actually explains settings I’ve played with for days trying to configure a stable quadcopter. I’m a lot closer to that goal now, and feel I now have an understanding of the settings that allow me to configure this to my liking.

    You provided a wealth of information in easy to understand terms for a newbe. I hope at some point in the future I can help others as well.

      • Flashed from v1.2 to v1.5 and I am astounded. Tuning started out with the first values and was controllable from the first flight. My ending values are identical to those you finished with. Since this is my very first RC project, I’m still working on learning the controls.

        Today, I can handle a little wind (4-6 mph). It was easy enough for a newbe to handle. WHo knows, I might get good with this thing ;)

        Thanks Again!

  12. Hey thanks for this whole guide. I’m going to use it to build my own go-pro quad here soon. I was lost but you’ve explained a lot of things to me, thanks again!

    Wasn’t sure how to use a lot of the things nor what I needed but you made it simple and informative. Good advice on the tuning as well. I’m thinking about making my own chassis, possibly even out of a connex set from toysRus or walmart. Something light, real light, but able to lift a small camera.

  13. [...] setting up the KK2 board in X-quad configuration, I read this post, used the tuning settings from this post, and I was ready for my maiden flight. It’s also a good idea to read the [...]

  14. Hi Britt,
    Just to let you know I have successfully completed the multrotor Many thanks for the blog which made a complex project a breeze to follow.

    The odd copter is now tuned (being a complete newbie, I did the pi tuning with the multirotor attached to the workbench on one axis at time) and is completely stable (in autolevel) even with some breeze.

    My piece of advice for every body else is: get a good Tx, a good Simulator (I am using aeroSim RC) compatible with the Tx and learn the flying basics first.
    After around 3 hours flying time on the simulator, I am now able to keep the oddcopter hovering for a couple of minutes at 2-3 meters from the ground even in the confined space of my back yard.(that is,with multirotor nose facing forward I can move it as I like, but as soon as the direction changes I am lost! LOL)
    The other difficulty I have is to keep the quad hovering at a stable altitude, but it is improving.

    Next phase will have to be FPV. I have already attached a keychain cam (808 #16) and from the videos, I get the impression it should be easier to fly in first person view. I will report back once I will have tried.

    Again, many thanks for your help. I did not expect I was going to enjoy flying this much!

    Cheers,

    Stefano

    • Thanks Stefano! Glad to hear it is going well. What are your tuning settings? FPV is fun and it keeps you flying nose out all the time, but controlling altitude is a challenge. You might want to consider a board with good altitude hold.

      • Hi,
        Will check once back home and let you know. Out of memory, for both axis, P was set in the region of 40 & I 25 or so. Oh! and I found a way to switch autolevel from one of the HK T6A switches using a combination of mixes and sub trims. All forum post I came across stated this would be impossible to achieve without physically bypassing one of the knobs with a switch, but I found a clever way to do it and it works!. I will share the TX settings once I get back home.

        I am also considering a new FC and will be getting the apc 2.5 soon. But why hurry? I know someone who has done extensive researches and is generously sharing his findings and even detailing the steps to get there…..

        Keep up with the good work!

        Cheers,
        Stefano

        • Hi Britt,
          Those are the PID values after tuning:

          Pittch: P Gain 45
          P Limit 100
          I Gain 25
          I Limit 20

          Yaw P Gain 60
          P Limit 20
          I Gain 20
          I Limit 10

          I probably need to adjust the Yaw P gain but I like that in-flight pitch adjustments do not influence yaw at all.

          Cheers,
          Stefano

  15. Any ETA on the GoPro mount update?

  16. Hi Britt, thanks so much for your guides! they have been fantastic and I have been following them for my build. The only thing I did differently was use the AR6210 RX because I am using a dx6i TX and I wanted to use a spektrum RX. I have followed your settings for the KK2, but now I’m not sure what to do with the settings on my dx6i. What would you suggest?

    Thanks again! I am looking forward to seeing your guide on hooking up the Gopro.

  17. Thanks for the very nice guide :) I don’t have any previous experience with RC and this seems to me like a decent first build. Hope you publish part 5 soon as I very much want to see this thing with GoPro attached, as my aim is to build something that could do so. Do you know or have tested who much this thing could lift (payload)? Im thinking that if/when I make one and learn to fly it I might like to add FVP system to it and was wondering if it could take it?

    Thanks again :)

    Raven.

    • Ecalc says it will start to lose maneuverability over 1600g with 9 inch props, which is about what it is with a GoPro attached. If I add a gimbal or FPV equipment, I will probably have to get bigger, lower kv motors and bigger props.

      If you haven’t ever flown, I suggest you use a simulator or get a tiny ladybird quad to learn how to fly.

      http://www.hobbyking.com/hobbyking/store/uh_viewitem.asp?idproduct=24648&aff=588847

      That ladybird is great. I really like mine and it holds up well in crashes and is perfect to learn flying skills.

      • Thanks for the suggestion :) I think I will pick up that Ladybird and try to fly that first, before starting to build something a bit more serious. Only… How do that Ladybird cope with cold? I would like to get it soon(-ish) and not have to wait for warm weather if that can be helped (I dont really have indoor space to practice.

  18. Thank you so much for this write-up. It’s exactly what I need to start my next project.

  19. Thanks for the detail instructions. I am excited to make one. Do you get a chance to find out the flight time for a single charge? Also, how far up and perimeter would this copter possibly achieve?

    Thanks again for everything.

    MTG

    • I still don’t know the flight time. It has been raining here nonstop. I also have not tested the range for this radio, but it will fly as high and far as I would ever want to fly it. Keep in mind that rc rules in the US say they have to be flown within line of sight and under 400 feet.

  20. If I built the exact same quad using the exact same parts and the exact same tuning, Would it fly the same as yours? I understand different people prefer different configurations and just because you can fly it does not mean I can. I want to know if I built this same quad and tuned it with your setting would it fly the same for you as yours does? (Hope that makes sense)

  21. i made the mistake of tuning my quad with self-level on. it flies quite well with self-level on, but is basically un-flyable with self-level off. i am going to start over and tune it with self-level off.

    • Yeah, the really good pilots prefer gyro only (rate) mode for normal flying. I am not a very good pilot, so tuning is a little scary. On the KK2.0, as the pitch/roll is increased it becomes very stable even with self-level off. Too low and it is almost impossible to fly.

  22. what is the flight time with the 4000mAh battery?

  23. This series has been awesome. I have been agonizing over parts for the last month or so and it has given me some much needed direction. I will be matching your build almost part for part with one exception. I have been thinking about using the ArduPilot. I know that it is several times the cost of the KK but the ability to flick a switch and have it return home is very attractive, especially being new to the hobby of flying RC vehicles. I anticipate a number of oh **** situations where not being experienced could potentially cause a loss of the copter. I have been reading some horror stories on the forums.

    Do you have any experience with some of the controllers that have RTL and any recommendations for that matter.

    Thanks again for the great series, keep up the good work.

    • I think the DJI Naza works the best for return to home. It is also very easy to set up, but expensive. I had one and accidentally flew it in the pool that is just behind me in the video above. That was an oh **** situation. Actually, I was testing a new landing gear and it tipped over and skittered into the pool. Good bye Naza. Yeah, you have to be very careful. This stuff can be dangerous and costly.

      I have also tried the Multiwii Pro controllers that are much cheaper running MegaPirates NG. They work well, but are harder to set up.

    • Technobabbler,

      Did you manage to build this setup with the ardupilot? Because I thought about the exact same setup but with the multiwii flight controller. Any idea if an ardupilot or multiwii controller works well with this setup?
      thanks

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>