Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Negative lx values #24

Closed
systembolaget opened this issue Jul 21, 2018 · 11 comments
Closed

Negative lx values #24

systembolaget opened this issue Jul 21, 2018 · 11 comments

Comments

@systembolaget
Copy link

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.

@NuclearPhoenixx
Copy link
Contributor

NuclearPhoenixx commented Jul 22, 2018

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! 👍

@systembolaget
Copy link
Author

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.

@Rvice
Copy link

Rvice commented Aug 13, 2018

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

@NuclearPhoenixx
Copy link
Contributor

That's good to know, thanks! Have to have a look at that 👍

@SimonMerrett
Copy link

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.

@SimonMerrett
Copy link

In support of:

the datasheet and found one from 2013 and the max adc count was 37888, not 36XXX.

image

@Rvice
Copy link

Rvice commented Feb 22, 2019

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.

@mishave
Copy link

mishave commented Oct 19, 2020

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,

@Rvice
Copy link

Rvice commented Oct 19, 2020

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

@smnmsr
Copy link
Contributor

smnmsr commented Feb 12, 2021

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.

@caternuson
Copy link
Contributor

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:
#14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants