Go Down

Topic: Looking for help with HMC5883L compass from other users (Read 24328 times) previous topic - next topic


sure. what about the 4.7uF cap? I don't seem to get any pulses there. you?


Assuming you're in continuous mode it should look like a 2v DC signal with a little bit of ripple on the signal. 


Yes, exactly what I'm getting.. now I'm seriously stuck.


I think I'll try assembling another bob .. and see what happens..


It turned out to be a bad magnetometer on the first bob.. I assembled other 4 and they are just great!


Old post, new member :)

I have been trying to get one of these working for at least 2 weeks and it is almost out of the window time.

Read and noted all the references that I can find. I am using a PIC, not an Arduino ( I suppose I should admit at this stage that I don't even know what an Arduino is, it may save embarrassment later)

However, back to the HMC5883L. Much tearing of hair and emails later not only is the data sheet wrong in the respects mentioned in this thread it is also wrong in a few other places, some solved, some not. Attached is a comparison PDF between this chip and it's predecessor. Some things mentioned in that not mentioned anywhere and also some things in that which are just incomprehensible and some things that are wrong.

According to that PDF there is no roll back on the programme counter, sadly this is incorrect, there is a roll back but if you read 6 bytes only then you will never get another set of readings, status locks the update as the chip believes you have not read the 6 registers. Best understanding I can get of the internals of this chip is that if I read from 10 to 8 or 9 to 8 (roll back from 12 to 0) then I will get a continually changing set of results from the registers 3 to 8. If I read form 11 to 8 the registers stay locked.

This I can cope with though it does mean I cannot run the chip as fast as I would like because of the I2C times.

My main problem is that if Y and Z are negative all is good, if I rotate such that either Y or Z go positive (that is as far as I can tell) then the I2C internals of the chip crash and I have to power cycle the chip to get it working again.

My I2C routines are years old and have been used for lots of devices before, even so I completely rewrote them and the chip behaves the same way. I cannot think that my routines have problems because no matter what sort of cock up I have made in the routines if I send a series of I2CStop then any I2C device that is correct will wake up again, that is written in the I2C spec.

I have to add that as far as I am concerned this chip and associated datasheet are the worst example I have ever seen in my life. Who would think that getting a chip working, with all the available information, would involve what can only be described as "Hacking" with so much suck it and see involved.

Anyway, any suggestions as to what is doing this? Checked the waveforms as described in here for the capacitors, all is good. I have bit analysed the streams with the scope (at least 5 years wear and tear on the eyes doing that) and can find no NOT-ACK examples, have incorporated clock stretching and as far as I can work out everything that the I2C should have ( I am using assembler here not a high level language).

Truly stuck and about to go searching for an alternative, sadly there don't seem to be any that I can find. Anyone any suggestions on that front?

I'll stop waffling now and wait to see if anyone can be bothered to read this drivel.


Here is the new datasheet for the HMC5883l. I wish it sorted my problems out but maybe it will sort yours.


@Mjolinor there is consensus that Honeywell made some mistake in the first releases of this chip.. same chips reported to behave differently, have swapped axis, etc.. what do your chips have marked on them?


They have "L883 2105" marked on them. Register order is supposed to be XXZZYY though how you know I have no idea. Because it has a circular programme counter that seems to reset in a weird way,(it seems to be 8 to 3 but only if you have read 10 to 2 first) then it could be ZZYYXX or YYXXZZ, certainly my third set of value are vertical with the chip flat, ie if I bring a magnet down on the chip from above or up on the chip from below it is my third set of values that change.

I can cope with all that having worked out what I need but the I2C crashing when the field rolls form -ve to +ve in the "Y" direction is a real killer.



is this issue you are experiencing with just 1 unit or multiple?


I have 2, both same date code but both behaving in exactly the same way.

Are there any other manufacturers making a similar thing?


I just made 6 more of these boards and again 1 one of them has an address of 0x1C, four of them have the address of 0x1E and one does not even power up.  Initially from what I can see, a couple of them have only two axis' working and one of them is in some real high gain mode where I don't get any readings until a bring a magnet close.  I'm wondering if these IC's are a bit more sensitive to the reflow process.  I'm going to try and dial down my oven or mount them using my hot air rework station to see if there is a difference.


@wayneft I would agree that there is something strange happening with this chip.. I'm also getting some strange values out of some of them, while some other just work fine.


Do none of you have problems with it crashing when the Y ( or maybe Z) axis goes +ve. Could it be because the axis never goes positive?

Can someone try forcing all the axis +ve and see if it still works?

Honeywell do not seem to be able to even understand the problem I am having. I have ordered some more but they will be ages getting here (UK).


Do none of you have problems with it crashing when the Y ( or maybe Z) axis goes +ve.

I'm not exactly sure I understand what you're saying here.  If you want give me a step by step of what you want checked and I'll be more than happy to repeat it to see what results I get.

Just an FYI but doing a little more fiddling around I'm really starting to believe these chips are very sensitive to temperature.  The first thing I did was dial down the temp on my reflow oven to the minimum temp from the paste manufacturer and reflowed one board.  The X and Y axis worked fine at the default settings but Z maxed out at -4096 but was responsive when I moved a magnet to the device. 

Next, I took a working board that I wanted to remove the cap from and swap it with another to see if ESR was playing a role.  I used my hot air rework to swap the caps and everything worked fine, then I swapped them back and it knocked out the Y axis. 

I then took the board where the Z axis was not working and removed the IC with hot air and dialled the air temp to 250 C on my rework station and mounted another IC and it worked fine.  I'm going to try and assemble 5 more boards using the rework station instead of my oven and see how many I get to work. 

Go Up