Magnetometer HMC 5883L measuring
sirokyj
Posts: 1
in Accessories
Hello!
Im using HMC5883L magnetometer to measure earth magnetic field. First calibrated measures are weird. The thing is that in one moment the sensor starts to give very different results. Bellow i gave a example. The values are raw and noncalibrated but the calibration changes it just a little. They are taken in 0.5 second interval in for loop, nothing like interupt or other processes arent processed during measurement. Do anyone experience with this behaviour? Is there some setting i missed or what can cause this changes at the output?
Thank you.
j.
168,0 -94,0 118,0 *
168,0 -94,0 118,0 *
168,0 -94,0 118,0 *
168,0 -94,0 118,0 *
168,0 -94,0 118,0 *
168,0 -94,0 118,0 *
168,0 -94,0 118,0 *
168,0 -94,0 118,0 *
168,0 -94,0 118,0 *
168,0 -94,0 118,0 *
1002,0 -559,0 701,0 *
1002,0 -561,0 698,0 *
1000,0 -560,0 698,0 *
1002,0 -563,0 700,0 *
1002,0 -563,0 700,0 *
998,0 -558,0 702,0 *
999,0 -559,0 702,0 *
Im using HMC5883L magnetometer to measure earth magnetic field. First calibrated measures are weird. The thing is that in one moment the sensor starts to give very different results. Bellow i gave a example. The values are raw and noncalibrated but the calibration changes it just a little. They are taken in 0.5 second interval in for loop, nothing like interupt or other processes arent processed during measurement. Do anyone experience with this behaviour? Is there some setting i missed or what can cause this changes at the output?
Thank you.
j.
168,0 -94,0 118,0 *
168,0 -94,0 118,0 *
168,0 -94,0 118,0 *
168,0 -94,0 118,0 *
168,0 -94,0 118,0 *
168,0 -94,0 118,0 *
168,0 -94,0 118,0 *
168,0 -94,0 118,0 *
168,0 -94,0 118,0 *
168,0 -94,0 118,0 *
1002,0 -559,0 701,0 *
1002,0 -561,0 698,0 *
1000,0 -560,0 698,0 *
1002,0 -563,0 700,0 *
1002,0 -563,0 700,0 *
998,0 -558,0 702,0 *
999,0 -559,0 702,0 *
Comments
If you load the propforth devkernel.spin and connect with a terminal program, you can paste in the driver code and play with it interactively.
https://code.google.com/p/propforth/wiki/HMC5883L
This driver is part of the GY80 driver https://code.google.com/p/propforth/wiki/GY80
The other I2C parts have more info on talking to these parts over I2C.
In my case, it just worked after I figured out writing and reading I2C, and getting the proper number of bits. Also, I discovered there are too many magnetic fields in my shop, and I had to take it out doors to detect magnetic north.
To use it on my robot I had to put it on a pole to be farther away from the motors. Still unhappy with the results.
Enjoy!
Mike