HMC5843 Magnetometer, intermittent false values

Post Reply
User avatar
Rudi48
Posts: 32
Joined: Mon Sep 19, 2011 10:44 am
Location: Wiesbaden, Germany
Contact:

HMC5843 Magnetometer, intermittent false values

Post by Rudi48 »

Hello,
I am using a Sparkfun HMC5843 break out board with software MultiWii_dev_20110928, but the problem happens also in version MultiWii_1_8_patch2. In principle the Magnetometer works, also the calibration. VCC ist 2.5V from the ELV BMA020 board.
The problem is, that intermittent about every 10-30 seconds a false value is shown, please see the attached image. That happens while the quadrocopter is on the table.

Has anybody an idea what that can be?
Is there a possibility to log the raw data values of the magnetometer?

Best regards, Rudolf
Attachments
HMC5843_MultiWiiConf_spike.png

mr.rc-cam
Posts: 457
Joined: Wed Jul 27, 2011 11:36 pm

Re: HMC5843 Magnetometer, intermittent false values

Post by mr.rc-cam »

VCC ist 2.5V from the ELV BMA020 board.

It looks like ELV's board has LLC interface on it to ensure the I2C SDA and SDC logic levels are correct for 2.5V operation. That said, is there a chance you are mixing the 2.5V powered MAG chip with 3.3V or 5V I2C signals?

User avatar
Rudi48
Posts: 32
Joined: Mon Sep 19, 2011 10:44 am
Location: Wiesbaden, Germany
Contact:

Re: HMC5843 Magnetometer, intermittent false values

Post by Rudi48 »

Hello mr.rc-cam,

Thank you for taking care about my problem.
I have already thought about voltage mixing, but the BMA020 is running with 2.5V and on the other side of the LLC is 5V only.
I had the hope, that some one else has already seen such an effect.

Then I have to go to plan B, debugging myself.
Therefore I had the question how to log the raw I2C data from the HMC5843, in order to figure out, what data are really send.
I searched already the forum for a logging function, but found only a limited feature for a LCD.

What I have still not understood is, how to change the "config" program (compile and link, libraries).
Then I have a chance to add a logging feature.
I am running mainly MAC OS X, but I can work also with Win32 and Ubuntu.
Any help is really appreciated. :)

Best regards, Rudolf

mr.rc-cam
Posts: 457
Joined: Wed Jul 27, 2011 11:36 pm

Re: HMC5843 Magnetometer, intermittent false values

Post by mr.rc-cam »

I have already thought about voltage mixing, but the BMA020 is running with 2.5V and on the other side of the LLC is 5V only.

What I mean is that since your MAG sensor is 2.5V powered, it must be connected to the LLC's 2.5V I2C signal side (not directly to the typical external 3.3V or 5V I2C signals).

I had the hope, that some one else has already seen such an effect.

I'm using a HMC5883 mag chip and it has never done it on GUI V1.8 - V1.8p2. But my ITG3000 gyro will have a random data corruption on all axis (2-5 times per minute).

User avatar
Rudi48
Posts: 32
Joined: Mon Sep 19, 2011 10:44 am
Location: Wiesbaden, Germany
Contact:

Re: HMC5843 Magnetometer, intermittent false values

Post by Rudi48 »

Hello,

I have investigated further and found the following:
1. The I2C bus looks good showing on a scope, see hardcopy picture.

2. I added a routine in serial.pde to output the raw MAG values in hex.

Code: Select all

void itoh(unsigned int n) {
  int digit;
  const char *hex = "0123456789abcdef";

  if ((digit = n / 16) != 0)
    itoh(digit);        // recursive call
   serialize8(hex[n % 16]);
 }
 
void serialCom() {
  int16_t a;
  uint8_t i;

  uint16_t intPowerMeterSum, intPowerTrigger1;   

  // 2011-10-10 RR, show Mag raw data
  if(MAG && !tx_busy) { 
      point=0;
      itoh(magADC[ROLL]);  serialize8(' ');
      itoh(magADC[PITCH]); serialize8(' ');
      itoh(magADC[YAW]);
      serialize8(0x0d); // carriage return
      serialize8(0x0a); // line feed
      UartSendData();
  }


Then I found in the Serial Monitor Window:

Code: Select all

ffd6 ff7b 194
ffd6 ff7b 194
ffcc ff7e 3fdb
ffcc ff7e 3fdb
ffcc ff7e 3fdb
ffcc ff7e 3fdb
ffcc ff7e 3fdb
ffcc ff7e 19f
ffcc ff7e 19f
and
ff9b ff97 1b0
ff9b ff97 1b0
ff4b 5d88 a23d
ff4b 5d88 a23d
ff4b 5d88 a23d
ff4b 5d88 a23d
ff4b 5d88 a23d
ffa8 ff90 1a7
ffa8 ff90 1a7
and
ffb7 ff93 1a9
ffb7 ff93 1a9
ffaa 1e ba7
ffaa 1e ba7
ffaa 1e ba7
ffaa 1e ba7
ffaa 1e ba7
ffaa ff91 1ad
ffaa ff91 1ad

What looks surprising to me, there is always a block of 5 consecutive wrong values.

That looks too systematic for me, to believe in a random disturbance.
I will have a closer look to that.

Regards, Rudolf
Attachments
I2C bus after LLC 2.5V
I2C bus after LLC 2.5V

User avatar
Rudi48
Posts: 32
Joined: Mon Sep 19, 2011 10:44 am
Location: Wiesbaden, Germany
Contact:

Re: HMC5843 Magnetometer, intermittent false values

Post by Rudi48 »

Hello,
The problem is solved :)

I replaced the HMC5843 Break Out Board with a new HMC5883 Break Out Board.

Now, after 5 minutes use, I have no longer seen a glitch.

Unfortunately the new HMC5883 Break Out Board is larger in size and the magnetic orientation is 180 degree turned,
if you use the same old plug to the shield board.

In the software config.h I had to change the orientation:

Code: Select all

//#define MAG_ORIENTATION(X, Y, Z)  {magADC[ROLL]  = X; magADC[PITCH]  = Y; magADC[YAW]  = Z;}
#define MAG_ORIENTATION(X, Y, Z)  {magADC[ROLL]  = -Y; magADC[PITCH]  = X; magADC[YAW]  = Z;}


Regards, Rudolf

Post Reply