i need some help with getting a tilt-compensated compass to work:
i'm using an LSM 303D with an arduino. the I2C is chatting fine, i've calibrated using calibrate.ino and i'm getting all the outputs that the code libraries provide.
so i'm most of the way to getting my tilt-compensated compass (it's for a sailing project) to work, however the heading() is fluctuating when i hold the break-out board's heading the same, but add roll and pitch.
you can see in the .pdf i have heading plotted. i leave the break-out board stationary for a while (heading is stable), then i change roll -90deg,+90deg then pitch-90deg,+90deg. the heading should stay constant but it doesn't ... you can see it fluctuates then returns. this is not tilt-compensated :((
I think heading() should be better than this. So is is better to use raw data + try to source other equations instead OR using am i doing something wrong with heading() ??
If the tilt correction is not coded properly, it won't work for 90 degree tilts because of problems with sine/cosine terms. However, it may work for much smaller tilts.
Theory here. You might try Pololu's code for that compass.
(note: the min and max numbers in the .ino are taken from the results from running calibrate.ino and doing the 3D 'dance')
regarding the roll approaching 90deg. i agree, but the values go haywire even up to 45deg. infact they start going weird from as little as a few degrees!
yes the library i mean is from the link on Pololu's site. Thanks for the suggestion - i will contact them direct + and report back here for anyone else that may need same info. standby....