Compass test

For the navigation of my robot I want to use the CMPS03 Compass Module from Devantech (http://www.robot-electronics.co.uk/htm/cmps3tech.htm). This module has an I2C interface so it would be easy in combination with the USB-I2C interface (http://www.robot-electronics.co.uk/htm/usb_i2c_tech.htm) I use.

Compasstest

To test this setting I made a simple wooden board with those two components on it. After connecting both modules I installed the driver for the USB-I2C module on my windows machine. No problems with that.

To test the working of the setup I used the I2C interface tool provided by Devantech. The configuration of reading the CMPS03 registers with this program is available after installing. So far so good.

I saw that I got wrong readings because not all numbers of the full circle came through. This was caused by the metal bolts and nuts I used to fix the CMPS03 module to the wooden board. They where a little bit magnetic. On the picture you see the solution for this problem with tie-raps and the wall plugs.

I2Cinterface

The screenshot shows the result of using the I2C interface tool from devantech. I am planning only to use register 1. This register represent the 360 degree in a single byte. The value from 0 till 255 should be accurate enough for the robot right now.

The software for this test was written in C++ and is running on a linux (Ubuntu) OS. Thanks to the information on http://perpetual-notion.blogspot.com/2009/01/srf02-ultra-sonic-ranger-and-linux.html from Christopher Friedt I managed to make it work. The code from Christopher was easy to change to meet my own needs.

You can find the code here: compass.