Hi,
I'm currently using a BNO055 sensor. The default power mode of the sensor is Normal however I want to set it to Low-Power-Mode where only the accelerometer is active always. Can you please tell me what additions I have to make to my code in order to set the sensor to this mode??
Thanks.
From the Adafruit BNO055 library:
/*!
* @brief Enter Suspend mode (i.e., sleep)
*/
void Adafruit_BNO055::enterSuspendMode() {
adafruit_bno055_opmode_t modeback = _mode;
/* Switch to config mode (just in case since this is the default) */
setMode(OPERATION_MODE_CONFIG);
delay(25);
write8(BNO055_PWR_MODE_ADDR, 0x02);
/* Set the requested operating mode (see section 3.3) */
setMode(modeback);
delay(20);
}
You can use it in your sketch as such:
myIMU.enterSuspendMode();
Thank you so much for the reply! I think there are 3 modes as per the sensor datasheet. 0x02 is for suspend. What is it for Low-Power where only the Accelerometer is active?
You'll have to write your own function to do this since the base Adafruit library does not have a function written to do this. Fortunately, the datasheet tells us what value to put into the PWR_MODE register here:
What you can do is go into the Adafruit BNO055 library and insert a function like so:
In the .cpp:
/*!
* @brief Enter Low Power mode
*/
void Adafruit_BNO055::enterLowPowerMode() {
adafruit_bno055_opmode_t modeback = _mode;
/* Switch to config mode (just in case since this is the default) */
setMode(OPERATION_MODE_CONFIG);
delay(25);
write8(BNO055_PWR_MODE_ADDR, 0x01); //<------------------- changed second arg to 0x01 for low power instead of sleep
/* Set the requested operating mode (see section 3.3) */
setMode(modeback);
delay(20);
}
In the .h:
class Adafruit_BNO055 : public Adafruit_Sensor {
public:
//preexisting stuff here
//our new function here
void enterLowPowerMode();
//the rest of the preexisting stuff here
}
and then you can call it like:
myIMU.enterLowPowerMode();
1 Like