Balancing quadcopter using arduino

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. 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(ie roll). I have also constructed a balancing stand for the free movement of roll axis by the motor.

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.

Some of my queries are,

  • whether a single PID loop is enough, or we have to add another
  • what type of tuning method, i can implement, to find the kp, ki, kd other than trial and error
  • 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
  • The code can read from the url https://github.com/antonkewin/quadcopter/blob/master/quadpid.ino


    Since its not provided, I am assuming that:

  • The Loop time is atleast 4ms. (The less the better)
  • The sensor noise is been reduced to an acceptable level.
  • MPU-6050 needs gyro+accel data to be combined to get angles in degrees.
  • If the above points are not taken care of, it will Not balance itself.

    Initially, you can get away without tuning kI. So let's focus on kP and kD:

  • Keep increasing Kp till it starts oscillate fast. Keep the Kp value half of that.
  • With kP set, start experimenting kD values, as it will try to dampen the overshoots of kP.
  • Fiddle around these two values, tune it for perfection.
  • Note, the more accurate your gyro data is, the higher you can set your kP to.

    链接地址: http://www.djcxy.com/p/78610.html

    上一篇: ATMEGA8A + SPI内存奇怪的行为

    下一篇: 使用arduino平衡quadcopter