PICAXE-20X2 HMC6352 Electronic Compass

A project which displays in large numbers the heading from a HMC6352 magnetic compass on a 4×20 LCD display and also outputs the direction in GS-232 format.

When operating in the CRG communication van Flossie we need to manual calibrate the 20m rotating mast which is done with a plastic collar with an arrow and a laminated heading chart around the mast, the idea being you point the antenna in a direction, get out and check the direction with a normal compass then move the collar (arrow) to the current heading.  While this works well it can be a pain to see the directions behind the mast form the operating position and more importantly it doesn’t provide any electronic output for interfacing.

I’ve made a few projects which utilise the Yaesu GS-232B rotator protocol which allows rotator software interfacing to ‘some hardware’ and brought some of my code into this.  The circuit comprises of a magneto-resistive based HMC6352 compass chip fitted to a module I purchased from Cool Components, a PICAXE-20X2 and a 4×20 blue backlit display. The HMC6352 outputs in I2C which was a bit fiddly to get the PICAXE chip to decode into an actual heading.  I got some example code off the web and started to add some extra features to it.  The compass supports a calibration mode which I added code for which is enabled with a push button on the top.  This put the unit into a 20 second calibration routine which allows enough time to rotate the mast slowly twice.  Another option I added was the ability to north offset the compass, this was to save aligning it with the antenna precisely. Once the compass is attached to the mast the user points the antenna north and presses the north button which sets the compass display to north.  It does so by saving the offset to north to a register and subtracts this value from the real heading, by applying this offset between the antenna heading and the compass heading it compensates for any difference in the antenna and compass heading which means the compass can then be installed in any direction and then corrected afterwards.  Holding the north button for 5 seconds cancels the offset.

As the compass is not in a circuit which actually rotates the mast the output is just timed to output the current heading in standard GS-232B azimuth format at a set interval, in this case it is set to output the heading every 1 second, the display updates at 2 times per second.



BXF Compass Controller InsidesBXF Compass Controller BootingBXF Compass Controller Full DataBXF Compass Controller Calibrate Routine

The reason for outputting the direction is to allow the direction to be plotted onto a map so if you are wanting to aim at a particular locator square or location then doing so with the assitance of a map is far easier and provides a good indication of the path to that location. The Ham Radio Deluxe (HRD) Rotator module is ideal as it provides a simple interface and GUI with a map showing the current heading.

Here you can see HRD Rotator running on a laptop with the current antennas direction showing on the map, if you look to the top left you can see the Compass unit showing 137 degrees also.


Leave a Reply

%d bloggers like this: