I have gone back to first principles and re-read all information here and in the links, but i am still finding the LSM303D uncalibrate-able!!
i even closed off the possibility that my unit was faulty and wired in a new unit, but same outcome There must be something that i am overlooking, but for the life of me i cant see what it is. PLEASE SEND HELP!.. i just want a tilt-compensated compass.
The problem (as with each run earlier in this thread) is that when the heading is constant but the unit tilts or rolls the heading does not remain constant.
Here is my process:
- Gather up the RAW data from the LSM303D’s Magnetometer and Accelerometer by rotating the unit in equal increments around each axis
- Put data into Magneto software to get the Mag & Accel compensation factors
- Insert the compensation factors into heading.ino (being very careful about the + & - signs)
- Test
OK can you see any problems with this process??
Firstly GATHER THE RAW DATA:
There are three data gathering runs (see pic.):
A: is with the unit on the flat. (this is for heading) and rotated about a vertical axis
B: the unit is horizontal and rotated incrementally around a horizontal axis
C: the unit is horizontal but with a different face parallel to the axis and also rotated around the horizontal axis.
For each of A,B and C
- my increments are 10 degrees each, so that’s 36 stationary points around a circle.
- at each reading i average 50 readings back to one data output for that position - the code for this is earlier in this thread.
- this gives 108 orientations for Mag & Accel affected ONLY by gravity (they are stationary data reads)
For completeness here i can graph the RAW data (all 108 rows of x,y and z outputs, to see if the outputs are something that kinda ‘looks right’.
Here is MagRAWdata for x-y, then y-z then x-z:
…and here is AccelRAWdata for x-y, then y-z then x-z:
For one extra check:
i can graph ONLY the relevant parts of each of the 108 data rows [i.e. only the 36 ‘A’-orientation points for x-y, only the 36 ‘B’-orientation for y-z, and only the 36 ‘C’ orientation for X-Z] then this is the graphed output:
for mag:
and then for Accel:
Magneto can make the ovals into circles and centre the data and as you can see every one of the charts are like this EXCEPT FOR accel x-y which is weird! could this be where the problem lies?
THEN PUT THE DATA INTO MAGNETO
i separate the output into two tab-delimited .txt files, one Mag and one for Accel. I assume that i do this for all 108 points, not just the 36 for each orientation??
Can anyone kindly clarify if the process this far is correct?
many thanks
dB