Book Image

Arduino Robotic Projects

By : Richard Grimmett
Book Image

Arduino Robotic Projects

By: Richard Grimmett

Overview of this book

Table of Contents (21 chapters)
Arduino Robotic Projects
About the Author
About the Reviewers

Connecting a digital compass to Arduino

One of the important pieces of information that might be useful for your robot is its direction of travel. This could be given by a GPS unit, and we will cover how to connect one of those in Chapter 11, Using a GPS Device with Arduino. However, a GPS unit can be expensive, and it often doesn't work well inside buildings, because the GPS satellite signals don't penetrate buildings well. So, let's learn how to hook up a digital compass to Arduino.

There are several chips that provide digital compass capability; one of the most common ones is the HMC5883L 3-Axis Digital Compass chip. This chip is packaged onto a module by several companies, but almost all of them result in a similar interface. Here is a picture of one by a company called SainSmart, and it is available at a number of online retailers:

This type of digital compass uses magnetic sensors to discover the earth's magnetic field. The output of these sensors is then made accessible to the outside...