title: Balancing quadcopter using Arduino
body: <p>I am doing a project on self balancing quadcopter with Autonomous control. I am using Arduino Mega 2560 and MPU6050. I have obtained the roll and pitch angles from MPU6050 without the help of DMP and applied complex filter to omit the noise due to vibration.</p>
  <p>Also configured and able to run the BLDC motors with Flysky Transmitter and receiver with the help of Arduino interrupts. Now for balancing I am focusing on only one axis (i.e. roll). I have also constructed a balancing stand for the free movement of roll axis by the motor.</p>
  <p>For the controlling part, I am implementing PID algorithm. I tried using only the kp value so that, somehow I can balance and then move on to ki and kd term. But unfortunately, for Kp itself, the quadcopter is undergoing aggressive oscillation and is not settling at all.</p>
  <p>Some of my queries are:</p>
  <ul>
  <li>Whether a single PID loop is enough, or we have to add another?</li>
  <li>What type of tuning method I can implement, to find the kp, ki, kd other than trial and error?</li>
  <li>I programmed my ESC for 1000 to 2000 microseconds. My PID input angles will be within the range +/- 180. Whether I can directly set the PID output limits for range -1000 to 1000 or -180 to 180 or any other value?</li>
  </ul>
  <p>The code can read from the URL <a href="https://github.com/antonkewin/quadcopter/blob/master/quadpid.ino" rel="nofollow noreferrer">https://github.com/antonkewin/quadcopter/blob/master/quadpid.ino</a></p>