Git Product home page Git Product logo

Comments (11)

CaptainMack avatar CaptainMack commented on June 30, 2024 1

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.

microbuilder avatar microbuilder commented on June 30, 2024 1

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.

SimonMerrett avatar SimonMerrett commented on June 30, 2024 1

Not sure on the attitude to cross-posting here but this may help someone. adafruit/Adafruit_CircuitPython_TSL2591#7 (comment)

from adafruit_tsl2591_library.

janscience avatar janscience commented on June 30, 2024 1

@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.

microbuilder avatar microbuilder commented on June 30, 2024

Fixed with 2b3b098 ... thanks for taking the time to suggest an improvement here!

from adafruit_tsl2591_library.

NuclearPhoenixx avatar NuclearPhoenixx commented on June 30, 2024

Also still having negative lux results in low light environments with calculateLux and normal gain and timing.

from adafruit_tsl2591_library.

systembolaget avatar systembolaget commented on June 30, 2024

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.

microbuilder avatar microbuilder commented on June 30, 2024

Reopening this issue until the related issue is also resolved since this is still an open question.

from adafruit_tsl2591_library.

microbuilder avatar microbuilder commented on June 30, 2024

@SimonMerrett All good, and you're right to cross post here, thanks again.

from adafruit_tsl2591_library.

TCIII avatar TCIII commented on June 30, 2024

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.

Llamero avatar Llamero commented on June 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.