I tried to utilize a compass module to adjust the direction that my Activiybot moves forward to. but the it seems that module didn't work well indoor.
And I tested the compass moudle with the example code indoor and I got the data below.
Is north in your diagram true north of magnetic north?
Either way, it's not uncommon for a compass not to align precisely with magnetic north. You just add a correction factor to your code to compensate for the difference.
Either way, it's not uncommon for a compass not to align precisely with magnetic north. You just add a correction factor to your code to compensate for the difference.
Hi Duane,
Yes, it's HMC5883L.
The north in diagram is turn north. but it has nothing to do with the true north or magnetic north.
Note the range between 0 degrees to 180 degrees. it should be a half , right ?
This is typically caused by a magnetic field that is close to the sensor. It could be in many places, just a few examples include: the compass printed circuit board, carrier board, breadboard, iron bars in a concrete foundation, and metal reinforcements in your prototyping table.
Mounting the sensor 25 cm above the robot sometimes helps, but not always. Another technique is software calibration, which can be very effective. We have a library in development that has a calibration routine and procedure. It still has some bugs though. I will try to fix the bug, and also contact you offline to find out if you are interested in testing it.
Hi Duane,
Yes, it's HMC5883L.
The north in diagram is turn north. but it has nothing to do with the true north or magnetic north.
Note the range between 0 degrees to 180 degrees. it should be a half , right ?
That is an odd data set for a compass, far outside what would be expected for magnetic declination. I would take the 'bot outside, move the module as far away the chassis as possible and recheck the output.
That is an odd data set for a compass, far outside what would be expected for magnetic declination. I would take the 'bot outside, move the module as far away the chassis as possible and recheck the output.
Amanda
I got the odd data both in the office and at home, in order to make a comparision , I run the compass app , I find it's also odd. then I took my cellphone outside, and the data became normal. I wonder whether the compass module can work normally indoors.
Hi Duane,
Yes, it's HMC5883L.
The north in diagram is turn north. but it has nothing to do with the true north or magnetic north.
Note the range between 0 degrees to 180 degrees. it should be a half , right ?
Sorry, I didn't look closely at the numbers. You're right it sure looks strange.
To go with what Andy said, have you looked at the magnitude of the raw vector? It should tell you if the magnetic field is stronger than normal and how strong it is.
It might also be a good idea to display how far from horizontal the magnetic field is.
I've recently been playing with the HMC5883L (in Spin) and I used the ATan2 method in F32 to compute this angle. I first found the length of the xy vector and then used "theta := F32.ATan2(zVector, xyVector)" to figure out how far from horizontal the field was. Up here in Idaho I'm getting about -53.6 degrees from horizontal.
I think by monitoring both the strength of the field and the direction (including vertical component) you could get a better idea when there's an interference source nearby.
Comments
Either way, it's not uncommon for a compass not to align precisely with magnetic north. You just add a correction factor to your code to compensate for the difference.
Which compass module are you using? The HMC5883L?
+1. See http://en.wikipedia.org/wiki/Magnetic_declination
That drawing looks a LOT like yours.
Yes, it's HMC5883L.
The north in diagram is turn north. but it has nothing to do with the true north or magnetic north.
Note the range between 0 degrees to 180 degrees. it should be a half , right ?
This is typically caused by a magnetic field that is close to the sensor. It could be in many places, just a few examples include: the compass printed circuit board, carrier board, breadboard, iron bars in a concrete foundation, and metal reinforcements in your prototyping table.
Mounting the sensor 25 cm above the robot sometimes helps, but not always. Another technique is software calibration, which can be very effective. We have a library in development that has a calibration routine and procedure. It still has some bugs though. I will try to fix the bug, and also contact you offline to find out if you are interested in testing it.
Andy
That is an odd data set for a compass, far outside what would be expected for magnetic declination. I would take the 'bot outside, move the module as far away the chassis as possible and recheck the output.
Amanda
I got the odd data both in the office and at home, in order to make a comparision , I run the compass app , I find it's also odd. then I took my cellphone outside, and the data became normal. I wonder whether the compass module can work normally indoors.
Jarvan
Sorry, I didn't look closely at the numbers. You're right it sure looks strange.
To go with what Andy said, have you looked at the magnitude of the raw vector? It should tell you if the magnetic field is stronger than normal and how strong it is.
It might also be a good idea to display how far from horizontal the magnetic field is.
I've recently been playing with the HMC5883L (in Spin) and I used the ATan2 method in F32 to compute this angle. I first found the length of the xy vector and then used "theta := F32.ATan2(zVector, xyVector)" to figure out how far from horizontal the field was. Up here in Idaho I'm getting about -53.6 degrees from horizontal.
I think by monitoring both the strength of the field and the direction (including vertical component) you could get a better idea when there's an interference source nearby.
http://www.parallax.com/sites/default/files/downloads/29133-Compass-Module-Application-Note-2.pdf
Andy
P.S. After correcting for interference, a constant value can also be added to the heading align it with either magnetic or true north.
On closer inspection of your plot from post #1, well, that's some pretty significant field distortion.
Could you please post the code you used gather the data for your plot in post #1?
Also, if you are using a mechanical compass as a reference, are you keeping it well away from the bot when you take your test measurements?
Thanks, Andy