Comments (11)
I am unsure if this actually fixes it, as I'm using the current calculation and still get the 65535 (negative number in an unsigned int). However, I am unsure if this can be related to another error (where it jumps from 0 to 65535) and the sensor has to be sampled more than 2 times.
from adafruit_tsl2591_library.
Please see my somewhat gigantic response to the lux issue here: adafruit/Adafruit_CircuitPython_TSL2591#7 (comment)
I've tried to dig into this, and put some theory down and separate photometric units (illuminance measure in lux, based an an estimation of human vision) from radiometric units (irradiance), and show how the two are mapped based on the CIE 1931 luminous functions, but the final conversion coefficients are still a WIP. :(
If possible, maybe the conversation should be continued there just to have everything in one place?
from adafruit_tsl2591_library.
Not sure on the attitude to cross-posting here but this may help someone. adafruit/Adafruit_CircuitPython_TSL2591#7 (comment)
from adafruit_tsl2591_library.
@Llamero is right, there is no common solution. The TSL2591 needs to be calibrated for specific light sources. Somebody with a Lux-meter should do this.
The @iquizzle approach, that is currently implemented in the library cannot be right.
If you take this equation
lux = ( ch0 - ch1) * (1 - ch1/ch0 ) / cpl
and multiply it out you get
lux =( ch0 - 2 * ch1 - ch1*ch1/ch0 ) / cpl
There are two problems with this:
- division by zero if the ch0 reading is zero
- ch1 enters this equation squared (last term). This can not be right. From all the documents provided by AMS lux should be proportional to ch0 and ch1, no squares.
from adafruit_tsl2591_library.
Fixed with 2b3b098 ... thanks for taking the time to suggest an improvement here!
from adafruit_tsl2591_library.
Also still having negative lux results in low light environments with calculateLux
and normal gain and timing.
from adafruit_tsl2591_library.
At MID and LOW gain, and matching integration times, briefly shadowing the sensor still returns negative numbers. A slow EMA filter will often prevent this from happening, but when one changes gain/integration time on the fly with a button, the sensor restarts often with large negative values returned. Ironically, the old TSL2561 fares better here.
from adafruit_tsl2591_library.
Reopening this issue until the related issue is also resolved since this is still an open question.
from adafruit_tsl2591_library.
@SimonMerrett All good, and you're right to cross post here, thanks again.
from adafruit_tsl2591_library.
I recently purchased two of the Adafruit tsl2591 modules to be able to determine sunlight lux levels for a two axes solar tracker. Since the tsl2591 will saturate beyond 88,000 lux and direct, bright sunlight can reach lux levels well beyond 132,000 lux, I determined that a 1/32 thick piece of Teflon would provide sufficient attenuation so that the tsl2591 would not go into saturation.
Using my attenuator and a wide range light meter calibrated to a secondary source traceable to NIST, I determined that I needed a multiplication factor of ~4 when using the attenuator. However as was documented above, I would get an occasional negative lux reading and the sensor would output readings over 200,000 lux during sun to cloud to sun transitions when using the "advancedRead subroutine to read the lux level from the sensor.
Finally I decided to try the "unifiedSensorAPIRead" subroutine to read the lux level from the sensor. During the first sensor lux level reading in bright sunlight, the sensor lux level reading was within 1,000 lux of my calibrated light meter and in cloudy/diffuse sunlight, the reading was within 500 lux of the calibrated light meter. On a fully sunny day with no clouds, I plan to plot sensor/light meter data points every hour from sunrise to near sunset and perform a retrogression calculation to determine a best fit curve for the tsl2591 sensor and make any necessary adjustments to my attenuator multiplication factor.
Bottom line here is that the "Unified Sensor API" routine should be looked at so as to determine why its accuracy and consistency seems to be much better than the "Advanced Read" routine.
from adafruit_tsl2591_library.
No need to reinvent the wheel; AMS provides datasheets on how to improve the accuracy of the sensor, even providing calibration software to calculate the coefficients: https://ams.com/tsl25911#tab/documents
Specifically, this is a good place to start: https://ams.com/documents/20143/36005/AmbientLightSensors_AN000173_2-00.pdf/ce3360f8-fb85-bc22-0bad-b60d3b31efc8
Note that there is no one size fits all equation, as it is dependent on the type of light you expect to encounter.
from adafruit_tsl2591_library.
Related Issues (20)
- No need to wait for Wire.available(). HOT 1
- raspberry pi/ python version HOT 4
- Serial.print of Thresholds with wrong values in tsl2591_interrupt.ino HOT 1
- Interrupt not working HOT 7
- fix for IR gain 'stale' data HOT 1
- tsl2591.begin() detection issue. HOT 2
- [SOLVED] TSL2591 jumps from 0 to 65535 (saturation?) HOT 3
- Inaccurate sensor information HOT 9
- Negative lx values HOT 11
- 100uA measured sleep current != datasheet 2.3uA HOT 20
- allow for 'non-blocking' read of values
- Confusing defines HOT 1
- Error compiling for board Arduino Nano 33 BLE HOT 1
- begin() doesn't return status HOT 3
- 180uLux to 88000 Lux HOT 1
- Convert to BusIO usage HOT 1
- Resolution HOT 1
- lux calculation improvement
- Support for (non persist) interrupts
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adafruit_tsl2591_library.