Adafruit_TSL2591_Library
Adafruit_TSL2591_Library copied to clipboard
Abnormal power consumption in sleep mode
I have an application where I need to keep the TSL2591 in sleep mode and as soon as a value out of range is detected, a hardware interrupt is triggered to wake up the Arduino MKR1310 from deep sleep.
I'm using https://www.adafruit.com/product/1980 Adafruit TSL2591 High Dynamic Range Digital Light Sensor - STEMMA QT because I couldn't find the version without SparkFun qwiic.
I've made a fork of this library https://github.com/fwag/Adafruit_TSL2591_Library/commit/5d6b71a7e744dea7f318094cc6b6788adffe2bf8 where I've just enabled the Sleep After Interrupt (SAI) and removed the No Persist Interrupt EN bit (NPIEN). Just forget about the disableI2C/enableI2C functions, because I didn't see any power improvement by disabling I2C and setting I2C pins as inputs.
I've characterized the MKR1310 and it draws 200uA in deep sleep. The problem is that I see a consumption of more than 450uA on the battery JST connector associated with the Adafruit TSL2591 sensor board. In fact, as soon as I remove the board, the current drops from 650uA to 200uA.
I cannot disable the TSL2591 sensor. Anyway, I made a test and the consumption is of 390uA, so 190uA related to AdafruitTSL2591 sensor board.
Do I need to dissolder some ICs on the sensor board to get the 4 uA declared in datasheet?
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include "Adafruit_TSL2591.h"
#include <ArduinoLowPower.h>
#define PIN_D7 (7u)
#define TLS2591_INT_THRESHOLD_LOWER (0)
#define TLS2591_INT_THRESHOLD_UPPER (50)
#define TLS2591_INT_PERSIST (TSL2591_PERSIST_ANY)
Adafruit_TSL2591 tsl = Adafruit_TSL2591(2591);
void configureLightSensor(void) {
tsl.setGain(TSL2591_GAIN_MED); // 25x gain
tsl.setTiming(TSL2591_INTEGRATIONTIME_100MS); // shortest integration time (bright light)
tsl.enable();
tsl.clearInterrupt();
tsl.registerInterrupt(TLS2591_INT_THRESHOLD_LOWER,
TLS2591_INT_THRESHOLD_UPPER,
TLS2591_INT_PERSIST);
}
void isrLightSample (void)
{
tsl.clearInterrupt();
}
void setup() {
tsl.begin();
configureLightSensor();
pinMode(PIN_D7, INPUT_PULLUP);
LowPower.attachInterruptWakeup(PIN_D7, isrLightSample, FALLING);
USBDevice.detach();
}
void loop() {
LowPower.deepSleep();
delay(100);
}
Brief update
I've desoldered U2 creating a short circuit between pin 1 and 5. I've desoldered R1 (led resistor). In addition I've desoldered Q21, Q22 and R3 array. I made a short circuit between pins 1-6 and 3-4. Now I have with SAI enabled a consumption of 450 uA, while in power down (ENABLE register set to 0x00) the expected consumption of 200 uA.
I've checked ENABLE register and it is properly set. I've opened a support ticket to AMS OSRAM to further investigate this SAI feature which seems not working.