HMC6352 Compass with I2C interface

Tips, Tricks and methods for programming, learn ways of making your programming life easier, and share your knowledge with others.

Moderators: Benj, Mods

Post Reply
Harry Tuttle
Posts: 27
Joined: Sat Aug 01, 2009 3:15 pm
Has thanked: 2 times
Been thanked: 10 times
Contact:

HMC6352 Compass with I2C interface

Post by Harry Tuttle »

HMC6352 Compass with I2C interface

Lost your direction? Why not try out the Honeywell HMC6352 Compass Module?

You can buy the HMC6352 ready mounted on a Sparkfun breakout board, all you have to do is solder on header pins or wires and connect the usual I2C pullup resistors (Pin outs are the same as the blinkM in my previous post)
The module returns the heading in tenths of a degree, 0 to 3599 in two bytes.

See data sheet for full details:
http://www.magneticsensors.com/datasheets/HMC6352.pdf

The programme is as simple as possible and is intended as a beginners starting point:
Main sets up the LCD on PORT A, the I2C interface and sets the address variables of the HMC6352 .
Then a loop is started to read the heading , combine the two bytes and then display the formatted result on the LCD display.
Compass.fcf
(9 KiB) Downloaded 527 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: HMC6352 Compass with I2C interface

Post by Benj »

Thanks for that Harry,

Looks like a great project, a digital compass is something I've been wanting to have a play with for a while.

Many thanks for sharing with the forum.

Post Reply