[SOLVED] HMC5883L not connecting via I2C
« on: July 11, 2018, 10:08:52 pm »
Hello,

I have connected an external HMC5883L (for Arduino) to my Revolution board via I2C -> Flexi.
Wiring is as it should be and voltage readings are VCC 5+, SCL 3.3 and SCA 3.3 Volts on the magnetometer side.
(This board can be powered up to 5 Volts)

But the magnetometer tab says "AuxMag" not found.

I used the kit in the picture. This includes an UbloxNeo-M8N GPS (which works/tested via the main port and the I2C port).

Homelocation is set.
I (re) calibrated all sensors and did a thermal calibration over 20 degrees Celsius.

I erased and installed the firmware again.
I start up with battery plugged in and then connect via USB.

I swapped SCL and SCA to no avail.

Internal mag and external GPS work, but the external mag just won't show up.
System Health says there are "acknowledgement errors".

I've read on the forum that there are people using a HML5883L and it "just" works.
So I'm wondering why this one doesn't?


« Last Edit: July 13, 2018, 01:43:00 pm by Bluebird »

Re: HMC5883L not connecting via I2C
« Reply #1 on: July 12, 2018, 04:26:19 am »
I don't know what you mean by "for arduino"

Hardware page FlexiPort must be set to "I2C"
Attitude->Magnetometer aux mag (source of data) must be set to I2CPort
Also on that page set it to use AuxOnly (to completely avoid using OnBoard mag)
Like the GPS, you must have a battery plugged in for GPS/mag to be powered.

Sorry I don't remember exact titles and page doesn't show up without a board plugged in.

Then at least on System->DataObjects->AuxMagSensor (expand it) you should see x,y,z change every 10 seconds.

Re: HMC5883L not connecting via I2C
« Reply #2 on: July 12, 2018, 05:35:28 am »
Thank you, OtherCliff

I don't know what you mean by "for arduino"

There are loads of sensor gadgets available for Arduino, which also use I2C. This is one of them.
But it's just a plain HMC5883L with voltage protection up to 5V.


Hardware page FlexiPort must be set to "I2C"
Attitude->Magnetometer aux mag (source of data) must be set to I2CPort
Also on that page set it to use AuxOnly (to completely avoid using OnBoard mag)
Like the GPS, you must have a battery plugged in for GPS/mag to be powered.

All check, and I have power on the mag board, also 3.3V on SCL & SCA (too bad I don't own an oscilloscope)

Then at least on System->DataObjects->AuxMagSensor (expand it) you should see x,y,z change every 10 seconds.

There's no change whatsoever and I've let the battery in for 15 minutes.

I2C warning is red, says it's working, but has acknowledgement errors when the mag is plugged in.
When unplugging the battery, it gets a red cross and says it's not connected.
So something is working, but the communication is not right.

I have read there could be a slight difference in the HMC5883L chip, with newer versions working on higher speed?
Something like 200Hz vs 400Hz?

Btw, I'm using Librepilot 16.09 Stable.
« Last Edit: July 12, 2018, 06:45:12 am by Bluebird »

Re: HMC5883L not connecting via I2C
« Reply #3 on: July 12, 2018, 06:48:03 am »
As I looked in DataObjects/I2CStats/event_log it shows: I2C_EVENT_BUS_ERROR and under event_state: I2C_STATE_FSM_FAULT

I checked the connector to see if there's something wrong with the pins or solder joints, but all is fine...

Re: HMC5883L not connecting via I2C
« Reply #4 on: July 12, 2018, 08:34:02 am »
I connected the sensorboard to a raspberry and it is only outputting zeros.
I changed the register addresses to fit a so called "cheap clone" chip, but that's also giving zeros.

So I'm guessing it may be the chip ???

I now ordered a different sensor board form a different supplier.
It will arrive tomorrow, I hope!

Re: HMC5883L not connecting via I2C
« Reply #5 on: July 12, 2018, 09:17:20 am »
Do you have a GPS connected too?  If it's the one from your pics (likely banggood?), set the GPS Baud to 38600.    Ensure that the AuxMag type is set as Flexi (which i think you have already by the screenshot).

Lastly, check the pin assignment from your mag to the flexi port here: https://librepilot.atlassian.net/wiki/spaces/LPDOC/pages/12058679/GPS+setup?preview=/12058679/87982133/GPS_I2C.png#GPSsetup-GPS+I2C


jdl

  • ***
  • 246
Re: HMC5883L not connecting via I2C
« Reply #6 on: July 12, 2018, 10:00:41 am »
Sorry, your board seems to be a fake one, photo shows the chip marked as DA5883. This is QMC5883 chip, not HMC5883L as printed in the pcb. The market is flooded with these fakes. It will not work with 16.09 or with current next, there are significant differences between the original and clone sensors. Reports from forums also state that the clone mag (DA5883) has worse accuracy than genuine honeywell chip (L883).

http://wiki.epalsite.com/index.php?title=HMC5883L(Or_QMC5883L)_Electronic_Compass

Re: HMC5883L not connecting via I2C
« Reply #7 on: July 12, 2018, 10:07:35 am »
Do you have a GPS connected too?  If it's the one from your pics (likely banggood?), set the GPS Baud to 38600.   

I got the GPS from a retailer in the Netherlands, but it might as well be originating from Banggood ;)
It is however connected and working very well.
Auxmax is indeed Flexi.

Lastly, check the pin assignment from your mag to the flexi port here: https://librepilot.atlassian.net/wiki/spaces/LPDOC/pages/12058679/GPS+setup?preview=/12058679/87982133/GPS_I2C.png#GPSsetup-GPS+I2C

Pinout is setup correct...

Re: HMC5883L not connecting via I2C
« Reply #8 on: July 12, 2018, 10:15:53 am »
Sorry, your board seems to be a fake one, photo shows the chip marked as DA5883. This is QMC5883 chip, not HMC5883L as printed in the pcb. The market is flooded with these fakes. It will not work with 16.09 or with current next, there are significant differences between the original and clone sensors. Reports from forums also state that the clone mag (DA5883) has worse accuracy than genuine honeywell chip (L883).

I think you nailed the problem JDL!
Well, I'm expecting another type anytime, but I guess I just have to look for a genuine Honeywell then (or rewrite some code to match the cheapo chips)

I'm awaiting the replacement tomorrow, after that I think I can close this Thread.

Thank you all, guys!
Fred (aka Bluebird)

jdl

  • ***
  • 246
Re: HMC5883L not connecting via I2C
« Reply #9 on: July 12, 2018, 10:52:15 am »

Re: HMC5883L not connecting via I2C
« Reply #10 on: July 12, 2018, 12:07:37 pm »
Well thank you jdl!

It's also very nice they describe which is "the real deal".

Re: HMC5883L not connecting via I2C
« Reply #11 on: July 13, 2018, 01:35:58 pm »
Yes!

I received a HMC5893 (GY-282) board today (which according to the shop should mimic the original HMC5883).

The chip itself reads: A983
And I can confirm it is working!

So anyone considering an external mag board/chip, see the link posted by jdl:

https://www.ebay.com/itm/HMC5883L-GY-271-GY-273-Triple-Axis-Compass-Magnetomet-Sensor-3V-5V-for-Arduino/112527675935?ssPageName=STRK%3AMEBIDX%3AIT&var=412914931164&_trksid=p2057872.m2749.l2649


Or search for the A983 / HMC5893
Thanks guys, this topic is solved.
« Last Edit: July 13, 2018, 01:44:52 pm by Bluebird »