TelephoneBill
Well-known member
I bought a couple of magnetometer boards from eBay recently and today attempted to get them working with a Teensy 3.1. These came from China and claimed to be HMC5883L. They also have a marking "GY-273". Though not the supplier I used, here is a typical eBay advert (https://www.ebay.co.uk/itm/GY-273-H...032112?hash=item43fa699470:g:A8AAAOSw409ZyMuQ).
When some sample magnetometer code from the forum was tried, they failed to respond to I2C address = "0x1E". Some web research suggested they may be using an alternative chip called QMC5883L (https://github.com/e-Gizmo/QMC5883L-GY-271-Compass-module/blob/master/QMC5883L Datasheet 1.0 .pdf), and sure enough both boards would respond to I2C address "0x0D" (which the QMC5883L datasheet quoted). Apparently they are made under licence from Honeywell - so the data sheet claims. Note the eBay advert has markings "DA 5883 6014", which also accords with the QMC5883L data sheet. My boards have this marking style of "DB 5883 7006".
Despite many attempts all afternoon, I just could not get any sensible values to print for x,y,z. I did get some values, but they did not change correctly with board orientation.
(Question 1) Has anyone been able to get reasonable magnetometer data out of this type of board?
I also noted that when reading the data registers, they have different internal register numbering to the Honeywell HMC5883L datasheet. These QMC5883 chips start at Register "0x00" through to "0x05", which is different to the Honeywell (which starts at register address "0x03"). Also, the teensy code example reads x then z then y, but this data sheet goes x then y then z.
(Question 2) To write and read the registers, the data sheet suggests that the I2C 7 bit address is shifted one bit to the left and then the least sig bit is then set either "0" for write and "1" for read. Does the "Wire.h" automatically adjust the signal output on I2C to cater for this read/write method of addressing? (I am not that familiar with I2C protocol). Or does the user have to change the code address from "0x1A" to "0x1B" ("0x0D" shifted left with lsb 0 or 1)?
It may well be that these chips are failed devices and that is why they are not responding. But the I2C signals on the data line look sensible, so my 5K pullup resistors are working well. The Vcc I am using is from the 3v3 supply on a T3.1 board.
When some sample magnetometer code from the forum was tried, they failed to respond to I2C address = "0x1E". Some web research suggested they may be using an alternative chip called QMC5883L (https://github.com/e-Gizmo/QMC5883L-GY-271-Compass-module/blob/master/QMC5883L Datasheet 1.0 .pdf), and sure enough both boards would respond to I2C address "0x0D" (which the QMC5883L datasheet quoted). Apparently they are made under licence from Honeywell - so the data sheet claims. Note the eBay advert has markings "DA 5883 6014", which also accords with the QMC5883L data sheet. My boards have this marking style of "DB 5883 7006".
Despite many attempts all afternoon, I just could not get any sensible values to print for x,y,z. I did get some values, but they did not change correctly with board orientation.
(Question 1) Has anyone been able to get reasonable magnetometer data out of this type of board?
I also noted that when reading the data registers, they have different internal register numbering to the Honeywell HMC5883L datasheet. These QMC5883 chips start at Register "0x00" through to "0x05", which is different to the Honeywell (which starts at register address "0x03"). Also, the teensy code example reads x then z then y, but this data sheet goes x then y then z.
(Question 2) To write and read the registers, the data sheet suggests that the I2C 7 bit address is shifted one bit to the left and then the least sig bit is then set either "0" for write and "1" for read. Does the "Wire.h" automatically adjust the signal output on I2C to cater for this read/write method of addressing? (I am not that familiar with I2C protocol). Or does the user have to change the code address from "0x1A" to "0x1B" ("0x0D" shifted left with lsb 0 or 1)?
It may well be that these chips are failed devices and that is why they are not responding. But the I2C signals on the data line look sensible, so my 5K pullup resistors are working well. The Vcc I am using is from the 3v3 supply on a T3.1 board.