Adafruit_BNO055 Library Port

Hello everyone,

I have ported the Arduino Library for the BNO055, a very nice accelerometer board that I got today.

I was able to port the library so that it now works perfectly on a Photon. I have also condensed the library a bit so that it is now just two files, particle-BNO055.cpp and particle-BNO055.h.

Here is the ported library on GitHub.

- Nathan Robinson


I just started tinkering with the BNO055, it is nice to come across your library port. Thank you!

I am using Particle WorkBench, I am wondering if anyone here already installed the library in the WorkBench. Thank you.

1 Like

Nathan, thank you for the port. There are several examples… but they use a couple different pins to connect SDA/SCL. I can’t see where it is actually called out in the .h. Does the code determine which photon pins are actually connected?

By default it works with the default Wire pins on the photon.

Pin D0 SDA
Pin D1 SCL

Nope, the pins are "hard wired" to the Wire object.
And for that reason it would always be good to also have a ::begin() function that can take an alternative I2C interface (e.g. Wire1) as input parameter.

Thank you! 3 of the 4 examples use Analog 4&5. This worked perfectly. Thanks again for your Port!

1 Like


Thanks much for porting the library. In the use of it, what is the best way to put the BNO055 to sleep / or how the manual states, 'suspend'? I did not notice such a function in the library so I figure using something such as the following would work?

3.2.1 Normal Mode
In normal mode all sensors required for the selected operating mode (see section 3.3) are always switched ON. The register map and the internal peripherals of the MCU are always operative in this mode.
3.2.2 Low Power Mode
If no activity (i.e. no motion) is detected for a configurable duration (default 5 seconds), the BNO055 enters the low power mode. In this mode only the accelerometer is active. Once motion is detected (i.e. the accelerometer signals an any-motion interrupt), the system is woken up and normal mode is entered. The following settings are possible.
3.2.3 Suspend Mode
In suspend mode the system is paused and all the sensors and the microcontroller are put into sleep mode. No values in the register map will be updated in this mode. To exit from suspend mode the mode should be changed by writing to the PWR_MODE register (see Table 3-1).

So to save battery power, use something like this before a sleep cycle? (0x02)

  Wire.beginTransmission(0x28); //Start I2C transmission - BNO055 I2C address is 0x28(40) 
  Wire.write(0x3E);// Select PWR_MODE register
  Wire.write(0x00);// Power modes selection: 0x00 = Normal, 0x01 = Low Power, 0x02 = Suspend Mode
  Wire.endTransmission();// Stop I2C transmission



That looks like it should work.

In the library, the write8 method is used to set the mode. It’s private however. I could modify my port.

No worries on modifying your port - all works well as is. I just wanted to be sure I didn’t miss a possible already existing function for that, and to additionally get some advice of my proposed method to make it sleep would work.

Thanks much!


1 Like