0

Reconnecting problems LSM6DS33
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Reconnecting problems LSM6DS33

by santosgonzalez on Mon Jul 26, 2021 11:55 pm

I'm trying to reduce power consumption for my project where I'm recording motion using the adafruit LSM6DS33 + LIS3MDL with a Feather M0 Adalogger with RTC shield. To do so, I'm using a Sparkfun Qwiic Power Switch to cut off power to the sensor.

However, when running the example sketch and turn off the sensor, I cannot get the sensor working again. This is the reduced sketch I used:

Code: Select all | TOGGLE FULL SIZE
// Basic demo for accelerometer/gyro readings from Adafruit LSM6DS33

#include <Adafruit_LSM6DS33.h>
#include <Wire.h>
Adafruit_LSM6DS33 lsm6ds33;

#include <SparkFun_Qwiic_Power_Switch_Arduino_Library.h>
QWIIC_POWER mySwitch;


void setup(void) {
  Serial.begin(115200);

  Wire.begin();
  mySwitch.begin();
  mySwitch.powerOn();

  Serial.println("Adafruit LSM6DS33 test!");

  lsm6ds33.begin_I2C();
  delay(2000);
}

void loop() {
   
    //  /* Get a new normalized sensor event */
    sensors_event_t accel;
    sensors_event_t gyro;
    sensors_event_t temp;
    lsm6ds33.getEvent(&accel, &gyro, &temp);

    Serial.print(temp.temperature); Serial.print(" ");

    /* Display the results (acceleration is measured in m/s^2) */
    Serial.print(accel.acceleration.x); Serial.print(" ");
    Serial.print(accel.acceleration.y); Serial.print(" ");
    Serial.print(accel.acceleration.z); Serial.println(" ");

    delay(1000);
 
  mySwitch.powerOff();
  delay(3000);
  mySwitch.powerOn();
  lsm6ds33.begin_I2C();

}


When the last for lines are removed (i.e., the power is not turned off), it all works fine, readings are normal. When turned off, only the first reading of the sensor is fine, the rest becomes zeros. I've tried the same but with a MPU6050 and BMP390, those sensors work perfectly fine with the switch...

Anyone any suggestions?

santosgonzalez
 
Posts: 7
Joined: Thu Jul 15, 2021 9:26 pm

Re: Reconnecting problems LSM6DS33

by sj_remington on Tue Jul 27, 2021 1:02 am

Consider using the power down modes of both sensors, rather than switching them off. Total current draw around 7 uA.

sj_remington
 
Posts: 126
Joined: Mon Jul 27, 2020 4:51 pm

Re: Reconnecting problems LSM6DS33

by santosgonzalez on Tue Jul 27, 2021 2:50 am

Thanks, good suggestion :)

santosgonzalez
 
Posts: 7
Joined: Thu Jul 15, 2021 9:26 pm

Please be positive and constructive with your questions and comments.