Reconnecting problems LSM6DS33

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
santosgonzalez
 
Posts: 7
Joined: Thu Jul 15, 2021 9:26 pm

Reconnecting problems LSM6DS33

Post by santosgonzalez »

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

// 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?

User avatar
sj_remington
 
Posts: 994
Joined: Mon Jul 27, 2020 4:51 pm

Re: Reconnecting problems LSM6DS33

Post by sj_remington »

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

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

Re: Reconnecting problems LSM6DS33

Post by santosgonzalez »

Thanks, good suggestion :)

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

Return to “Arduino”