A lovely day for sunbathing

Just done yet another Phoebe rebuild – new motors, new props, replacement legs – none of which are truly necessary but I thought I’d treat her. As a result, a fresh gravity calibration was necessary. The results came out ±1% compared to the previous reading as per usual, but that got me thinking.

The MPU6050 has a temperature sensor, and the specifications show variance of accelerometer and gyro output against temperature.  The gyro is calibrated prior to every flight as part of the start-up sequence so not a problem, but I calibrate gravity at home in my 20°C office before taking her out to play in the 10°C park – I wonder how much difference that makes?  According to the spec, there’s a ±35mg (milli-g’s) in the X and Y axes offsets, and a ±60mg in the Z axis offsets over a 0°C to 70°C temperature range.  Given that my calibration values can easily vary by ±10mg, it’s certainly worth some further investigation.

The forecast for today lay between 5°C first thing in the morning, rising to 12°C mid-afternoon ambient.  There’s also the factor of the MPU6050 self-generated heat.  So Phoebe spent the day initially in the cold garage, and then moved onto a horizontal sun-bed basking in the spring sunshine in the back-garden under her own green-house cover, and periodically, I’d recalibrate gravity and check her temperature.

Phoebe's greenhouse

Phoebe’s greenhouse

Here’s what I found:

Accelerometer offsets vs. tempterature

Accelerometer offsets vs. temperature

Temperature ranges from about 7°C in the garage to 40°C in the greenhouse.  And as you can see from the plots, there is non-trivial variation.  Given how critical accelerometer readings are for both angle and drift calculations, it only makes sense to update the code to use the trend line equations (courtesy of Excel) instead of the fixed in-office calibration numbers.  I’ll give it a go and see if there’s any obvious effect.

2 thoughts on “A lovely day for sunbathing

    • Thanks David, though currently my belief is that the accelerometer is more important for a couple of reasons:

      1. I can calibrate the gyro each flight since it only needs to sit on stable ground, not necessarily horizontal ground, and hence gyro temperature drift will only build during each flight after which it’ll be recalibrated.

      2. The gyro is only used on its own for stability for the most deeply nested PIDs – temperature drift of its sensors will be handled by the next outer PID for absolute angles which uses the combination of Euler accelerometer and integrated gyro combined with a complementary filter – this ensures gyro drift only has effect short term, and the Euler’s dominate longer term.

      Still that’s all based on only 2 day old speculation in my head, and I haven’t flown the code changes yet, so I’m quite happy to be proven wrong – the gyros do definitely drift with temperature, but my current thought is this matters less than the accelerometer due to it’s short term impact on the system

      Cheers,

      Andy

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.