Hitachi Compass accuracy issues?
Steve Austin
Posts: 4
Hi. I got my Parallax-Hitachi compass working, and·am calibrating it according to the instructions, but wow, does it vary. Even while sitting absolutely still, it can vary up to 6 degrees in either direction.
Even if the calibration isn't spot-on, I would think it should stay fairly consistent sitting in the exact same position. I've tried it in a few positions around the room, just in case something in my PC, or a lamp, or ???? was interfering.
Has anybody else experienced a similar issue?
Thaks,
Steve
Even if the calibration isn't spot-on, I would think it should stay fairly consistent sitting in the exact same position. I've tried it in a few positions around the room, just in case something in my PC, or a lamp, or ???? was interfering.
Has anybody else experienced a similar issue?
Thaks,
Steve
Comments
Even after calibration, the compass resolution is only 6-bits (or 64 positions)... that translates to roughly 5.6 Deg of resolution. ( 360 / 64 = 5.625 )
Although the Compass documentation indicates an 11-bit resolution, I believe the 6-Bits is a result of using the ATN command within the PBASIC language.
Using a math co processor or Propeller Chip would allow you to increase the resolution because the ATN (arctangent) could be carried out with greater precision.
Reference:
www.parallax.com/Store/Sensors/CompassGPS/tabid/173/CategoryID/48/List/0/Level/a/ProductID/98/Default.aspx?SortField=ProductName%2cProductName
www.parallax.com/Store/Microcontrollers/BASICStampModules/tabid/134/txtSearch/Math/List/1/ProductID/244/Default.aspx?SortField=ProductName%2cProductName
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 2/16/2009 6:18:13 AM GMT
Thanks. That's a good point. I'll take that advice and put something else together for the atan calculation.
But I also logged the raw 11-bit X and Y coordinates, three times in each of the 8 main directions, keeping it perfectly still, and although·the X coordinate stayed within 1 or 2 of some value, the Y coordinate varied by about 8 (this was true regardless of the direction). Maybe that's just the way this thing works.
So even with a very accurate atan function, the raw X/Y input would send the values wildly off. I didn't expect perfection, of course,·but it doesn't seem very usable for robotic navigation, since it would constantly be overcorrecting to keep a reasonably straight course.
Thanks for the suggestion.
Steve
How clean is your power supply?, and what voltage are you supplying to the Hitachi Compass? .... Some amount of noise is expected in the lower LSB, you might be able to clean some of that noise up with a decoupling capacitor across the power pins of the compass.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
I'm using the Arduino for my robot, because although I love the convenience of the programming on the Stamp, the chip it uses is pretty limited in memory, and I'd really have to add an external RAM to do all I need to do. I know - why don't you guys port the Stamp code to an AVR? Say, a Mega 168 or 328? [noparse]:)[/noparse] That'd be fantastic! Ah well, if not, I'm still a loyal Parallax customer. I love what Parallax offers, especially in terms of education.
Anyway, I'll take the compass back to the BOE, and log the X/Y's over there too. And if that's still wacky, then I'll try a capacitor. What value would you recommend?
Thanks, Beau.
Steve
In most cases a .1uF or so directly across the power leads in close proximity to the Compass will be enough.· If your leads are long to the compass this will also compound any noise issues.· It is also possible that the compass can pickup·noise from the processor itself, orientation to other components as well as other forms of external noise can be as much of an issue with any compass.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
http://forums.parallax.com/showthread.php?p=759589
·
As SRLM·suggest, you can add a software filter to help smooth things out, but as you are probably aware, this will not increase your resolution.
·
I mentioned earlier, that·it is normal to have some degree of noise in the·lower LSB's... that applies to each channel.· So assuming you start out with 11 bits of resolution, and the lower 2 bits are noise you effectively have 9 bits of·accuracy.· That's per channel, when you combine the channels whether multiplying or dividing, you compound the error, so now you would have 4 bits of noise.· Thus making the 11-bits effectively only having 7-bits of accuracy.
·
For absolute best results, I would consider a heavily filtered power supply to the compass, and shielding the processor or any other circuit components susceptible to producing noise, but do not shield·the compass in any way.
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Ha! I have a thread on that too... [noparse]:)[/noparse]
http://forums.parallax.com/showthread.php?p=742053