Calibrating Devantech cmps03

Hey all.

We purchased the devantech cmps03 for use on an autonomous outdoor robot for navigation purposes. We have wired it up as per directions and gotten readings by timing the pwm pulses. However, we are supposed to get readings within 3 or 4 degrees, but our readings are way off. They are pretty constant, but not at all the true direction. We figure this is due to calibration.

We followed the calibration directions in the manual and used the pin method. This changed the readings that the compass gave, but they are still highly inaccurate.

We are aware that tilt affects the compass readings and make sure to keep it level at all times.

Are there any suggestions as to how to calibrate the compass? Thanks

Is it a scale error or an offset error? In other words, if you turn it 180deg, does the reading change by a value representing 180deg?

No. For every ten degrees I turn it, it varies different amounts.

At least, that’s what used to happen. Now, after attempting some calibration, it gives good readings between 60-270 and seemingly random readings from 270-0-50.

Are you pulling pins 2&3 high? Are you sure your pwm timing is correct? Are you following these instructions for calibration? (Not trying to second-guess you, but it’s easy to miss some small things :D)

We are connecting pins 1, 2, and 3 to +5v. Pins 6 and 9 are wired together and are connected to ground. Pin 4 is connected to the white pwm wire.

And yes, we are following those instructions.

Basically, we point the compass north, connect and disconnect pin 6 (calibrate) to ground (pin 9, 0v). Then we repeat for the other three directions.

Hey guys! We got it to work!

Thanks for your input. It was a stupid mistake on our part. :o

Hello eagleslg,

I am having seemingly similar problems with a Devantch CMPS03 compass module.
Initially it was working and headings were accurate without needing to calibrate.
I disconnected the CMPS03 while I worked on some other hardware but when I returned to using the CMPS03 I found that the readings returned via the i2c bus are inaccurate.
The readings in (in 2-byte mode) no longer cover the full range from 0 to 3599 but vary from around 600 to 2700 varying gradually up and down in two cycles for a single 360 degree turn.

The values I am getting are as follows (rounded a bit):

compass…1-byte 2-byte
direction…value…value
N…060…0850
NE…191…2700
E……182…2560
SE…171…2410
SES…085…1200
S……087…1230
SW…092…1300
W……073…1020
WNW…056…0788
NW…060…0850
I am therefore very interested in what you did/found that finally resulted in your compass working correctly as I may have the same mistake/problem.