CPro Magnetometer Data

I can't make sense of the data coming from the magnetometer off the C Pro board:

 1) In theory, if you hold the board one direction then flip it and turn it 180 degrees, you should get the inverse magnetometer vector as you had in the starting position. This is not the case. It actually seems impossible to even get the y or z axis to even produce positive numbers.

 2) the numbers seem very small, I know almost any algorithm is going to require them to be normalized first, but most magnetometers produce much larger numbers and these low ones are suspicious.

From working with other magnetometers, my guess is an error made in firmware when converting unsigned integer data off the magnetometer to a signed floating point number. But that is just a guess...

Comments

  • I forgot to mention that I was using the iOS API to access this data.
  • I was noticing the same thing when I just started looking at the mag data last night. My first thought is that the firmware doesn't perform any "soft iron" or "hard iron" corrections due to metal and magnetic components on the board that may be distorting the output. 
  • hey klangdon, 
    Have you managed to get any useful data from the magnetometer yet?
  • I have not played with it any further. It sounds like new firmware will be released in next few weeks to address other issues with listening to all 9 axis of data at the same time. I am hoping that this will also be addressed in that release.
  • That's my hope too. Every other device I've worked with automatically performs corrections to account for metallic/magnetic components on the board. And these distortions seem to be pretty dramatic. I'm guessing the large coin cell battery is the main culprit. I tried correcting it myself. I succeeded in reshaping the distored & shifted ellipsoidial samples into a nice sphere centered around the origin. Unfortunately, I think i somehow introduced a rotation into the results, because my axes alignment is now off.
  • You got a lot further than I did. I have some other boards with battery just as close and still get better data. So I assumed it was a conversion issue.

    I doubt that the magnetometer axis' are aligned with accel/gyro. They rarely are even when on the same module. So it might not be math issue and instead just need rotation to account for hardware alignment.
  • IMPORTANT UPDATE:

    We've isolated this issue to the magnetization of the CR2032 battery.

    The Panasonic batteries can magnetize and therefore skew the results of the magnetometer.

    There are two ways to resolve this:
    1) Use a demagnetizer on your coin cell battery:
    2) Use a non-magnetic coin cell (supposedly the stainless steel encased cr2032s cannot magnetize):

    Thanks,
    -Laura
  • Do you know a particular brand that has a stainless steel case? I'm currently using energizer batteries and have the same problem. The bigger problem I see is that every battery has a different iron content, so even without the magnitization problem the iron will still distort the readings. It seems that the API needs to have a calibration feature to handle these situations. After all, you can't really expect the end users to be demagnitizing their batteries.
  • Tried to demagnetize several cells (Varta, Duracell, Panasonic) with this demagnetizer which I believe is the same unit as the MSC model: 


    Purchased a Panasonic CR2032 which have the stainless steel case:

    In each case the Magnetometer readings are complely overpowered by the proximity of the cell battery, which is apx 100x stronger. The Pana had the lowest interference numbers, but trying to further demagnetize one had the opposite effect, imparting a much stronger field.
    The ambient magentic field is undetectable through the local field induced by the battery. 

    Best result, least interference, Panasonic:

    X, Y, Z axis (raw multiplied by 10,000)
    N  +0.10, -0.35, +0.35
    E - 0.06, -0.13, +0.22
    S +0.10, -0.10, +0.24
    W +0.11, -0.20, +0.35

    Rotating the cell 90 degrees in the holder results in an entirely different set of data. 
    Demagnetization appears to have reduced the overall magnitude by less than 50%. 
    Still too much interference to try and mathematically compensate for the local field and imply the ambient planetary field via calibration to known magnetic North.

    It appears the only way to make use of this sensor is to replace the coin cell battery with a remote LiPo battery.
  • I'm getting the same feeling. It actually wouldn't be terrible if the magnetic charge remained constant, but it doesn't. At least then I could apply a calibration to mostly negate the effect. But ive seen the mag charge change dramatically in less than a minute once the coin cell starts discharging
  • Hi everyone,

    To address this issue we are doing two things:

    1) Updating the RPRO to include a magnetometer (MetaWear V2.0 will release later this year).
    2) Sourcing batteries that are demagnetized which we will make available on our store ASAP.

    Thanks,
    -Laura
  • Thanks Laura, that's excellent!

     The Panasonic spec states it has stainless casing, the rest of the cell apparently can develop a field.

     We removed the coin cell and hooked up an external LiPo battery from the RPro. Initially the readings were poor, the PCB assembly itself had actually acquired a field itself. (The retaining bracket?) After demagnetizing the whole board, three times actually, the data stabilized and we see clear and consistent readings. 

     Coin cell removed, entire board demagnetized 3 times:
      X, Y, Z axis (raw multiplied by 10,000) 
    N  +0.00, -0.20, +0.41
    E +0.16, -0.06, +0.41
    S +0.33, -0.20, +0.42
    W +0.14, -0.31, +0.41
    Inverted               z -0.61

     Still some skew and a little z-axis field remaining, but this can easily be calibrated programatically.

     We may remove the cell bracket from one board as a test to confirm, which should remove most of the remaining local field, aside from proximity effects of the chip and other SMT components and fields in the connecting traces.

     Remarkably sensitive component, but with a magnetically neutral battery in a neutral board and some calibration should be able to sort out mag north. 
  • Christopher,

    Thank you for the update; please keep us updated!
  • I can also confirm that stainless steel encased batteries don't fix the problem. I demagnetized the pcb multiple times and installed a new panasonic battery. Unfortunately, shortly after beginning to discharge, the battery did develop a magnetic charge. Not nearly as bad as the energizer batteries I was using before, but it still changed over time so I couldn't correct distortion.

    I ended up going the same route as Christopher. I know the CPro doesn't have the high voltage circuitry protection, but I hooked up a 3.7v LiPo battery anyway. According to the spec sheets of the various components, 3.7v is within the operating voltage of the components. I'm finally getting usable results. I still have a small magnetic distortion (residual pcb charge?) that seems to be constant so I was able to calibrate the output values to account for the charge.
  • @Christopher

    The coin cell holder is made of nickel plated phosphor bronze and is non magnetic.  There may be ferrous material in the EMI shield on the radio module, or there may be residual polarization in the battery.

    For best results an AC type demagnetizer should be used, as these can completely remove the polarization.  As there may be ferrous material in the EMI shield, the entire sensor device should be demagnetized.  Here is an example of this type of demagnetizer: https://www.amazon.com/Farmunion-Screwdriver-Electrical-Demagnetise-Demagnetizer/dp/B016TK6LGQ/ref=sr_1_1?s=industrial&ie=UTF8&qid=1471551446&sr=1-1&keywords=watch+demagnetizer
This discussion has been closed.