the electronic compass module or it will not function.
Although IFI currently does not support the I2C
interface on this microcontroller, we can simulate the
interface using bit banging that generates the required I2C
conditions (waveforms) by using the EasyC Pro firmware
which will be provided in Part 2. Using this method is not
as fast or as efficient as the hardware version, but it is fast
enough for our purposes. We will use EasyC professional
for this experiment.
In addition, you should be able to reproduce this
experiment using the VEX Cortex and even the VEX Pro
(ARM9) microcontrollers by just plugging the hardware
directly into the I2C port provided on them. In this case, the
bit banging firmware would be omitted but the compass
application would still be used.
Follow the schematic when making all the electrical
connections. On the VEX 0.5 microcontroller, we will use
the serial TX pin on the digital I/O block for the I2C SCL line,
and use the serial RX pin for the I2C SDA line. Note that
there are no customary pull-ups to the SCL and SDA lines
shown in the schematic. This is because the SparkFun
module already has them included in it.
The schematic also provides guidance for connecting
the two- or three-wire VEX motor, and the VEX quadrature
encoder and a bumper switch used for calibration of the
compass.
ASSEMBLING THE ELECTROMECHANICAL (EM) COMPASS
Use the VEX gears, axles, and metal parts, along with
the VEX motor and optional quadrature optical encoder, to
build the mechanical portions of the EM compass. Use
Figure 6 as a guide for mounting the parts necessary for
the compass gear train assembly, and for mounting the VEX
motor and quadrature optical encoder.
The mechanical assembly was kept as simple as
possible. The gears used can be found at the IFI website.
As you can see from the figure, one each of the following
gears was used. They are 12-tooth, 36-tooth, 60-tooth, and
84-tooth gears, which were necessary for the gear
reduction needed for the EM compass.
The pointer can be made from metal parts or it can
even be cut out of wood (non-metallic) to lessen the
magnetic interference. If metal parts are used for the north
pointer, then use a wooden stick or plastic rod on the south
end to mount the compass module as far from the metal
parts as possible.
The completed DIY electromechanical compass made
with metal parts is shown in Figure 7. To operate it, you
will need to first program it using the 0.5 microcontroller;
download and run the firmware provided using the IFI
bootloader or the Easy C Pro bootloader. The pointer
mechanism and the quadrature optical encoder (if used as
a reference scale) will both need to be calibrated to zero
degrees (north). Both the firmware and calibration process
will be covered in Part 2.
STEAMPUNK THE EM COMPASS
If you want to “steampunk” the project to make it look
cool, you can use a compass cardinal rose pattern such as
the one in Figure 8 to make a really large compass that will
impress your friends and neighbors. Other compass rose
patterns are available on Wikipedia at http://en.wiki
pedia.org/wiki/Compass_rose. It may require trips to
your local arts and crafts supply store, hardware store, and
office supply store. A file with
the rose is provided at the
article link.
If you would like to
customize the pattern, use a
photo editor to change the
colors or to tweak it the way
you want. To make it more
durable, have the pattern
laminated. You will also need
to reinforce the compass
pattern with a large circular
disk cut from stiff cardboard
to form the base of the
compass so that you can glue
the pattern to it. Then, drill a
small hole in the center of the
disk and allow the output axle
from the largest gear to go
through.
Attach the pointer to it
just like any classic magnetic
compass, then finally place a
large band (made from gold
FIGURE 6. Use this figure as a guide
for placing the parts of the EM compass
gear train, and mounting the motor and
optional quadrature optical encoder.
56 SERVO 01.2013