I recently built a quadcopter and programmed a code to stabilise itself. The copter takes the hight from a distancesensors and the angle from a MPU 6050 gyro and accelerometer with a complementary filter. I currently face two Problems:

  1. Altough the MPU 6050 is mounted to a vibrationabsorbing platform the angle is really bad. Some ideas to lessen the vibrations would be good.

  2. The program never worked satisfactionally: I check every Milisecond, if the Copter is stabilised and at the right height or not. If not it spinns up the motors to correct. This should start the drone and let it hover at a certain height.

However, is the drone starting up well but shortly before take-off one side tilts up at an angle of apprximately 45° and the drone drifts of. The program could never compensate this. Have you an idea? Or some other thoughts. (This is my first electrical Project so very basic stuff could be wrong)

Thanks for your help.


1 Answer 1


It sounds like your control system is too basic for the task. Are you just firing up the motors if there is error? That is too simplistic. You should start by implementing PID control, that is not even too complicated, especially since you are using the mpu6050 where you can just read angles without doing sensor fusion yourself.

Regarding the sensor: is the angle so much better without motors on? You might try calibrating the sensor: https://github.com/kkpoon/CalibrateMPU6050

You will later need to read not only the angles but also the angular rate from your sensor. A function for that can be found in Joop Brokkings flight controller, or in mine (although I do not use the mpu6050 anymore). I am just finishing my own controller, first test flight I hope soon. If you want to see it: https://github.com/barafael/raPID There is also a blog post linked in the readme where I try to keep an up to date description of my system. Feel free to ask questions here or to me in case you get stuck. Good luck!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.