Tony-P
Posts: 2
Joined: Mon Dec 05, 2022 3:56 pm

BNO055 with Pi Pico

Mon Dec 05, 2022 4:02 pm

Afternoon

After running through the beginner's book, getting my Picos to flash lights, log temperatures and so on, I've moved on to trying to read the outputs from a BNO055 board, and am falling over at the first step.

I;ve tried on a Pico and Pico W, and can't import the relevalt library / drivers. The example code always looks for either bno055 or bno055_base, but despite installing them in Thonny, I get the message "ImportError: no module named 'bno055'"

I then tried fiddling around to see if there was another way of getting these modules onto the Pico, so tried both running each piece of .py code (bno055.py and bno055_base.py) on the pico, and copying each of them onto it.

Nothing worked.

It feels as though I am missing some very basic piece of information here around how I am supposed to install these libraries in order to allow my code to use them. I'm hoping that there's a very simple, obvious step that I am missing. Can anyone suggest what it is?

ghp
Posts: 3038
Joined: Wed Jun 12, 2013 12:41 pm
Location: Stuttgart Germany

Re: BNO055 with Pi Pico

Mon Dec 05, 2022 6:45 pm

Which library are you using ? The 'usual' source of libs is by https://awesome-micropython.com/

Simple procedure is to create files "bno055.py" and "bno055_base.py in same dir on file system of pico.
Or create a folder "lib" and place the files there.

Explanation: python has a module search path which usually has own directory first, then the lib-folder in micropython. You can check this in REPL:

Code: Select all

>>> import sys
>>> sys.path
['', '.frozen', '/lib']
>>> 

Tony-P
Posts: 2
Joined: Mon Dec 05, 2022 3:56 pm

Re: BNO055 with Pi Pico

Mon Dec 05, 2022 10:28 pm

Thanks for the prompt response.

I'd taken the libraries from Pimoroni, but will try them from your suggested location.

Both weer copied to the top level in the Pico, so I'll try putting them in a sub-folder as you suggest.

If it makes any difference I'm using a Pico W, which I know has some differences to the "non-W" Pico.

I'll try the changes and report back.

Return to “MicroPython”