Reading TSL2591 sensor data using I2C

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi all,

   

Can anyone help me with the code to read sensor data from TSL2591 light sensor using I2C communication. 

   

Any suggestion in this direction would be helpful.

   

Thank you in advance.

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Use an I2C component as master and address your slave as 0x29 as shown in the TSL2591 datasheet.

   

Initialize the device by writing into the appropriate registers.

   

Typical sequence for reading from I2C is

   

Sendstart() to initialize a transmission

   

WriteByte() to indicate which internal register to read

   

SendRestart() now indicate reading

   

ReadByte() The last byte read must be NAKed to tell slave that transfer is done

   

SendStop() to telease the bus

   

 

   

Happy coding

   

Bob

View solution in original post

0 Likes
2 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Use an I2C component as master and address your slave as 0x29 as shown in the TSL2591 datasheet.

   

Initialize the device by writing into the appropriate registers.

   

Typical sequence for reading from I2C is

   

Sendstart() to initialize a transmission

   

WriteByte() to indicate which internal register to read

   

SendRestart() now indicate reading

   

ReadByte() The last byte read must be NAKed to tell slave that transfer is done

   

SendStop() to telease the bus

   

 

   

Happy coding

   

Bob

0 Likes
Anonymous
Not applicable

Thank you Bob 🙂

0 Likes