Hi all -
I'm running a WEMOS D1 mini clone, with a BMP280 (temp/humidity sensor) & a GY521 (accelerometer) attached on a breadboard.
GPIO 4 & 5 (SDA & SCL respectively) are being used as sw I2C; 4k7 pullups (to 3V3...) on both lines. Bus speed set to 400kHz.
If only one device is connected to the I2C bus, I2C.scan() reads back the ID of the device with no issues.
If both devices are connected, only one ID is read back.
Any thoughts on what I'm missing? I've searched, but not found anything that seems relevant. Total bus length is about 10cm with jumper wires which ought to be fine.
TIA!
I2C.scan() only returning 1 address in chain
Re: I2C.scan() only returning 1 address in chain
As first attempt please Check the cables and the breadboard.
Which one of the two is detected?
Which one of the two is detected?
Re: I2C.scan() only returning 1 address in chain
Pulled all the jumper wires, swapped them out for different ones. I've been disconnecting the slaves by pulling VCC from them, so the logic lines are still there.
Currently it's the GY521 being detected, which is physically 2nd in the chain. Pull power from it & the BMP280 is detected; repower and it's the GY521 again.
Currently it's the GY521 being detected, which is physically 2nd in the chain. Pull power from it & the BMP280 is detected; repower and it's the GY521 again.
Re: I2C.scan() only returning 1 address in chain
Are you sure that both devices have different I2c adresses?ESpy wrote: ↑Sun Jun 28, 2020 10:55 amPulled all the jumper wires, swapped them out for different ones. I've been disconnecting the slaves by pulling VCC from them, so the logic lines are still there.
Currently it's the GY521 being detected, which is physically 2nd in the chain. Pull power from it & the BMP280 is detected; repower and it's the GY521 again.
If not, you should change one of them.
Re: I2C.scan() only returning 1 address in chain
Maybe the combined pull-up resistance of both breakouts gets too low. In the pictures of the GY521 I find on the web the pull-up is 2k2 Ohm (the schematics say 4k7 Ohm). The BME280 has pull-ups too. But the ones I have carry 10k pull-ups, lowering it to 1k8 Ohm, which should still be fine. Are both sensor operating at 3.3V?
P.S.: The address of the MPU6050 on the GY521 is 0x68 or 0x69, the base address of the BME280 is 0x76
P.S.: The address of the MPU6050 on the GY521 is 0x68 or 0x69, the base address of the BME280 is 0x76
Re: I2C.scan() only returning 1 address in chain
From inspection, it looks as though the BMP280 has 10k pullups while the GY521 has 2k2 (I'm assuming here, I ought to buzz them out & double check). Both modules are running off 3V3.
Interestingly... Having pulled everything apart and rewired it, I2C.scan() is now reporting addresses 0x08..0x77 inclusive regardless of which 1 device is connected to it. I think I might try another 8266 module for the sake of my sanity.
Interestingly... Having pulled everything apart and rewired it, I2C.scan() is now reporting addresses 0x08..0x77 inclusive regardless of which 1 device is connected to it. I think I might try another 8266 module for the sake of my sanity.
Re: I2C.scan() only returning 1 address in chain
The latter happens if SDA is low all the time.
Re: I2C.scan() only returning 1 address in chain
And after all that, I've found the problem. Should have buzzed it out sooner; it was down to a faulty jumper wire...