BNO055-setting the accelerometer range

Post test messages here

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
rogersc
 
Posts: 2
Joined: Thu Dec 03, 2015 12:49 pm

BNO055-setting the accelerometer range

Post by rogersc »

I would like to set the accelerometer range to +/- 2 g. Please shown how this is done with the BNO055 sensor using an Arduino (i.e. What changes are needed in the Adafruit_BNO055.h file?). --Thanks in advance.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: BNO055-setting the accelerometer range

Post by adafruit_support_rick »

You'll have to add a new function to the library.
The procedure is this:
In the header, add this definition
#define BNO055_ACC_CONFIG_ADDR 0x08

Also add the new function definition to the class

In the new function
read and save BNO055_PAGE_ID_ADDR
write 0x01 to BNO055_PAGE_ID_ADDR
write 0x0B to BNO055_ACC_CONFIG_ADDR
restore saved value to BNO055_PAGE_ID_ADDR

The function will look something like this:

Code: Select all

void Adafruit_BNO055::set2GRange()
{
  adafruit_bno055_opmode_t modeback = _mode;

  /* Switch to config mode (just in case since this is the default) */
  setMode(OPERATION_MODE_CONFIG);
  delay(25);

  /* save selected page ID and switch to page 1 */
  uint8_t savePageID = read8(BNO055_PAGE_ID_ADDR);
  write8(BNO055_PAGE_ID_ADDR, 0x01);

  /* set configuration to 2G range */
  write8(BNO055_ACC_CONFIG_ADDR, 0x0B);
  delay(10);

  /* restore page ID */
  write8(BNO055_PAGE_ID_ADDR, savePageID);

  /* Set the requested operating mode (see section 3.3) */
  setMode(modeback);
  delay(20);
}

User avatar
rogersc
 
Posts: 2
Joined: Thu Dec 03, 2015 12:49 pm

Re: BNO055-setting the accelerometer range

Post by rogersc »

Thank you Rick,

I have the Adafruit bno055 library for setting the accelerometer to the +|- 2g range working now with your help. I had to modify your code slightly as follows:

/************************************************************************/

/* PAGE1 REGISTER DEFINITION START*/
BNO055_ACC_CONFIG_ADDR = 0X08


/************************************************************************/

void set2GRange()
{
adafruit_bno055_opmode_t modeback = _mode;

/* Switch to config mode (just in case since this is the default) */
setMode(OPERATION_MODE_CONFIG);
delay(25);

/* save selected page ID and switch to page 1 */
uint8_t savePageID = read8(BNO055_PAGE_ID_ADDR);
write8(BNO055_PAGE_ID_ADDR, 0X01);

/* set configuration to 2G range */
write8(BNO055_ACC_CONFIG_ADDR, 0X0C);
delay(10);

/* restore page ID */
write8(BNO055_PAGE_ID_ADDR, savePageID);

/* Set the requested operating mode (see section 3.3) */
setMode(modeback);
delay(20);
}

/************************************************************************/

thanks again!!!

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: BNO055-setting the accelerometer range

Post by adafruit_support_rick »

Great! Thanks for the report!

User avatar
beverson
 
Posts: 4
Joined: Tue Mar 29, 2016 1:57 pm

Re: BNO055-setting the accelerometer range

Post by beverson »

The datasheet specifies that the bandwidth and power mode bits of ACC_CONFIG are auto controlled in fusion mode but the range bits are user selectable in any mode.
I can change from +/- 4g to +/- 2g in CONFIG_MODE but it seems to change back to +/- 4g when I go back to NDOF mode.

Am I doing something wrong or is the Bosch data sheet incorrect?

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: BNO055-setting the accelerometer range

Post by adafruit_support_rick »

Which datasheet are you looking at? The one on our product page is the latest.
https://cdn-shop.adafruit.com/product-f ... 000_13.pdf
table 3.8 on Page 27 shows that range is autocontrolled in fusion mode

User avatar
beverson
 
Posts: 4
Joined: Tue Mar 29, 2016 1:57 pm

Re: BNO055-setting the accelerometer range

Post by beverson »

Thank you, that was my issue. The previous data sheet (1.2) indicates the range can be changed in any mode. Apparently that was a mistake.

User avatar
beverson
 
Posts: 4
Joined: Tue Mar 29, 2016 1:57 pm

Re: BNO055-setting the accelerometer range

Post by beverson »

I wanted to change the accelerometer range because I thought it may respond better to slow movements.
I am in NORMAL power mode but the EULER and QUATERNION output don't seem to respond to subtle movements.
I have tried to manipulate the ACC_AM_THRES register but I'm not sure if this only is applicable for low power mode or interrupt use.

Do you have any suggestions?

User avatar
gammaburst
 
Posts: 1013
Joined: Thu Dec 31, 2015 12:06 pm

Re: BNO055-setting the accelerometer range

Post by gammaburst »

The BNO055 fusion outputs seem to be applying hysteresis, probably to hide the noise.
I'd much rather have noise than sticky readings.
Bosch, If you're listening, please make it a user-selectable option.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: BNO055-setting the accelerometer range

Post by adafruit_support_rick »

How subtle is "subtle"? I think it should be good to a couple of mg.

ACC_AM_THRES is the interrupt threshold. It's only for interrupts.

gammaburst is probably correct - they're applying hysteresis.

Locked
Please be positive and constructive with your questions and comments.

Return to “Test Message Forum (closed)”