How to read from a i2c sensor and print on a i2c display when both use different init pins

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Hello-world
Posts: 13
Joined: Mon Mar 11, 2019 2:23 pm

Re: How to read from a i2c sensor and print on a i2c display when both use different init pins

Post by Hello-world » Thu Mar 21, 2019 8:20 pm

fstengel wrote:
Thu Mar 21, 2019 5:56 pm
That's the weird bit: normally the bno's address should be 0x28 or 0x29, depending on the state of its COM3 pin. If you are using the adafruit package, this pin is accessed through the ADR pin and defaults to COM3 low and 0x28 as the I2C address. So first things first: check if your bno is properly wired...
Will look into that, thank you

Hello-world
Posts: 13
Joined: Mon Mar 11, 2019 2:23 pm

Re: How to read from a i2c sensor and print on a i2c display when both use different init pins

Post by Hello-world » Sat Mar 23, 2019 3:46 am

dhylands wrote:
Thu Mar 21, 2019 6:36 pm
well 0x28 = 40 and 0x29 = 41.

The numbers reported by i2c.scan are decimal.

Make sure that you have a good ground connection between your devices and the processor.
Ive gone ahead and tightened the female ends on my wires connecting the ESP32 to the bno055 just in case they were loose. I am using the GND off the ESP32 and my wires are about 6inches long.

Unfortunately, the problem with addresses fluctuating still stands, I'm seeing 41 and 42 as addresses. Do you think I should lock the address down?

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: How to read from a i2c sensor and print on a i2c display when both use different init pins

Post by Roberthh » Sat Mar 23, 2019 7:18 am

Yes. Tie the ADR pin of the bno55 to a stable level, like GND.

Hello-world
Posts: 13
Joined: Mon Mar 11, 2019 2:23 pm

Re: How to read from a i2c sensor and print on a i2c display when both use different init pins

Post by Hello-world » Sat Mar 23, 2019 8:18 pm

Thanks everyone who has helped, I think I have gotten somewhere:

I set the address on the I2C by grounding out the ADR pin. This helped lock the address down.

To deal with the OSError: ETIMEDOUT I had to set my timeout to 2000 in the i2c init via:

Code: Select all

i2c = I2C(-1, Pin(22), Pin(21), timeout=2000)

Hello-world
Posts: 13
Joined: Mon Mar 11, 2019 2:23 pm

Re: How to read from a i2c sensor and print on a i2c display when both use different init pins

Post by Hello-world » Sat Mar 23, 2019 8:18 pm

Roberthh wrote:
Sat Mar 23, 2019 7:18 am
Yes. Tie the ADR pin of the bno55 to a stable level, like GND.
Thank you! This did the trick

Post Reply