Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Netduino and the HMC6343 Compass


  • Please log in to reply
1 reply to this topic

#1 willgeorge

willgeorge

    Member

  • Members
  • PipPip
  • 25 posts

Posted 29 January 2012 - 03:15 PM

Another demo Windows Form from me... This project uses the HMC6343 Tilt compensated compass.
I got mine at http://www.sparkfun.com/products/8656

CREDITS:
My code started with the HMC6343 driver code I found in here.
The driver was developed by Greg Oberfield and works very well.
See: http://forums.netdui...ch__1#entry1568
I have changed his code so it is not original. Not that there was anything wrong with it in the first place.
(I just change everything?).. Well, not really. I change things so they fit my needs/ideas.

I am also using the SerialPort (RS-232 Serial COM Port) in C# .NET by Noah Coad.
I have made the serial terminal into a Windows Form User Control that you can 'pop' onto a form.
The serial port original code has been modified to 'read' the command structure sent by the Netduino application.

http://msmvps.com/bl...2300_-.NET.aspx

The Form App has a User Control that will display the compass headings along with Pitch and Roll.

Be warned! I am NOT( in any way) an expert about the HMC6343.
In fact I know little about some of the setting that can be used.
As in the proper way to use the Variation Angle, Hard-Iron Calibration Offsets and IIRF filters.

That said, My application is very 'busy' with controls because I have tried to implement reading and writing
all of compass EEProm registers. NOTE: The application will NOT write to the EEProm without the user
sending the write to register commands by clicking the serial terminal SEND button.

I have read and written to my compass EEProm many times without any issues.
However, I cannot be responsible for any damage to your compass.
(As far as I know there is no way to 'factory reset' the compass by the end user.)

If we have an EXPERT out there I sure would like to know more about using the Variation, Hard Iron and filters.

I can write values to change the registers but I have no idea what I am doing. (NOT a math wizzard here).
If the math does not include the 'rules memorized' during school, I'm lost!

The code is written using an XBee serial device at the Netduino.
If you use a different serial device for your Netduino you will need to modify your serial device
code to use and return the commands sent and received by the windows form.
Reading and writing the commands are specific to my code and must have
the correct structure or it will not work.

Update: I have added a non-XBee Netduino application that uses the Netduino serial port pins D0 and D1.
The serial port driver IS NOT A COMPLETE SERIAL PORT TERMINAL PROGRAM.
The code was made for reading and writing unique command strings between the Netduino and
the FormCompassHMC6343_Netduino application.

There is a minor error in the original FormCompassHMC6343_Netduino application. Nothing serious but
I have replaced the zip with corrected code. The error was that a command was sent twice. Caused no
harm but I still wanted to correct the issue.

**************************************************************************************************************************

I have Revised and Updated the applications to include using all of the HMC6343 functions/registers

Items like User Calibration, Magnetometer Offsets, setting the IIR Filter value, Run modes and clearing the Magnetometer registers.
I 'think' I got everything?...

Seems that nobody uses the compass but I will share my code anyway. There is no copyright on any portion of my code. Use as you want to.

I have to state again that I am far from being an expert on this device. My code is based on what I 'think' is correct usage and probably NOT what the manufacturer intended.

HAVE FUN!

Attached Files



#2 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 29 January 2012 - 05:00 PM

Very nice job! The only problem is the cost of the sensor...I'd like to play with, but it's awful expensive! Anyway I'll keep this thread as interesting. Thank you very much for sharing. Cheers
Biggest fault of Netduino? It runs by electricity.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.