Shop OBEX P1 Docs P2 Docs Learn Events
Magnetometer HMC 5883L measuring — Parallax Forums

Magnetometer HMC 5883L measuring

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 *


Comments

  • I have a driver for that part if you are using a P8X32A board such as Prop Quickstart or Protoboard etc.

    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.
  • Yes, the chip is easy confused by nearby motors, metal, lights, power lines and such things producing or disturbing magnetic fields.

    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

Sign In or Register to comment.