adafruit / Adafruit_TSL2591_Library

This is an Arduino library for the TSL2591 digital luminosity (light) sensors.
58 stars 48 forks source link

100uA measured sleep current != datasheet 2.3uA #26

Closed pomplesiegel closed 5 years ago

pomplesiegel commented 5 years ago

According to the TSL2591 datasheet, the chip should consume only 2.3uA (micro-amps) when sleeping. However, using the current master branch version, I am seeing 100uA @ 3.3V when sleeping, which is quite high.

I see that the disable() call successfully reduces the current from about 300uA (when taking measurements) down to 100uA (sensor disabled). However, I think the device may not be in the proper sleep mode, as this is about 45x higher current than the datasheet value.

Is there another call that puts the device in a deeper sleep mode? Has anyone else experienced this level of current draw during sleep mode?

These measurements are made using the EEVBlog uCurrent, which has been independently tested and verified.

Thank you!

NuclearPhoenixx commented 5 years ago

What does your test setup look like? I'm very interested in making this as power-efficient as possible too.

caternuson commented 5 years ago

It looks like disable() is not putting it in sleep mode, only power down mode: https://github.com/adafruit/Adafruit_TSL2591_Library/blob/608b3a2460f8f0c6e2c206f2116303c0568214f6/Adafruit_TSL2591.cpp#L147

Also not seeing anything in current driver that supports sleep mode.

NuclearPhoenixx commented 5 years ago

Didn't find any sleep registers besides the ENABLE_POWEROFF one in the datasheet. What voltage did you test this on? If you're using 3.3V maybe the onboard regulator is consuming the excess power.

caternuson commented 5 years ago

The datasheet isn't super clear on how the sleep mode works, but it appears to be enabled using the SAI bit in the ENABLE register. It's also not clear if setting the PON bit actually enables sleep mode.

Potential residual power draw from the voltage regulator is possible if you are using the breakout.

pomplesiegel commented 5 years ago

@caternuson, I found the datasheet quite vague about sleep mode as well! Perhaps the SAI bit is worth a shot though.

I am using the IC directly with a samd21g18 with the linear regulator removed. There is no supporting circuitry for the TSL2591 other than a couple pull-up resistors. It's being powered directly with a 3.3V power supply. I am measuring the current inline using the uCurrent device hooked to my DVM. Everything is working very well, but the sleep power consumption is high.

This value was measured by measuring the combined current consumption, and then physically disconnecting the 3.3V and GND for the TSL2591 and measuring the differential. Basically the sleep current went from 133uA to 33uA when the TSL2591 was removed.

pomplesiegel commented 5 years ago

@caternuson, I tried playing with the SAI bit in order to influence the sleep state, but I could not see a change in the current consumption. Just to be clear, I am not using the breakout at this point - just the raw IC.

pomplesiegel commented 5 years ago

@Phoenix1747, any thoughts on this? I'm still finding the same result

SimonMerrett commented 5 years ago

@Phoenix1747, any thoughts on this? I'm still finding the same result

Just an offhand thought: your pullups. Are you removing 3.3V from them during sleep and if not, could they be the current sink? Just fag-packet calc but assuming each is 10k ohm and they're in parallel = 5k ohm equivalent (would be worse if you're using e.g. 4k7 ohm resistors): 3.3V / 5k = 660uA. I know this is greater than the 100uA you are achieving but as I said, perhaps worth ruling out.

pomplesiegel commented 5 years ago

Hello @SimonMerrett, Good thought! On my board the i2c bus is inactive while our microcontroller is sleeping. This means both SDA and SCLK are being held at 3.3V, so there is no voltage drop across the pull-up resistors, and therefore no power being drawn. I confirmed this on my oscilloscope yesterday just to be sure.

SimonMerrett commented 5 years ago

so there is no voltage drop across the pull-up resistors, and therefore no power being drawn

Good. Just to chase this down the road a little more, have you tried making your 3.3V pullup rail a GPIO output (HIGH, during operation) and pulling I2C pullup rail to ground during sleep. I'm wondering if the extra sleep current is leaking from 3.3V pullup rail, through the resistors to the SDA/SCL pins on the TSL2591, which may not be "sleeping" it's I2C interface... I don't know what your board looks like but it could be a relatively easy check to see if it makes any difference.

SimonMerrett commented 5 years ago

I'm wondering if the extra sleep current is leaking from 3.3V pullup rail, through the resistors to the SDA/SCL pins on the TSL2591, which may not be "sleeping" it's I2C interface...<

image So perhaps not a concern then. Oh well.

caternuson commented 5 years ago

@pomplesiegel Just to follow up, I don't have any useful suggestions. Sorry. Given the vagueness of the datasheet, I'd question if it's actually getting in to the sleep mode.

pomplesiegel commented 5 years ago

@SimonMerrett, that's a good thought though. I am currently in contact with AMS support. Their apps team confirmed that we are using the correct procedure to put the chip to sleep. They wrote

Writing zero to the PON bit puts the TSL2591 into sleep state.

Has anyone else performed a measurement regarding the sleep current of this IC? I have a few in my hands which behave identically, but it's always good to be thorough! Thank you

SimonMerrett commented 5 years ago

Has anyone else performed a measurement regarding the sleep current of this IC?

No. I only have the Adafruit breakout and my only current use is to characterise a less quantified photo sensor. I also lack the equipment to reliably test at the moment (waiting for Joulescope kickstarter to be fulfilled - can't wait!).

pomplesiegel commented 5 years ago

Got it. Wow, that project looks cool. :)

pomplesiegel commented 5 years ago

OK I just figured out what is going on.

The TSL2591 wakes up if there is any activity on the i2c bus, even if that activity has nothing to do with the TSL2591. Therefore, the TSL2591 must be the last thing put to sleep on the entire i2c bus.

This is a seriously restrictive behavior, as imagine if two separate IC manufacturers had this restriction on their devices - it would be impossible to put both to sleep, as you would be playing an endless game of whack-a-mole trying to put each device to sleep.

However, if the TSL2591 is the last device put to bed, the current consumption is as advertised: 2-3uA.

SimonMerrett commented 5 years ago

OK I just figured out what is going on.

Although I don't need this feature at the moment, I'm seriously impressed with your debugging! Thanks for letting everyone else know.

caternuson commented 5 years ago

@pomplesiegel Awesome info. Thanks for sharing it all here.

pomplesiegel commented 5 years ago

You got it, thanks everyone!

mikef137 commented 3 years ago

I'm a little late to the game here, but was just discovering the same in my circuit. Glad you were able to chase it down and save me a number of hours debugging. Thanks!