I2C blocked when 3 sensors: HMC5883L + ADXL345 + BMP180 not working together

Hi All,

newbie question, I'm sorry :). I have bought three I2C 3.3 Volts sensors mentioned above from loveelectronics: HMC5883L (compass), ADXL345 (accellerometer), BMP180 (pressure & temperature). I have built the tilt compensated compass with their tutorial and it is working (https://www.loveelec...rduino-tutorial). Then I added the pressure temperature sensor and it is working too, alone. When I plug the three sensors all together on my Mega 2560, the I2C bus doesn't answer anymore and it stops working. Al sensors work (the HMC5883L + ADXL345 combination and alone the BMP180), but all together they don't. it is like there is a conflict on the I2C bus between two of them (clearly not between HMC5883L and ADXL345, tested, they work). The sensors are all powered by an external source with a stepdown giving 3.3 volts (500 milliampere), so it is not an issue due to the limited amount of current available on the 3.3 Volts pin available on the Mega 2560. Pull up resistors of 4.7KHom are present. I was thinking it could be an I2C sensor address collision as two could have the same address, but taking these from the libraries, it seems not except for value 0x34 (am I right ? Is that menaingful ?):

================= BPM180 =================

define BMP180_Address 0x77

define ChipIdData 0x55

define ControlInstruction_MeasureTemperature 0x2E

define ControlInstruction_MeasurePressure 0x34

define Reg_ChipId 0xD0

define Reg_Control 0xF4

define Reg_Calibrationstart 0xAA

define Reg_Calibrationend 0xBE

define Reg_AnalogConverterOutMSB 0xF6

define Reg_SoftReset 0xE0

define SoftResetInstruction 0xB6

================= HMC5883L =================

define HMC5883L_Address 0x1E

define ConfigurationRegisterA 0x00

define ConfigurationRegisterB 0x01

define ModeRegister 0x02

define DataRegisterBegin 0x03

define IdentityRegister 0x0A

define IdentityRegisterValue 0x48

define Measurement_Continuous 0x00

define Measurement_SingleShot 0x01

define Measurement_Idle 0x03

================= ADXL345 =================

define DefaultADXL345_Address 0x1D

define Register_PowerControl 0x2D

define Register_DataFormat 0x31

define Register_DataX 0x32

define Register_DataY 0x34

define Register_DataZ 0x36

What's your advice on the possible cause for this ? Getting crazy. Running sketches given as an example all they work until BMP180 and HMC5883L are connected together. They stop at electrical level, not software level in my opinion. It is not either the number of sensors, two others works !

What pull-ups do you use? Are the grounds (of the sensor power supply and the Arduino) connected?

I use 4.7 K pull-up. Yes, the 3.3 stepdown - (GND) is connected to one of the two arduino GND.

Try with 2k2 resistors. The bus capacity might be too high to reach a useful level within the short time with the bigger resistors. How long is your bus?

Very good point, ok. Bus is short, about 10 cm wires. I will get the resistor tomorrow or saturday and post the result.

I appreciate your help Sir.


Ok, swithcing the pull up resistors to something like about 1.7 KOhm sorted out some effects, need to investigate further and let you know. It is likely that some spurious signal was confuding the bus. At about 2.7 KOhm the I2c started to answer but was very very slow in initializing the sensors, so I lowered the pull up down and found that it was working better. Checking than reporting to you all.