HMC5883L Simple 0-359 degree out for Prop
Seeker
Posts: 58
I have been working with the demo code and the kickstart code trying to get a simple decimal number showing the heading in degrees. I have had some luck altering the demo code to get a numeric value, but its range is way over 360 and seems to jump around in odd ways. I was wondering if anyone had written an object for this sensor (Parallax # 29133) that outputs just degree heading. The NxxE and SxxW of the demo looks cool for demo purposes, but is hard to use in a guidance system.
Part of the problem is getting my head around the math. It has been 30+ years since my last trig class... and it shows. That and my Spin skills are still growing. The platform will be leveled in real time using a gyro and tilt sensor, so I am not too worried about compensating for tilt in the math. Just looking for a reasonably accurate heading.
Anyone have something they can share?
Thanks!
Part of the problem is getting my head around the math. It has been 30+ years since my last trig class... and it shows. That and my Spin skills are still growing. The platform will be leveled in real time using a gyro and tilt sensor, so I am not too worried about compensating for tilt in the math. Just looking for a reasonably accurate heading.
Anyone have something they can share?
Thanks!
Comments
So now I am getting the data I want. Still one odd problem though. Sometimes when I first power up after letting it sit awhile, one or more of the x,y,z outputs (from demo code, not my mistaken code) is stuck at -4096 (or something like that). The only fix I have found is to remove it from the breadboard, wait, then plug it back in. This will free up the stuck digit, but then another might be stuck. A few rounds of this and it all clears up and works. A simple power cycle doesn't do it. Since this is just a testbed setup, it is not too big of a deal. I just hope that once I place it in the completed circuit it doesn't happen.
http://tymkrs.tumblr.com/post/22258810035/parallax-compass-module-3-axis-hmc5883l-29133-part