SparkFun will be closed on Tuesday, November 5th to support our team in being able to go out and vote! Orders placed after 2 pm MT Monday, November 4th will ship on Wednesday, November 6th. Thanks for your patience and understanding.
We can use digital magnetic field detectors as a compass to give our robot an absolute heading.
Time for another Adventures in Science! While finding north has never been particularly tricky for the navigators of yesteryear (see: compass), teaching robots how to navigate is a tad more difficult. While GPS can give you a position, it won't immediately provide heading data without gathering several position points first. To remedy this, we have digital magnetometers, which we can configure to act as a compass.
Detecting magnetic fields can be accomplished through a variety of methods, including measuring the buildup of charge carriers on the edges of semiconductor material, or measuring the deflection of a beam with an attached permanent magnet. As technology progresses, these measuring devices continue to shrink in size, which is how we're able to fit magnetometers in smartphones, along with dozens of other sensors.
To get a heading, we need to calibrate the magnetometer, which involves taking samples several times per second and finding which direction yields the strongest magnetic "north" (or "south"). Every time we reset the sensor, we'll need to perform this calibration, as the ambient magnetic fields change depending on your location and surroundings (e.g. electronics, other magnets). The tutorial below will show you how to use the SparkFun MAG3110 magnetometer breakout with Arduino.
For information on the digital compass shown in the video, see these links:
Any tips for getting better accuracy out of a magnetometer when it comes to finding a heading? Feel free to share in the comments!
Awesome!! Shawn... you nailed it like always by bringing up new techniques or by reminding old techniques.
From a navigation standpoint, east is 90 degrees, south is 180, and west is 270. Great video :)
Yeah, I remember reading that in my research. For whatever reason, the Arduino library for the MAG3110 gives West as -90. Oh well.