praneshkmr / node-lsm303

Node.js Library for LSM303
MIT License
7 stars 7 forks source link

Is it possible to add tilt compensation feature on magnetometer without using another sensor? #6

Open ActionNerd opened 9 years ago

ActionNerd commented 9 years ago

Magnetometer (compass) skews when tilted out of the XY plane. Investigate if it is practical to try to implement a tilt-compensation feature.

From ST Micro paper on tilt:

Some microcontrollers may not support floating point operation and are timing critical. In order to build a standalone tilt compensated electronic compass, the following recommendations may be helpful: ● Use look-up tables for sin, cos, arcsin, and arctan functions to reduce clock cycles ● Use assembly code to implement signed integer multiplication and division subroutines to reduce clock cycles ● If some sensor calibration parameters are very small, the user can multiply the whole accelerometer and magnetic sensor calibration parameter matrix with a big constant integer, then divide it before the pitch/roll/heading calculation ● Use internal EEPROM to save sensor calibration parameters ● Implement some kind of digital filtering or simple moving average function onto the sensor raw measurements to reduce the noise level and improve the pitch/roll/heading accuracy

Pololu Github repo on tilt compensation for this sensor controlled with a ATMega chip is here.

praneshkmr commented 8 years ago

Hi @ActionNerd , any updates on this issue? Thanks :)