BNO055-setting the accelerometer range
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- rogersc
- Posts: 2
- Joined: Thu Dec 03, 2015 12:49 pm
BNO055-setting the accelerometer range
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.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: BNO055-setting the accelerometer range
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:
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);
}
- rogersc
- Posts: 2
- Joined: Thu Dec 03, 2015 12:49 pm
Re: BNO055-setting the accelerometer range
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!!!
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!!!
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: BNO055-setting the accelerometer range
Great! Thanks for the report!
- beverson
- Posts: 4
- Joined: Tue Mar 29, 2016 1:57 pm
Re: BNO055-setting the accelerometer range
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?
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?
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: BNO055-setting the accelerometer range
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
https://cdn-shop.adafruit.com/product-f ... 000_13.pdf
table 3.8 on Page 27 shows that range is autocontrolled in fusion mode
- beverson
- Posts: 4
- Joined: Tue Mar 29, 2016 1:57 pm
Re: BNO055-setting the accelerometer range
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.
- beverson
- Posts: 4
- Joined: Tue Mar 29, 2016 1:57 pm
Re: BNO055-setting the accelerometer range
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?
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?
- gammaburst
- Posts: 1015
- Joined: Thu Dec 31, 2015 12:06 pm
Re: BNO055-setting the accelerometer range
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.
I'd much rather have noise than sticky readings.
Bosch, If you're listening, please make it a user-selectable option.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: BNO055-setting the accelerometer range
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.
ACC_AM_THRES is the interrupt threshold. It's only for interrupts.
gammaburst is probably correct - they're applying hysteresis.
Please be positive and constructive with your questions and comments.