Bosch BNO055 IMU Driver

Discuss development of drivers for external hardware and components, such as LCD screens, sensors, motor drivers, etc.
Target audience: Users and developers of drivers.
Post Reply
User avatar
deshipu
Posts: 1346
Joined: Thu May 28, 2015 5:54 pm

Bosch BNO055 IMU Driver

Post by deshipu » Wed Feb 08, 2017 11:09 pm

I have created a basic driver for the BNO055 IMU sensor. The code is available at https://bitbucket.org/thesheep/micropython-bno055

Daks96
Posts: 3
Joined: Mon Jan 07, 2019 6:03 am

BNO055 data viewing with repl via i2c or uart

Post by Daks96 » Mon Jan 07, 2019 6:22 am

Hi. I've been using bno055 with arduino perfectly to get the roll, pitch, yaw values but I need to use micropython board now with bno055. I'm new to I2C programming with micropy. Could u tell me how to fetch data from the BNO055 board via uart or i2c? Has a code for calibration of BNO055 been imported to micropy? Is it possible for me to view the roll, pitch, yaw data from repl prompt on my terminal?

User avatar
mattyt
Posts: 222
Joined: Mon Jan 23, 2017 6:39 am

Re: Bosch BNO055 IMU Driver

Post by mattyt » Mon Jan 07, 2019 10:47 am

Heya Daks,

Most of your questions can be answered if you take a look at Deshipu's code. It's only around 100 lines and very readable (I especially like the use of the partial functions Deshipu!).

The example in the docstring should be particularly useful to you:

Code: Select all

import bno055
from machine import I2C, Pin

i2c = I2C(-1, Pin(5), Pin(4), timeout=1000)
s = bno055.BNO055(i2c)
print(s.temperature())
print(s.euler())
It doesn't appear that calibration is performed and I presume roll, pitch and yaw need to be calculated from the primitives that the device provides. Happy to be corrected though; I'm not familiar with that sensor.

Just copy the two files in the repository to your MicroPython device and then you can retrieve the sensor values at the REPL.

Daks96
Posts: 3
Joined: Mon Jan 07, 2019 6:03 am

Re: Bosch BNO055 IMU Driver

Post by Daks96 » Fri Jan 18, 2019 7:19 am

@mattyt Thanks for the reply. I tried deshipu's code using my pyboard v1.1 and BNO055 and I'm getting this error:
PYB: sync filesystems
PYB: soft reboot
Traceback (most recent call last):
File "main.py", line 5, in <module>
File "bno055.py", line 42, in __init__
File "bno055.py", line 73, in init
File "bno055.py", line 83, in reset
File "functools.py", line 5, in _partial
TypeError: function got multiple values for argument 'register'
MicroPython v1.9.4 on 2018-05-11; PYBv1.1 with STM32F405RG
How do I resolve it?

kwang59
Posts: 1
Joined: Sun Mar 03, 2019 5:57 am

Re: Bosch BNO055 IMU Driver

Post by kwang59 » Sun Mar 03, 2019 6:05 am

Hi, do you figure out how to solve the problem? I also encountered it, but it work well after I change the address in __int__ to 0x29.
But I'm kinda confused about the reading. For gyroscope(), I feel like the IMU take its original place as coordinates, and reading values are also kinda confused bc Idk how to the correspond the values to angles.

Post Reply