Thursday, October 6, 2011

New accelerometer calibration

A first prototype of a custom compass has been built, and an improved calibration procedure for the accelerometer has been tested.

The compass has 4 components mounted on a rigid base:
  • a small board featuring an ATmega128A microprocessor operating at 3.3V and 8 MHz
  • a MicroMag 3-axis magnetometer
  • an SCA3000 3-axis accelerometer
  • an NCP1400-5V Step-Up board acting as a power supply to the SCA3000.
The compass base has been fitted with wooden pegs on the X and Y axis. When supported at each end of the X or Y axis peg, the compass assembly can be rotated a full 360 degrees for calibration purposes.

Four flexible wires connect the compass to a remote 3.3 V power supply, a remote serial-to-USB converter, and a remote momentary-contact button. This configuration corresponds to the intended installation on the boat.

In accelerometer calibration mode, when the button is pressed, 64 consecutive raw measurements are sent to the serial port. A remote laptop running Hyperterminal continually saves these measurements in a text file. The compass assembly is rotated step by step around X axis and measurements are taken after each small rotation. Then the procedure is repeated around Y axis.

The following figure illustrates the first set of measurements taken with this arrangement, as rendered in Google Sketchup.

The resulting text file is then processed by the Magneto software to find the calibration parameters.

The compass base is then placed completely horizontal, and a set of measurements (64 consecutive values) is taken at this position. The average of these 64 raw measurements is:
   arx = -93.7656     ary = 61.56813    arz = 1420.344

After applying the calibration correction,

we obtain:
   aax = -0.2244         aay = 68.61544        aaz = 1332.229      (vector v1)
and the norm for these calibrated values is calculated at 1333.995, which is a comforting result.

These calibrated values describe the orientation of the accelerometer reference frame in the gravitational field.

From the calibrated values, the heel and pitch values are calculated at  -2.95 deg (heel) and 0.010 deg (pitch). These angles reflect the orientation of the accelerometer vs the rigid base.

At this same horizontal position, we conclude that the orientation of the rigid base in the gravitational field is described as:

abx = 0.0       aby = 0.0        abz = 1333.995     (vector v2)

From the values of vectors v1 and v2, it is now possible to calculate the rotation matrix that can be applied to any calibrated vector v1 (accelerometer orientation) to get the associated vector v2 (rigid base orientation) :

The technique to calculate a rotation matrix from 2 vectors is documented here.

We will need this rotation matrix later on for the tilt compensation corrections.

The next step is to apply the same calibration procedure to the magnetometer.


  1. My cousin recommended this blog and she was totally right keep up the fantastic work!

  2. Calibration
    Great post.Really informative.Once again me and my cousin watch this today.Hope to see more similar blog.

  3. We provide a wide range of the billing machines in chennai, to the customers. Our billing machines are manufactured using advanced technology and high quality raw materials that are procured from reliable vendors. We are engaged in offering these machines which are known for their high performance and accuracy.

    #Billing machine in chennai, #Billing machine price in chennai, #billing machine shop near me,#billing machine for online, #hotel billing machine, #restaurant billing machine sale in chennai, #top billing machine, #company in chennai, #hotel billing machine in chennai, #billing machine sale, #billing machine supplier in chennai, #supermarket billing machine price in chennai,

    No.5, New Avadi Road, Villivakkam, Ambattur - 600049, Tiruvallur, Tamil Nadu, India