Closed systembolaget closed 10 months ago
Yeah, I observed this annoying behaviour too. Need to reasearch a bit more about how the lightsensor works and how the registers work together in cases like overflows. Help is greatly appreciated! :+1:
I put an EMA filter on the value, so a brief near total shadowing won't contaminate the output with negative values, but that is no proper solution.
There's an additional problem missing in this library for sensor saturation/overflow. See https://github.com/adafruit/Adafruit_CircuitPython_TSL2591/pull/6 for the overflow/saturation catch.
Also, there's another issue about which equation is used across projects. https://github.com/adafruit/Adafruit_CircuitPython_TSL2591/issues/7
That's good to know, thanks! Have to have a look at that :+1:
I have been playing with the dynamic configuration of the integration and gain registers. Initial observations (I'm using the arduino cpp not circuit python) are that consecutively increasing the values of gain and integration time works but decrementing back through them produces way fewer valid (in-range) readings. One more quick observation is that negative lux values only happen if ir > full, so you can add that check in before it returns a lux value, a bit like the register overflow check. Also, on the 100ms integration max adc count, I googled the datasheet and found one from 2013 and the max adc count was 37888, not 36XXX. Checked my breakout from 2014-15 and it spits out 37888 so just be aware there may be hardware differences out there.
In support of:
the datasheet and found one from 2013 and the max adc count was 37888, not 36XXX.
I have been playing with the dynamic configuration of the integration and gain registers. Initial observations (I'm using the arduino cpp not circuit python) are that consecutively increasing the values of gain and integration time works but decrementing back through them produces way fewer valid (in-range) readings. One more quick observation is that negative lux values only happen if ir > full, so you can add that check in before it returns a lux value, a bit like the register overflow check. Also, on the 100ms integration max adc count, I googled the datasheet and found one from 2013 and the max adc count was 37888, not 36XXX. Checked my breakout from 2014-15 and it spits out 37888 so just be aware there may be hardware differences out there.
It's been awhile since I was testing our hardware, but the 37888 number sounds familiar as output from the sensor. The 36XXX number is more conservative to capture an overflow (and in-line with the newer DS). Given the Lux conversion is still getting hashed out in another issue, I'm not sure what the ~1000 counts difference will make.
Was this issue ever fixed? Currently having the same issue using Arduino. I'm trying to measure an LED light and when I reach ~2800 Lux it reads as -1Lux. Sample below of a good reading: "lux": 2217.953, "ir": 12738, "full": 50962, "vis": 63700 and of a bad reading: "lux": -1, "ir": 12840, "full": 52695, "vis": 65535,
Was this issue ever fixed? Currently having the same issue using Arduino. I'm trying to measure an LED light and when I reach ~2800 Lux it reads as -1Lux. Sample below of a good reading: "lux": 2217.953, "ir": 12738, "full": 50962, "vis": 63700 and of a bad reading: "lux": -1, "ir": 12840, "full": 52695, "vis": 65535,
Take a look at these posts as the negative values should get corrected here: There's an additional problem missing in this library for sensor saturation/overflow. See adafruit/Adafruit_CircuitPython_TSL2591#6 for the overflow/saturation catch.
Also, there's another issue about which equation is used across projects. adafruit/Adafruit_CircuitPython_TSL2591#7
Was this issue ever fixed? Currently having the same issue using Arduino. I'm trying to measure an LED light and when I reach ~2800 Lux it reads as -1Lux. Sample below of a good reading: "lux": 2217.953, "ir": 12738, "full": 50962, "vis": 63700 and of a bad reading: "lux": -1, "ir": 12840, "full": 52695, "vis": 65535,
the method where the lux value is calculated returns -1 if one of the number arguments is equal to 0xFFFF which is 65535. This means, that there is an overflow and that you have to reduce either the sensitivity or the integration time.
Closing. This may have been fixed by some of the lux updates. Could not easily recreate it running current library code at lowest gain and integration time and holding finger over sensor.
But also, the computation of lux for the TSL2591 is a point of discussion. This library implements something, but it may not be the best something. Lots of discussion here: https://github.com/adafruit/Adafruit_TSL2591_Library/issues/14
It seems that the problem is not yet solved.
In low-lighting conditions (early evening office space, home dining room, etc.), simply waving one's hand at one foot distance (and shorter) produces negative lx values.