Spinning Compass

by Dale Heatherington

Feburary 24th, 2008

Full body spinning combat robots need a stable heading reference to be able to move across the floor while spinning. Generally the wheel motors are stalled and/or accelerated in sync with the rotation to accomplish this. The stall/accelerate commands must be synced or the bot will not be controllable. My Scary-Go-Round bot used an IR beam from the joystick controller for this purpose. There are several drawbacks to IR. The sensor must be located high enough to keep the opponent from blocking the beam and the operator (me) has to keep the controller pointed at the bot at all times. With components I used the range is limited to about 20 feet.

This experiment uses the earths magnetic field for the heading reference. A magnetic sensor rotates with the robot in the earths magnetic field and generates a sine wave as it spins. The zero crossings can be applied to the interrupt pin on the bots control CPU to provide a stable heading reference.

The first step was to locate a suitable magnetic sensor sensitve enough to detect the earths field which is only about 0.5 gauss. Honeywell makes a line of Hall effect sensors ideal for this purpose. I used a single axis sensor part number HMC 1021Z. It can measure fields from 0 to 6 guass and has a sensitivity of 1 millivolt per gauss. I bought a few from DigiKey to experiment with. It may also be possible to use a coil of wire on an iron core as the sensor.

As the bot rotates the sensor output will be zero facing east or west, 0.5 mv facing north and -0.5 mv facing south. As it spins the output will trace a sinewave 1 mv peak to peak. To boost this feeble voltage to more useful levels I wired an OP-AMP for a gain of 200. The input is differential to match the outputs of the sensor. I also connected a 0.01 microfarad capacitor across the output and minus input to limit the bandwidth to less than 100 hz. After being amplified 200 times I get a 200 mv p-p sinewave out.

The 200 mv sinewave is AC coupled to a comparator with a 4.7 uF cap. The capacitor removes all DC offsets so the comparator only responds to changes in magnetic fields. The comparator drives a high intensity LED in this experiment but would drive the interrupt pin on a CPU in the real world.

I mounted the protoboard with battery to the motor driven turntable I built last year to test the Scary-Go-Round controller. When spinning, the LED lights for exactly 1/2 revolution in response to the earths magnetic field.

What about the strong magnets in near by motors you ask? Keep in mind the whole robot is spinning. The motors will always be fixed relative to the sensor. The motors magnetic field biases the sensors output up or down by a fixed amount. The sinewave produced by rotation in the earths field will be superimposed on the fixed bias. Since the comparator is AC coupled and responds only to changing fields, the fixed DC bias will have no effect on the output. The only changing magnetic fields inside the bot will be from high currents in wires being switched on and off to run the motors. Hopefully these will be weak. If not I can run all power on twisted pairs which should cancel most of the external fields. Then there's the rapidly changing currents in the motor windings - I wonder how strong those fields are?

Will the motors in the opponent robot cause problems? Since external fields will cause a shift in the apparent direction of "North" there may be some small heading shifts. I doubt this will be enough to cause problems. The operator should be able to compensate.

Will it work on steel floors some combat arenas have? I do not know at this time.


Compass wired on Radio Shack perf board

Compass circuit on Radio Shack perf board. The Hall effect sensor is the device on the 8 yellow wires near the top and center. The sensor has 8 leads on .05 inch centers. I used an piece of a Schmart board P/N 201-0001-01 to facilitate connecting it to the .1 inch grid on the perfboard.

The battery is held down with industrial strength double sided foam tape.


Compass on turntable

Compass mounted on the test turntable.

Compass spinning

Compass spinning on the turntable. LED lights only during one half revolution.

Compass Schematic

Compass schematic.

HMC 1021Z datasheet pdf file






Previous page: Flip-O-Matic
Next page: Gas Spring Flipper Experiment