# TSL2561 Light Sensor Reading 65536

I tagged this post with “Arduino” though it doesn’t involve an Arduino, but rather a Feather Fona from Adafruit reading an TSL2561 Luminosity Sensor.

I had problems getting the Feather to cooperate with the COM port. All of that is documented over at Adafruit so I won’t go into it. But I also had a problem with reading the sensor itself.

Running the example code from their Github page, I would either see nothing returned in the serial console, or it would simply repeat “65536 lux,” which should indicate a saturated sensor (too much light), which couldn’t have been the case.

Light Sensor Test

------------------------------------
Sensor:       TSL2561
Driver Ver:   1
Unique ID:    12345
Max Value:    17000.00 lux
Min Value:    0.00 lux
Resolution:   1.00 lux
------------------------------------

------------------------------------
Gain:         16
Timing:       401 ms
------------------------------------

65536 lux
65536 lux
65536 lux
65536 lux
65536 lux
65536 lux
65536 lux
65536 lux
65536 lux

I tried all combinations of gain and integration timing, none of which had any real effect on the problem. While troubleshooting, I came across this archived Reddit article and the nugget I found was the post on 8 June, 2016 (the last post in the thread). The comment references the i2c scanner sketch, something I’ve since added to my Arduino tool kit. That sketch will scan for and identify the address of any i2c device that is properly connected to the controller. Using that sketch I was able to verify that the sensor was properly connected and addressed but that gave me the idea to test changing the address and low-and-behold simply by using a different i2c address fixed the problem and the controller started reporting better numbers for lux. It turns out the SIM800h in the Feather Fona also uses i2c so there must have been a conflict. Interestingly, the scanner sketch didn’t detect the SIM800…

If you need to implement this fix, don’t forget to change the sketch to reflect the hardware change. I connected the Addr pin on the sensor to ground and made the following change to the sketch, basically changing TSL2561_ADDR_FLOAT to TSL2561_ADDR_LOW:

Adafruit_TSL2561_Unified tsl = Adafruit_TSL2561_Unified(TSL2561_ADDR_LOW, 12345);