
284 MAKING THINGS TALK
Calculating heading can be done using a
compass if you are in a space that doesn’t
have a lot of magnetic interference. There
are many digital compasses on the market.
These acquire a heading by measuring the
change in the earth’s magnetic field along
two axes, just as an analog compass does.
Like analog compasses, they are subject
to interference from other magnetic fields,
including those generated by strong elec-
trical induction.
MATERIALS
» 1 solderless breadboard such as Digi-Key part
number 438-1045-ND, or Jameco part number
20601
» 1 Arduino module or other microcontroller
» 2 4.7kΩ resistors
» 1 digital compass, Devantech model CMPS03
available from Acroname Robotics, part number
R117-COMPASS, or Robot Electronics CMPS03
Determining Heading Using a Digital Compass
This example uses a digital compass from Devantech,
model CMPS03. It’s available from www.acroname.
com, and www.robot-electronics.co.uk. It measures its
orientation using two magnetic field sensors placed at
right angles to each other, and reports the results via two
interfaces: a changing pulse width corresponding to the
heading, or synchronous serial data sent over an I2C con-
nection. You’ll recognize some of the I2C methods used
here from the SRF02 distance ranger example shown
earlier. Both are made by the same company, and both use
similar protocols.
The interface to the microcontroller ...