Compass
An Arduino sketch that takes a bearing from a GPS module to display north
Description
This is a very simple sketch that takes the current course and uses it to display north on a LED shield. Basically it is just an implementation example of Mikal Hart's excellent TinyGPS library, since all it does is call gps.course() and pass the value off to the display.
A Word About How GPS Works
To clear up some confusion, here is some background on the behind the scenes processing happening in the GPS module.
GPS units are able to tell two things, where they are, and what time it is. Unfortunately while they know where on Earth's surface they are, they do not know which direction they are facing. On expensive commercial GPS units a magnetic field sensor is added to provide bearing information, but without that all we can do is cheat.
Without a dedicated digital compass the only way for a GPS module to tell which direction it is facing is by determining which direction it is traveling in. If we assume people tend to walk facing forwards, then direction of travel is a relatively good way to determine bearing.
The problem with this method is that there is a lot of 'noise' introduced. As the GPS unit naturally wanders a bit within its accuracy range, that creates the illusion of travel in a random direction. Care needs to be taken in the interpretation of the bearing results when you stop moving since they will begin to go off in seemingly random directions as your perceived location wanders a bit.
| Attachment | Size |
|---|---|
| GPS Compass 2010-06-10.pde | 3.6 KB |
| 3rd Party Libraries.zip | 16.84 KB |
- 111 reads

Comments
Post new comment