Home > Electronic Compass > Application Notes > Method for testing the electric compass

Method for testing the electric compass

 

The steps for testing a device that has an electric compass unit

 Test in the following order: I2C test -> Sensor output value test -> Compass test

 

(1) I2C Test

 Test whether the I2C driver responds correctly to commands.

 First, check the response to the WHOAMI? Command.

 If there is no response, check whether there is a fault in the hardware in the circuits around the compass unit or else if the compass software address settings are correct.

 

 One thing to be careful of is that since the measurement value is read in 1 byte (8bit) units, when the apparent register address straddles an even and odd numbered address of 2 bytes, it should be read 2 bytes in one session.

 

 In other words, carry out the reading in the order of Send StartCondition-> Send Address -> Receive 1 byte of data -> Receive 1 byte of data-> Send stop condition.

 

(2) Sensor output value test

  Observe the compass’s measured value.

 While looking at the X and Y-axes’ magnetism, try rotating the sensor while level and see if there is a change in the measured value.

 

 If the sensor’s value does not change, confirm whether there is a compass fault or magnetic saturation and isolate the cause.

 

 For Android smartphones, if you are using our driver, it gives no raw measured values of the sensors, so it may be difficult to judge whether the trouble comes from hardware origin or software origin.

 If you get our driver that has debug API functionality, you can verify whether or not it is a hardware fault by inspecting the compass’s raw measured values.

 

(3) Compass test

 Rotate the device while level and confirm that the azimuth changes from 0~360 °.

 

 Rotate at a slow, constant speed, and see if the azimuth changes at the same rate.

 

 If the azimuth does not move correctly, there may be some noise source near the sensor.

 In order to check, while recording the compass’s measured values, rotate the sensor while level.

 

 Try plotting the measured values for the magnetism of the x and y-axis on a 2-dimensional graph.

 You can confirm if it is in a normal condition if the plotted graph is a clean circle.

 If it’s not a clean circle, try the following steps to determine whether automatic calibration is sufficient to correct or if manual calibration is required.

 

 In an environment where the earth’s magnetic field is not disturbed (like open air field), wave the device through a figure 8 and apply the automatic calibration. After that, plot again and do this several times. If the result is not absolutely circular, it is likely that separate, manual calibration is required.