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

RuntimeError: Overflow reading light channels! could maybe suggest lowering the gain #20

Closed
jedgarpark opened this issue Mar 2, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@jedgarpark
Copy link

Sample code is at 25x gain so a decent flashlight will exceed the light level pretty easily and crash the program with the error https://learn.adafruit.com/adafruit-tsl2591/python-circuitpython#full-example-code-2997857-15
Perhaps the error could let the user know to lower the gain?

@jposada202020
Copy link
Contributor

Confirmed the behaviour described here. tested in

Adafruit CircuitPython 6.2.0-beta.3-188-g05ed179e1 on 2021-03-15; Adafruit Feather RP2040 with rp2040

Problem gets solved when using GAIN_LOW

@jposada202020
Copy link
Contributor

Solved in #21. Thanks. Closing

@averter
Copy link

averter commented Jun 13, 2023

The message is helpful, but my tsl2591 is under direct sunlight with GAIN_LOW and INTEGRATIONTIME_100MS and the code keeps crashing... With this configuration isn't this sensor supposed to work even under these extreme light conditions? I'm copying my code below for reference.

import board
import adafruit_tsl2591
import time
import requests
i2c = board.I2C()
sensor = adafruit_tsl2591.TSL2591(i2c)
sensor.gain = adafruit_tsl2591.GAIN_LOW
sensor.integration_time = adafruit_tsl2591.INTEGRATIONTIME_100MS
READING_DELAY = 1
time.sleep(READING_DELAY)
print(sensor.lux)

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

No branches or pull requests

3 participants