arduinoembeddedmpu6050pid-controller

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 (i.e. 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:

The code can read from the URL https://github.com/antonkewin/quadcopter/blob/master/quadpid.ino


Solution

  • Since its not provided, I am assuming that:

    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:

    Note, the more accurate your gyro data is, the higher you can set your kP to.