Author Topic: HMC5883L Compass and WLS question?  (Read 1485 times)

0 Members and 1 Guest are viewing this topic.

Offline Hero ITopic starter

  • Jr. Member
  • **
  • Posts: 31
  • Helpful? 0
HMC5883L Compass and WLS question?
« on: October 25, 2014, 08:00:33 PM »
I purchased the Triple-axis Magnetometer (Compass) Board - HMC5883L from Adafruit.

In Webbotlib Studio, do I use "Devices->Compass->HMC5883L Magnetometer"?

In the "New I2C Master Bus Window" I select "HMC5883L Magnetometer" and press add.

In the "Add" window, the only "Address" available in the pull down is 0x3C, but the address of my module is 0x1E.

Is Webbotlib Studio wrong or am I not understanding something in regards to the address?

For my compass, do I toggle on the "Device has on-board pull ups" check box?

If so, then what do I put for "Resistance" and "IO min/maxV"?
« Last Edit: October 25, 2014, 08:02:46 PM by Hero I »

Offline Hero ITopic starter

  • Jr. Member
  • **
  • Posts: 31
  • Helpful? 0
Re: HMC5883L Compass and WLS question?
« Reply #1 on: October 29, 2014, 08:48:56 AM »
Solved.

I used "Devices->Compass->HMC5883L Magnetometer".

I also found that the Adafruit "Triple-axis Magnetometer (Compass) Board - HMC5883L" has 10K pull ups.

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
Re: HMC5883L Compass and WLS question?
« Reply #2 on: November 04, 2014, 05:51:38 PM »
Couple of points here.

I2C addresses are a pain ! They are 7 bit numbers - but in some data sheets they are given as 8 bit numbers but in others are given as 7 bit numbers. Aargh.
The 8 bit number is the same as the 7 bit number x  2.
WebbotLib uses the 8 bit number variant (doesn't matter which I choose as I'll be wrong 50% of the time)!
Even worse then some datasheets give an number but don't say if its 7 or 8 bit.
Converting 7 bit to 8 bit means multiplying it by 2.


ie your datasheet says 0x1E - which multiplied by 2 is 0x3C. Your datasheet gives the 7 bit address.

No easy way around this as there seems to be no standard when quoting i2C addresses.


Next - pullups/IO minV/maxV
I2C uses an open-collector set up. ie you can drive the line low (Gnd) but you can't make it high - you can only go 'open circuit' and hence need pullup resistors to take the line up to the required voltage. The benefit of this is that the cpu and the i2c slave device can be working at different voltages. The IOmin/maxV should be quoted in the datasheet of the underlying chip (HMC5883L) rather than the breakout board. WLS uses its values to  work out if you have a voltage problem  eg what if you have 1 slave with pullups to 5v and another with pullups to 3v3 (as its a 3.3v chip) - the sum of these pullups will probably blow the 3v3 device depending on its IOmaxV.

WLS tries to help by not only showing the basic chip (ie HMC5883L) but also various breakout boards based on this chip (where the decision about IOmax/min and whether the breakout has pullups has been defined for you). Obviously its hard for me to keep up with every breakout board from every supplier based on the same chip - and thats why WLS allows anyone with  a website to publish their own break out boards  (among other stuff).



Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline Hero ITopic starter

  • Jr. Member
  • **
  • Posts: 31
  • Helpful? 0
Re: HMC5883L Compass and WLS question?
« Reply #3 on: November 06, 2014, 05:31:18 PM »
Thanks for the info.

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
Re: HMC5883L Compass and WLS question?
« Reply #4 on: November 08, 2014, 07:43:48 PM »
Have added the Adafruit break out board into Version 1-15
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

 


Get Your Ad Here