Working with the CMPS03 compass

Measuring compass orientation

The CMPS03 compass is relatively cheap and has been used with the Arduino board by other users. This page brings together their research and mine to explain how to use the compass effectively for different applications. Image above is taken from http://www.robot-electronics.co.uk/htm/cmps3tech.htm. On the page there is technical information about the compass as well as some advice on how to use it.

There seems to be two main ways to get data from the compass, the first and possibly simplest is to read the PWM output as analog in on the arduino and the second is to use the wiring I2c. Whatever data you get then has to be translated into a usable figure for your application.

Reading the compass with the Wire library for I2C

Using the code from here http://www.tigoe.net/pcomp/code/category/code/arduinowiring/9 it is very easy to plug in your compass and get really very accurate reading of rotational motion. However depending on your set up and location you might find that you don't get an accurate reading of where the magnetic pole. This can be down to your magnetic sources near to you or even in your circuit. It could also be that you need to callibrate the compass.

The image above shows the wiring for I2c connection. I think that this connection is probably better (more accurate) than PWM and seems straight forward to use.

Test application; Landmark compass

A student (weblink) here at Goldsmiths is making a compass that locates a user to landmarks around cities. Taking the Tigoe code as a starting point I am going to create a compass that outputs to 8 LED's positioned at 45 degree angles around a circle so that there are LED's at North, North-East, East etc. Image below shows the prototype under construction with the positioned LED's.

The project is a non-fully working prototype as there is no GPS which would be needed to work out positional angles. Otherwise it is fully working in a static environment (To see a youtube video of the user scenario click here). The user chooses the landmark and the light pointing to the direction lights up. This project would probably work really well if linked to a mobile with GPS which is very possible and could be a next stage.