Pico and BNO055 IMU
-
- Posts: 18
- Joined: Mon Jan 03, 2022 1:29 pm
Pico and BNO055 IMU
Hello
I'm trying to get my Raspberry Pi Pico to collect data from the adafruit BNO055 IMU breakout using Micropython. So far I have this code:
import adafruit_bno055
import machine
i2c = machine.I2C(0, scl=machine.Pin(1), sda=machine.Pin(0))
sensor = adafruit_bno055.BNO055_I2C(i2c)
print(sensor.temperature)
print(sensor.euler)
print(sensor.gravity)
and I am getting this error message:
Traceback (most recent call last):
File "<stdin>", line 5, in <module>
File "/lib/adafruit_bno055.py", line 768, in __init__
File "/lib/adafruit_bus_device/i2c_device.py", line 50, in __init__
File "/lib/adafruit_bus_device/i2c_device.py", line 152, in __probe_for_device
AttributeError: 'I2C' object has no attribute 'try_lock'
can anyone help me?
Thanks
I'm trying to get my Raspberry Pi Pico to collect data from the adafruit BNO055 IMU breakout using Micropython. So far I have this code:
import adafruit_bno055
import machine
i2c = machine.I2C(0, scl=machine.Pin(1), sda=machine.Pin(0))
sensor = adafruit_bno055.BNO055_I2C(i2c)
print(sensor.temperature)
print(sensor.euler)
print(sensor.gravity)
and I am getting this error message:
Traceback (most recent call last):
File "<stdin>", line 5, in <module>
File "/lib/adafruit_bno055.py", line 768, in __init__
File "/lib/adafruit_bus_device/i2c_device.py", line 50, in __init__
File "/lib/adafruit_bus_device/i2c_device.py", line 152, in __probe_for_device
AttributeError: 'I2C' object has no attribute 'try_lock'
can anyone help me?
Thanks
Re: Pico and BNO055 IMU
The Adafruit dialect of MicroPython called CircuitPython is different from the genuine MicroPyhon. If you want to use Adafruit drivers, it may be easier to use CircuitPython as well for your board.
-
- Posts: 11
- Joined: Tue Dec 22, 2020 7:19 pm
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Pico and BNO055 IMU
Or use this MicroPython driver.If you want to use Adafruit drivers, it may be easier to use CircuitPython as well for your board.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
-
- Posts: 18
- Joined: Mon Jan 03, 2022 1:29 pm
Re: Pico and BNO055 IMU
Hello, thanks for getting back to me so quick. Pythoncoder, how would I install that library onto my board? I can't find it on Thonny and I don't know how to install libraries onto Pico without it.
I am now using CircuitPython Roberthh, thanks for the suggestion
I am now using CircuitPython Roberthh, thanks for the suggestion
Re: Pico and BNO055 IMU
I cannot say that I recommend to use CircuitPython. My preference is MicroPython. But everyone has to go for her or his choice, and at least the best part of CircuitPyhton is the MicroPython core.I am now using CircuitPython Roberthh, thanks for the suggestion
-
- Posts: 18
- Joined: Mon Jan 03, 2022 1:29 pm
Re: Pico and BNO055 IMU
Ok, I'll try them both out. Thanks! Btw, how would I install a library onto Pico that isn't on Thonny?
Re: Pico and BNO055 IMU
Just copy the Python script(s) to the board, either to the top level dir or to /lib. For copying, you can use mpremote, rshell, Thonny, ...how would I install a library onto Pico that isn't on Thonny?
-
- Posts: 18
- Joined: Mon Jan 03, 2022 1:29 pm
Re: Pico and BNO055 IMU
Ok, I've done that. I'm now running the test code and I'm getting the following error message:
Traceback (most recent call last):
File "<stdin>", line 13, in <module>
NameError: name 'BNO055' isn't defined
I'm using the library that pythoncoder posted earlier:
https://github.com/micropython-IMU/micropython-bno055
Traceback (most recent call last):
File "<stdin>", line 13, in <module>
NameError: name 'BNO055' isn't defined
I'm using the library that pythoncoder posted earlier:
https://github.com/micropython-IMU/micropython-bno055
Re: Pico and BNO055 IMU
Did you copy both bno055.py and bno055_base.py?
As first step, I would try bno055_test.py.
As first step, I would try bno055_test.py.