Page 2 of 6

Re: Pico and BNO055 IMU

Posted: Tue Jan 04, 2022 9:03 pm
by Thomas_G_S
Done that and still getting the error. I've tried using Micropython and it seems to have fixed that problem, however it now says: "RuntimeError: No BNO055 chip detected."

I have the Adafruit BNO055 plugged in using GPIO 0 and GPIO 1. Do I need to activate SCL and SDA somehow?

Re: Pico and BNO055 IMU

Posted: Tue Jan 04, 2022 9:27 pm
by Roberthh
GPIO0 and 1 are assigned to I2C(0), but bno055_test.py uses I2C(1). You either have to change bno055_test.py, line 10, or connect the sensor to GPIO2 (SDA) and 3 (SCL).

Re: Pico and BNO055 IMU

Posted: Tue Jan 04, 2022 9:36 pm
by Thomas_G_S
I'm getting data now, THANK YOU!!! :) :) :)

Only one problem - after around 1.5 seconds the data stops coming in and I get the following error:

Traceback (most recent call last):
File "<stdin>", line 22, in <module>
File "/lib/bno055_base.py", line 89, in <lambda>
File "/lib/bno055_base.py", line 118, in scaled_tuple
File "/lib/bno055_base.py", line 200, in _readn
OSError: [Errno 5] EIO

Re: Pico and BNO055 IMU

Posted: Tue Jan 04, 2022 9:45 pm
by Roberthh
That's an I2C communication error.

Re: Pico and BNO055 IMU

Posted: Tue Jan 04, 2022 9:47 pm
by Thomas_G_S
So is it a hardware issue?

Re: Pico and BNO055 IMU

Posted: Wed Jan 05, 2022 6:49 am
by Roberthh
Maybe, but more likely a synchronization or wiring problem. You could try running I2C at a lower frequency, by setting:

i2c = machine.I2C(1, freq=100000)

or even less. If it then works, then there is an issue with the wiring, like wires too long or pull-up resistors to large.

Re: Pico and BNO055 IMU

Posted: Wed Jan 05, 2022 10:55 am
by pythoncoder
On the Pico you need physical pullup resistors. Anything in the region of 1KΩ to 4.7KΩ connected between SDA and 3.3V and between SCK and 3.3V.

Re: Pico and BNO055 IMU

Posted: Wed Jan 05, 2022 11:23 am
by Thomas_G_S
The pico is now unable to detect the gyro. When I try to run the program I get this:

Traceback (most recent call last):
File "<stdin>", line 13, in <module>
File "/lib/bno055.py", line 127, in __init__
File "/lib/bno055_base.py", line 96, in __init__
RuntimeError: No BNO055 chip detected.


I have run a program to search for I2C devices, and it's able to find it:

Scanning i2c bus
i2c devices found: 1
Decimal address: 40 | Hexa address: 0x28

Re: Pico and BNO055 IMU

Posted: Wed Jan 05, 2022 12:07 pm
by pythoncoder
Your scan shows it's at the correct address but the first attempt to read from it failed. Clearly I2C access is inconsistent. Please check the hardware issues raised by myself and @RobertHH.

Re: Pico and BNO055 IMU

Posted: Wed Jan 05, 2022 12:16 pm
by Thomas_G_S
I've put resistors in the scl and sda lines. Is that what you mean? I've also tried lowering the frequency, but that hasn't worked either.