CMPS03 compass sensor.
The compass module is a CMPS03 from Technobots.
There is a PDF document which explains how to set it up, available from their website. I found it very easy to set up and use (I used the switch method). How accurate it is, isn't really that important at the moment, but seems very good.
I mounted the module on a block of wood, which was fixed to a larger piece of cardboard, which had
a right angle cross marked on it. The module was aligned with one of the lines of the cross(for North)
and fixed in position.
I placed a larger piece of cardboard on the floor. This again had a right angle cross marked on it.
One of the lines was pointed to north using a proper compass, and weighted down so it would not move.
The 'North' line on the module card was lined up with the 'North' line on the floor card.
Now calibration can start. Flick the switch on/off, when the LED comes on, that setting is complete. Rotate the module
card 90 degrees(to the next line) and continue as above for all 4 points.
The device is calibrated and should not need setting again.
The MAIN PIC reads the device in
I2C bit-bang mode(the same as the
ultrasound sensor SRF02),
which works very well, and the data is sent via the Radio TX module to the handheld device.
The handheld device receives data via the RF RX module and is displayed on the LCD, or sent to the PC.
I2C include file.
CMPS03 compass module and my circuit board.
- Red wire = 5v.
- Black wire = 0v.
- Green wire = I2C SCL.
- Yellow wire = I2C SDA.
- 2 x 2k2 res. for I2C pull-ups.
- 1 x 1k res. for led pin5 to 0v(calibration only).
- 1 x momentary switch pin6 to 0v(calibration only).
- 1 x 0.1uf decoupling cap.