How to use multiple Adafruit TSL2591 light sensors with teensy 3.2?

Status
Not open for further replies.

XRAD

Well-known member
Hello all,

Issue: The adafruit TSL2591 light sensor has a I2C address (0x29) which 'cannot' be changed. Is it possible through code (basically not creating a hardware switch on SCL or SDA) to chain x2 of these sensors on a single interface (pins 16/17) without a multiplexer? The reason I ask is because, although the data may be different at different times on the address , or same at same time on the address, the end result in the code is to asses for a change in data and not which sensor saw it......

I am aware that the T3.2 has wire and wire1....And if I used wire for one TSL2591 and wire1 for the other, would there still be conflict? (i would think not as these are separate interfaces...?)

I am aware that I can add a multiplexer....

Thank you for any input!
 
Last edited:
Issue: The adafruit TSL2591 light sensor has a I2C address (0x29) which 'cannot' be changed. Is it possible through code to chain x2 of these sensors on a single interface (pins 16/17) without a multiplexer? The reason I ask is because, although the data may be different at different times on the address , or same at same time on the address, the end result in the code is to asses for a change in data and not which sensor saw it......
NO!
Use multiple I2C ports for multiple TSL2591.
 
The hardware switch can also be a simple transistor for the clock line, which enables/disables the clock for each sensor... but for two sensors onyl, it makes mores ense to just use the Teensys both i2c interfaces
 
THX for replies! but here is the interesting thing, x2 light sensors connected to one I2C port produce 'one' data chain(no mux)..without crashing..... If I light one sensor, or the other, or shade one sensor, or the other, the output remains stable and looks like only 'one' sensor reading.. which is maybe OK for my project..but not sure how it is working.... interesting...

Frank: Is it better to disable the clock, or the data line?

bmp description: low numbers are recorded when I shade one sensor, then I shade the other.....they are acting as one sensor....
Note: three sensors do not work..but two work...

x2 light sensors.jpg
 
Last edited:
The open collector I2C bus with pullups acts as a wired AND or wired NOR. Each device can turn ones into zero's but cannot change zero's into ones. You will never get the actual correct reading with them both tied together. Any bit low on either sensor will result in that bit being low in your result.
 
The open collector I2C bus with pullups acts as a wired AND or wired NOR. Each device can turn ones into zero's but cannot change zero's into ones. You will never get the actual correct reading with them both tied together. Any bit low on either sensor will result in that bit being low in your result.

so each slave can pull the data line collector LOW? and thereby causing the master to go LOW...? and then does data pass from both slaves....?
I have more reading to do..

Thank you for reply!!
 
so each slave can pull the data line collector LOW? and thereby causing the master to go LOW...? and then does data pass from both slaves....?
I have more reading to do..

Yes from the results you are getting, both slaves are responding to the read command at the same time. If it were 8 bit data and the true reading of unit 1 was 0xF1 and the true reading of unit 2 was 0x0F, then when read together you would read 0x01 ( the only bit that is high in both ).
 
Yes from the results you are getting, both slaves are responding to the read command at the same time. If it were 8 bit data and the true reading of unit 1 was 0xF1 and the true reading of unit 2 was 0x0F, then when read together you would read 0x01 ( the only bit that is high in both ).

Thank you rcarr!! very helpful, yes the LUMINOSITY data is 8 bit....and I did mux the TSL sensors, and the readings are very different (which I guess could be calculated out in the bit changes) , although the data 'change' (not data accuracy) of each each 'EYE' remains similar...

this should be a cool project. Thanks again for forum's help!

accurate data now
MUX1.jpg
 
Thank you rcarr!! very helpful, yes the LUMINOSITY data is 8 bit....and I did mux the TSL sensors, and the readings are very different (which I guess could be calculated out in the bit changes) , although the data 'change' (not data accuracy) of each each 'EYE' remains similar...

this should be a cool project. Thanks again for forum's help!

accurate data now
View attachment 26690

EDIT:
yes the LUMINOSITY data is 16 bit....
 
Status
Not open for further replies.
Back
Top