Found the solution, running out of problems :-)

More stats, yippee!

Vertical Velocity graph

Vertical velocity vs Acclerometer

OK, looks noisier than yesterday, but look at the scale!  The vertical velocity is no longer growing, and it’s nicely averaging out the noise from the accelerometer.

The problem?  It lay in the calibration of the acclerometer (the gyro was fine, oddly, as they use the same code).  The calibration is way out (by a factor of two) if the Accelerometer is read too often (it was at 100Hz).  Slow it down to 50Hz, and all’s fine.  Importantly, the calibration values between runs also seem consistent, which means I can save them to file, and restore them for use when takeoff is not on a completely horizontal surface.

So that’s the next step.

 

6 thoughts on “Found the solution, running out of problems :-)

  1. Thanks for the update. You have inspired me to start my own blog so I can log my Quadcopter experiences. You can find it here: http://dtran11.blogspot.com/

    I will post some videos soon. Currently having problems with the quadcopter drifting. I just flashed my ESC’s to simonk. Hopefully it helps.

    • Are you using my Python code and a Raspberry Pi, or one of the many code / software solutions for Arduino? My code is very experimental, and I’m still testing the drifting code so I wouldn’t rely on it yet for anything more than just a take-off / landing for a few seconds.

      I’ve just bought some better ESCs also with SimonK firmware flashed on them but I’ll be using those for Phoebe’s big sister that I’m just starting to build.

      • I am using a PIC32 for the flight controller. The code is from scratch with a lot of help from reading other blogs. I didn’t know how a Pi would do with realtime stuff so I chose the PIC32 instead. The main loop is running at 500Hz.

        • Cool – I’ve only every used a PIC once for a hi-fi preamp display 14 years ago – it sounds like it’s got more than enough processing speed – my python loops at 176Hz maximum, but that’s still fast enough – because of momentum, I don’t think there’s any need for strict real-time because momentum will always mean sensor feedback will always lag behind what the props are trying to do. I’m only guessing though

  2. Can you explain more on what you do in the calibration step? I am making a quacopter flight controller also and I use the mpu6050. At startup, I read the gyro data for several seconds to find the offset. I only do this for the gyro since I would think the accelerometer z axis data (gravity) is needed to calculate the angles so I don’t subtract the offset for that.

    Thanks

    • You’ve got it right. I’ve recently updated calibration to do something similar:

      Just before any flight, I calibrate the gyro offsets for pitch, roll and yaw speed accuracy.

      But occasionally, I do still calibrate the accelerometer, and save the results to file. I do this indoors on a very horizontal surface. Before each flight, I read these calibration values and use them to calculate speed in 3 dimensions; I still use the raw, uncalibrated accelerometer output for calculating angles like you.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.