Let's start by demonstrating the general issue. There is a list of known troublesome chips here:
The BNO55 and BNO085 sensors are used to demonstrate since these commonly come up as a source of problems.
The wiring used here is identical to what is shown in that guide.
NOTE: There is a fair bit of initial software setup involved - mainly with the Blinka setup. Be sure to go through all of the required steps in the guide linked above.
Once Blinka is installed and configured and you have installed the BNO055 CircuitPython library, now to see if the BNO055 can be used on the Pi.
First double check the connections with a quick I2C scan:
pi@raspberrypi:~ $ i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- 28 -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --
Cool! It's showing up at the expected I2C address of 0x28
. So the BNO055 is found. Try running the simple example from the library:
pi@raspberrypi:~ $ python3 bno055_simpletest.py Temperature: -106 degrees C Accelerometer (m/s^2): (0.0, 0.0, 0.0) Magnetometer (microteslas): (36.25, -29.5, -66.0) Gyroscope (rad/sec): (0.0, -0.003272492347489368, 0.002181661564992912) Euler angle: (0.0, 0.0, 0.0) Quaternion: (0.0, 0.0, 0.0, 0.0) Linear acceleration (m/s^2): (0.0, 0.0, 0.0) Gravity (m/s^2): (0.0, 0.0, 0.0) Temperature: -106 degrees C Accelerometer (m/s^2): (0.16, -0.41000000000000003, 9.89) Magnetometer (microteslas): (35.875, -29.0625, -64.1875) Gyroscope (rad/sec): (0.0, 0.0, 0.001090830782496456) Euler angle: (0.0, 0.8125, 2.4375) Quaternion: (0.999755859375, -0.02154541015625, -0.00750732421875, 0.0) Linear acceleration (m/s^2): (0.0, 0.0, 0.17) Gravity (m/s^2): (0.14, -0.42, 9.790000000000001)
Well...it's running OK without any errors....but what's up with those sensor values? A temperature of -106 deg C? Something doesn't seem right. And it's not. Due to the poor handling of clock stretching, erroneous data is being read in.
BNO085 Example
Now to try the BNO085, which is similar to the BNO055. The main guide for the BNO085 covers how to get everything initially installed:
Once that is done, we again start with a quick I2C scan:
pi@raspberrypi:~ $ i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- 4a -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --
Yep. That's the expected 0x4A
address for the BNO085.
Now to try running the example from the library:
pi@raspberrypi:~ $ python3 bno08x_simpletest.py Acceleration: X: 0.230469 Y: -0.039062 Z: 9.843750 m/s^2 Gyro: X: 0.001953 Y: 0.001953 Z: 0.001953 rads/s Magnetometer: X: 22.187500 Y: 28.375000 Z: -47.750000 uT Rotation Vector Quaternion: I: 0.002136 J: -0.011108 K: 0.335449 Real: 0.942017 Acceleration: Traceback (most recent call last): File "/home/pi/bno08x_simpletest.py", line 29, in <module> accel_x, accel_y, accel_z = bno.acceleration # pylint:disable=no-member File "/home/pi/blinka/lib/python3.9/site-packages/adafruit_bno08x/__init__.py", line 594, in acceleration self._process_available_packets() File "/home/pi/blinka/lib/python3.9/site-packages/adafruit_bno08x/__init__.py", line 790, in _process_available_packets self._handle_packet(new_packet) File "/home/pi/blinka/lib/python3.9/site-packages/adafruit_bno08x/__init__.py", line 848, in _handle_packet raise error File "/home/pi/blinka/lib/python3.9/site-packages/adafruit_bno08x/__init__.py", line 843, in _handle_packet _separate_batch(packet, self._packet_slices) File "/home/pi/blinka/lib/python3.9/site-packages/adafruit_bno08x/__init__.py", line 358, in _separate_batch required_bytes = _report_length(report_id) File "/home/pi/blinka/lib/python3.9/site-packages/adafruit_bno08x/__init__.py", line 347, in _report_length return _AVAIL_SENSOR_REPORTS[report_id][2] KeyError: 133
It gave a reading (or several) that look OK, then it exited with a cryptic error. What going on? It's clock stretching again.
Page last edited March 08, 2024
Text editor powered by tinymce.