1

I'm using the BNO055 9DOF Adafruit sensor to measure the acceleration/orientation. How can I change the configuration of the accelerometer from 4G (default) to 16G?

What I already know:

The datasheet : https://cdn-shop.adafruit.com/datasheets/BST_BNO055_DS000_12.pdf

From point 3.5.2 from page 27, I need to change xxxxxx01b to xxxxxx11b in the configuration file (that is the library). I use https://github.com/adafruit/Adafruit_BNO055 but I could not find any information on what to change and where in the .h file.

Any ideas?

Thank you

2

This was partly discussed as an issue on the library's github

Here's how I understand it:

The library doesn't configure the registers you want. I don't see a reference to writing to the ACC_CONFIG register (address 8). Not even defined in the header.

The sensor has two register-pages (0 and 1) [refer page 50]. I.e. if you select page 0 then the register at address X means something, at page 1 it means something else.

We want to write to ACC_Config at address 0x08 on Page 1.

Page 77 tells us that, regarding writing to the register: "Write: can only be changed in sensor mode, see section 3.5.2"

In code, you could hack something in there:

After changing to the sensore mode, you could then write to the register as

//values taken from section 3.5.2 page 27
#define BNO055_ACC_CONFIG_2G (0) //0B00 
#define BNO055_ACC_CONFIG_4G (1) //0B01
#define BNO055_ACC_CONFIG_8G (2)  //0B10
#define BNO055_ACC_CONFIG_16G (3)  //0B11

//bandwidth definitions
#define BNO055_ACC_BW_7_81_Hz (0)  
#define BNO055_ACC_BW_15_63_Hz (1)  
#define BNO055_ACC_BW_31_25_Hz (2)   
#define BNO055_ACC_BW_62_5_Hz (3)  
#define BNO055_ACC_BW_125_Hz (4)  
#define BNO055_ACC_BW_250_Hz (5)  
#define BNO055_ACC_BW_500_Hz (6)  
#define BNO055_ACC_BW_1000_Hz (7) 

//powermode definitions 
#define BNO055_ACC_PWRMODE_NORMAL (0)  
#define BNO055_ACC_PWRMODE_SUSPEND (1) 
#define BNO055_ACC_PWRMODE_LP1 (2) 
#define BNO055_ACC_PWRMODE_STANDBY (3)  
#define BNO055_ACC_PWRMODE_LP2 (4) 
#define BNO055_ACC_PWRMODE_DEEP_SUSPEND (5) 

#define BNO055_ACC_CONFIG_ADDR 0x08 

//Select page ID 1 to write to the right register
write8(BNO055_PAGE_ID_ADDR, 1);
//build the config value with bitshifts
//see page 77
//use all standard values except 16G parameter
uint8_t acc_config = (uint8_t)((BNO055_ACC_PWRMODE_NORMAL << 5) 
                   | (BNO055_ACC_BW_62_5_Hz << 2)  
                   | BNO055_ACC_CONFIG_16G); 
//write new accelerometer config 
write8(BNO055_ACC_CONFIG_ADDR, acc_config);

//change back to page ID 0 (or whatever was before there)
//Otherwise we read sensor data from the wrong page with entirely different meaning
write8(BNO055_PAGE_ID_ADDR, 0);

Since I don't have that sensor here I have no way to test it. So this is just the basic idea. You can also read registers with read8, with which you can verify that before you write anything to the register, it has some standard (or expected) value. E.g., ACC_CONFIG should read as 0B00001101 = 0x0d. And after you write a value there you should be able to read the same value back, otherwise the chip didn't let you execute the write and you have to investigate why.

Yes, you mostly have to do the hard work by yourself. Changing from 4G to 16G might also have the implication that some other calculations on the raw data has to be done different, however I am not sure of that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.