Forum >Bluno M3 v2.1 With HMC5883l Compass
Bluno M3 v2.1 With HMC5883l Compass

Hello,
I am trying to get the HMC5883L compass to work with my new Bluno M3 v2.1 - The code is quite simple, but I am getting garbage for readings
In setup
Wire.beginTransmission(0x1E);
Wire.write((byte)0x02); // set to continuous mode
Wire.write((byte)0x00);
Wire.endTransmission();
Then to read the 6 bytes in loop (with a delay)
Wire.requestFrom(0x1E,6);
if(6<=Wire.available()){
x = ((int16_t)Wire.read()<<8) | Wire.read();
z = ((int16_t)Wire.read()<<8) | Wire.read();
y = ((int16_t)Wire.read()<<8) | Wire.read();
}
I suspect the MSB/LSB logic may be different for this microcontroller?
Has anyone tried this with success?
Thanks a lot!
Tom
I am trying to get the HMC5883L compass to work with my new Bluno M3 v2.1 - The code is quite simple, but I am getting garbage for readings
In setup
Wire.beginTransmission(0x1E);
Wire.write((byte)0x02); // set to continuous mode
Wire.write((byte)0x00);
Wire.endTransmission();
Then to read the 6 bytes in loop (with a delay)
Wire.requestFrom(0x1E,6);
if(6<=Wire.available()){
x = ((int16_t)Wire.read()<<8) | Wire.read();
z = ((int16_t)Wire.read()<<8) | Wire.read();
y = ((int16_t)Wire.read()<<8) | Wire.read();
}
I suspect the MSB/LSB logic may be different for this microcontroller?
Has anyone tried this with success?
Thanks a lot!
Tom
2016-06-07 02:19:03 Hi tomch,
Sorry for my late reply.
i tested Bluno M3 with a LCD screen (IIC), failed as you said. It works well with UNO. You could go to https://www.dfrobot.com/index.php?route= ... urn/insert for return.
Leff
Sorry for my late reply.
i tested Bluno M3 with a LCD screen (IIC), failed as you said. It works well with UNO. You could go to https://www.dfrobot.com/index.php?route= ... urn/insert for return.

2016-06-06 10:48:36 Hi Leff - I got this working. The example code for I2C had enough to get me going - thanks
tomch

2016-06-02 20:23:34 Ok, got it, I seldom use compass sensor, I will get one or a similar 3-axis IIC sensor to try with Bluno M3.
Leff

2016-06-02 05:25:54 One other note, I am using the IDE for Bluno M3 and the Bluno M3 driver
Tom
tomch
Tom

2016-06-02 05:16:03 Hi Leff,
Thanks for the reply. Yes, I have tried the hmc5883l on another board, it works fine with my romeo v2.
Tom
tomch
Thanks for the reply. Yes, I have tried the hmc5883l on another board, it works fine with my romeo v2.
Tom

2016-06-01 22:30:25 Hi tomch,
Have you tried to use HMC5883L with other Arduino board, like Uno?
If its no problem, then it should be no problem with Bluno M3 as long as you compilethe code with the special Arduino IDE 1.5.5 which is customized by DFRobot team.
Sorry I dont have this module at hand, or I could give it a try.
Leff
Have you tried to use HMC5883L with other Arduino board, like Uno?
If its no problem, then it should be no problem with Bluno M3 as long as you compilethe code with the special Arduino IDE 1.5.5 which is customized by DFRobot team.
Sorry I dont have this module at hand, or I could give it a try.
