Programmable GPS compass

This was a really interesting Arduino project, where I was tasked to do a programmable GPS-based compass.

The idea was to build a device which can take a set of GPS coordinates from a PC and turn its arrow to always point toward those coordinates. A real compass always points to the (magnetic) North. This device can be configured to point to any… point.

While developing this project, I realised that it would be nice to have a way to simply and effectively “modularize” my code. A substantial portion of the code was repeated from my earlier projects, mostly around the serial communication and the protocol used there, but some other bits of the code were reused as well. The modular system for Arduino code that I came up with filled the need quite nicely. I will have to describe it in a blog post some day.

In the meantime, here is a short demo of the device in action:

 

An interesting thing I learned during this project is that the magnetic field of the earth does not flow along the surface of the Earth. Not even close! On my latitudes (Europe), it comes up from the ground, and rather steeply at that! This is called magnetic inclination (not to be confused with magnetic declination).

For my project, it meant pretty much nothing as long as the device was held in a horizontal position. But as soon as you tilt it to any side, the arrow goes off like crazy and starts showing nonsense. This effect is different depending on the angle and direction of the tilt. Understanding it takes a bit of college-level algebra, but it can be programmed in Arduino without much problems.

However, the client wanted the product ASAP and had no need for this use case. So the full 3D solution remained on the drawing board for a future project.