or aluminum foil and cardboard
strip) around the circumference
of the laminated compass base.

For operational safety and
further weatherproofing, it may
also be wise to carefully cover
the top of the compass with a
large clear circular plastic or
glass lid to keep hands from
getting near the compass
pointer. The compass should be
mechanically operational at this
point.

Warning: Wear goggles
when operating this compass,
especially if it is not covered
with a clear plastic or glass
lid. Keep the area where it is
being used clear of any
extraneous objects and keep
clear of the rotating compass
pointer, especially when powering the microcontroller
or programming it since it may move inadvertently.

We covered digital sensors using the I2C bus and how
they are used for robotics applications. In the process, we
learned a bit about reading both magnetic and electronic
compasses. We also found out that they can be used for
many other electronic applications that require legacy
analog sensors, such as home heating, HVAC, humidity,
weather applications, etc. The nice thing about using digital
sensors is that they are usually factory calibrated so that the
readings make sense when they’re first turned on.

In addition, we learned what the I2C bus was and how
I2C sensors can be networked together using this bus, as
long as one of the devices uses pull-up resistors on the two
signal lines (SCL or SDA). We also discovered that the I2C
protocol is composed from simple I2C conditions such as
START, STOP, ACK, and NACK.

We also discovered (to our dismay) that magnetic north
and true north do not necessarily coincide, and that we
have to compensate for this fact by adding or subtracting
the declination from true north based on our current
latitude.

Recall, we observed from the experiment that the
compass has to be kept relatively level to obtain accurate
readings. This is why more modern electronic compasses
are mounted on gimbals and are floated in clear water.
More expensive electronic compasses have this feature built
in to compensate for tilt.

A challenge to the reader is to use the information
contained in this article to make a self-leveling electronic
compass.

FIGURE 8. If you want to "Steampunk" the project to make it look
cool, you can use a compass cardinal rose pattern such as the one
shown here to make a really large compass that will impress your
friends and neighbors.