Few weeks ago Dexter Industries sent me a prototype of the dCompass. I was really pleased with the sensor as this compass proved to be a really good one. It was a nice addition to my IMU.

But a compass sensor can be used for other things than using it as a compass. With a little imagination you can make very cool robots with it. In this post I’ll give a few suggestions. Also, you have the chance to win one.

Using the dCompass as a compass is the obvious thing to do. Still I want to give you some hints regarding this.
The compass measures the magnetic field over three axes. The direction of the sensor is calculated from the strength of the magnetic field over the X and Y axis using the atan2 function. Luckily, most drivers will do this for you. When using the dCompass as a compass you’ll have to make sure it is level and kept away from magnetic disturbances. Keep it 10 to 15 cm from the NXT brick and (heart of) the motors for best results.

The fact that the dCompass detects all magnetic fields and not just the earth magnetic field is the basis for many other uses of this sensor. But before I dive into this some more about the earth magnetic field. One thing that might surprise you is that the magnetic north is not somewhere on the ground. If you live on the northern hemisphere it is somewhere underground. If you live on the southern hemisphere it is somewhere in the sky! The earth magnetic field does not change. It always points at the same direction and it always is of the same strength. Only when you go to another place it’s direction and strength changes. Just as you can calculate the direction of the magnetic field you can calculate its strength (emf). Pythagoras tells us how. emf=sqrt(x^2 + y^2 + z^2)
Once you know the strength of the earth magnetic field you can use this to calculate the strength of other magnetic fields (omf) near the compass. This of course is the difference between the measured field strength and the earth magnetic field.
omf=sqrt(x^2 + y^2 + z^2) - emf
The resulting value is the gateway to other uses of the dCompass. If omf equals zero there are no disturbances around. Any other value is an indication of something magnetic in the vicinity.

So what exactly can you do with this information? Here are some ideas:

  • make a traffic counter that counts the number of vehicles that pass by. You might even be able to deduce the kind of vehicle from the field strength as well as its direction.
  • make an magnetic key with a motorized lock that only opens when the right field strength is measured.
  • make a rotation counter that counts the number of revolutions of something turning.
  • you can expand the previous idea to make something that shows you how fast your bike is going.
  • make a device that tells you where in the wall the electric wires run.

Well, these are just a few ideas to trigger your imagination.

If you have a good idea you can find more info in the compass or buy one at Dexter Industries. Or, if you are really lucky, you can win one here. All you have to do is to subscribe to my blog. I will randomly draw a winner from all my subscribers on 15 march 2012.