Thanks, you suggestion is very much to the point. I can see that the quality of the output largely depends on the frame rate. If it is just a few percent off 100fps, it starts to drift a lot. I'm assuming this is due to the double integration of the acceleration data? I also had delay in the I2C routines as I found that commands were ignored if sent too fast. The result was that reading the accelerometer data took 1-2 ms. As I was using the same timestamp for accelerometer and gyro, that probably caused some inaccuracy as well. Finally I'm currently taking the timestamp from the 32.768kHz RTC; as the MCU must sleep between cylcles, which probably also causes some inaccuracies. I will see if I can get a more accurate counter.
... View more