The British Interplanetary Society

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to the BIS forums.
Jast added - Project KickSat

Author Topic: Debugging MagGyroDemo  (Read 6370 times)

Laurence-de-Bruxelles

  • Jr. Member
  • **
  • Posts: 2
Debugging MagGyroDemo
« on: July 09, 2013, 11:05:36 PM »

For anyone interested:

Recently I noticed that I was getting odd readings when using the demo code, MagGyroDemo.ino https://github.com/zacinaction/kicksat/blob/master/DevelopmentKit/Energia/MagGyroDemo/MagGyroDemo.ino.

This code gives consistently different readings for the gyroscope than when running it alone, using the GyroDemo.ino code https://github.com/zacinaction/kicksat/blob/master/DevelopmentKit/Energia/GyroDemo/GyroDemo.ino.

As an example, here is a representative output from GyroDemo:
Code: [Select]
x: -34    y:11    z: 10
x: -34    y:11    z: 10
x: -34    y:11    z: 11
x: -35    y:12    z: 11
x: -35    y:11    z: 11
x: -34    y:12    z: 11
x: -34    y:12    z: 11
x: -34    y:12    z: 11
x: -35    y:11    z: 11
x: -35    y:12    z: 11
x: -34    y:12    z: 11
x: -34    y:12    z: 11
x: -34    y:12    z: 11
x: -34    y:12    z: 10
x: -35    y:11    z: 10
x: -34    y:11    z: 11
x: -34    y:12    z: 11
x: -34    y:11    z: 11

As can be seen, the output is stable, with a bias within expected limits (+/- 40). This is what we would expect, and we will refer this sort of output as the expected readings.

If we then upload MagGyroDemo this is the sort of thing I am seeing (on second reading; see below):
Code: [Select]
Bx: 16.94    By:3.65    Bz: -46.87
Wx: -264    Wy:85    Wz: 105

Bx: 16.94    By:3.72    Bz: -46.94
Wx: -271    Wy:80    Wz: 127

Bx: 16.72    By:3.72    Bz: -47.01
Wx: -272    Wy:80    Wz: 108

Bx: 17.01    By:3.72    Bz: -46.87
Wx: -264    Wy:95    Wz: 75

Bx: 17.15    By:3.58    Bz: -46.94
Wx: -273    Wy:61    Wz: 126

Bx: 16.86    By:3.58    Bz: -46.94
Wx: -276    Wy:85    Wz: 132

Bx: 17.01    By:4.01    Bz: -46.79
Wx: -259    Wy:90    Wz: 101

Bx: 17.01    By:3.65    Bz: -46.65
Wx: -268    Wy:99    Wz: 76

The output is still stable is much larger, by a factor of around 7.5.

Other errors have also manifested, but as yet I have been unable to reproduce them (see below). In one pattern, the gyroscope reading will often drop to zero, and then rapidly spike at twenty thousand. An error where the magnetometer reading did not update also occurred once. It is unclear at this stage whether these are linked to the increased bias error shown above.

On Saturday 6th Andrew,Duncan,Luke and his father, Stephanie, and I had a look at this at BIS HQ, and we tried various changes involving delay and order. The main outcome was that this problem is persistent, and real.

I have since been looking at pinning down the problem using the Sprite Development Kit loaned by the BIS. I will be posting updates here on my progress to show my working and also have many eyes on this problem. This should make understanding the root cause of the problem easier. I also hope that others could follow the methods listed here and report on whether they see similar results. Michael Johnson has already offered to loan his own Sprite, and Zac Manchester has said that he will also look into the problem. I will be sending Zac a link to this post through the github issue tracker to keep him updated and provide official bug resolution information.

Current progress so far is that I have found a precise method to reproduce the increased bias error, which also may give some insight into the problem. I will now give a brief summary of what I have found so far: during tests I kept a transcript of all serial output, with notes. If anyone is interested in these please let me know.

The test protocol is as follows:

- Load GyroDemo.ino, and note serial output. Load MagGyroDemo.ino, and note serial output.

The gyroscope data from MagGyroDemo will be similar to the output from GyroDemo.

- Now unplug and reconnect the Sprite.

The gyroscope data from MagGyroDemo will now be increased by a factor.

This method appears to reproduce consistently. Loading GyroDemo.ino will `reset` the gyroscope data to initial, expected readings. However, loading MagnetometerDemo.ino and then MagGyroDemo.ino will result in the anomalous readings, even before reconnection.

A second test method reveals a further subtlety:

- Load GyroDemo.ino, and note serial output

- Load MagnetometerDemo.ino, and note serial output

- Load MagGyroDemo.ino, and note serial output

The readings will be increased, without the need for reconnection.

I think this finding could give some insight into the root cause of the problem. Currently my best guess is that it is a setting within the gyroscope itself. Michael has also suggested a problem in the communication protocol, I2C, used to take data from the magnetometer and gyroscope. Obviously all possibilities will be explored.

Next steps for me are to see whether this error can be reproduced with two temperature sensors, or any combination of sensors; Andrew's idea of making multiple consecutive readings of a sensor; and also to see if it is possible to reproduce the other failure modes noted above.

However, if anything here has made you think 'aha!' I would love to follow that up too.

-----

Laurence
Logged