CMPS10 - Tilt Compensated Compass Module 

PWM mode

To aid the more basic controllers we have included a PWM  mode of operation. As the compass is rotated a high pulse will be generated that is proportional to the current angle. The pulse width varies from 1mS (0 ) to 36.99mS (359.9 ) in other words 100uS/ with a +1mS offset. The signal goes low for 65mS between pulses, so the cycle time is 65mS + the pulse width - ie. 66ms-102ms. 

Pin connections and mode selection for PWM operation

To enter the PWM mode of operation you are required to connect the Select PWM pin to ground. After 500ms the module will enter PWM mode and output a variable high pulse from the PWM out pin dependant on the angle of the PCB. 

Example 1: Pulse of 20ms - 1ms offset = 19ms = 190

 Example 2: Pulse of 6ms - 1ms offset = 5ms = 50

In some environments it may be necessary to perform a calibration to remove hard iron distortion, however I would recommend evaluating the CMPS10 performance first before implementing the routine. To achieve this a normally open switch must be wired between the calibrate pin and ground. The first step is to line the compass up with north, then  press the switch and the CMPS10 will light is LED. Rotate the module by 90 and repeat 3 further times, the LED should now go out and the module will be recalibrated. Should you wish to restore the factory calibration then press and hold the switch for at least 5 seconds before releasing. Please make sure that the CMPS10 is not located near to ferrous objects as this will distort the magnetic field and induce errors in the reading.