TSL25911 Light Sensor

From Waveshare Wiki
Revision as of 04:54, 31 October 2019 by Eng26 (talk | contribs)
Jump to: navigation, search
TSL25911 Light Sensor
Ambient Light Detecting
TSL25911-Light-Sensor-1.jpg

Light Sensor, detects the ambient light intensity, I2C interface
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

Introduction

This module is an ambient light sensor with TSL25911 as its core. It can sense the ambient light intensity around and output it through the I2C interface. The output data uses a formula to derive the illuminance in lux (ambient light intensity) to approximate the human eye response.

More

Specifications

  • Light sensor: TSL25911FN
  • Communication interface: I2C (constant address: 0x29)
  • Effective range: 0~88000Lux
  • Operating voltage: 3.3V/5V
  • Dimensions: 27mm × 20mm
  • Mounting hole size: 2.0mm

Pinouts

VCC 3.3V / 5V
GND GND
SDA MCU.I2C data line
SCL MCU.I2C clock line
INT interrupt output, optional

Hardware Description

Chip

This product uses TSL25911FN, which is a light intensity digitizer based on IIC bus communication. The sensor combines a wideband photodiode (visible and infrared) and an infrared response photodiode on a single CMOS integrated circuit that provides near-light adaptive response over an effective 16-bit dynamic range (16-bit resolution). Two integral ADCs convert the photodiode current into a digital output representing the irradiance measured on each channel. The digital output can be inputted to a microprocessor where an empirical formula is used to derive illuminance in lux (ambient light level) to approximate the human eye response.

Timing analysis

TSL2591 use I2C interface, has a data line and a clock signal line. There are three types of signals will be used during the I2C bus data transmissing. They are Start signal, Stop signal, and Ack signal. File:Example.jpg Start signal: When SCL is HIGH and SDA jumps from HIGH to LOW, the data transmission starts. Stop signal: When SCL is HIGH and SDA jumps from LOW to HIGH, the data transmission stops. Ack signal: When the receiver IC have received 8 bit of data, it will send out a special LOW level pulse to the transmitter IC to indicate that the data have been received.

I2C Write

File:Example.jpg At the beginning, the Host (here is STM32, and we will call it the Host hereafter) sends out a start signal, and combines the 7 bit of I2C slave address with the Write bit, then, sends this 8 bit of data to the Slave (here is TSL2581 sensor, and we will refer it to the Slave hereafter). Then, the Slave sends back an ACK signal when it has received the data. The Host transmits the slave address of the command register to the Slave as soon as it received the ACK signal. And the Slave responds an ACK signal when it has received the slave address. By following, the Host sends the data to the Slave. And the Slave responds an ACK signal once again. The I2C writing operation will be continued till the Host sends out a stop signal.

I2C Read

File:Example.jpg At the beginning, the Host sends out a start signal, and combines the 7 bit of I2C slave address with the Write bit, then, sends this 8 bit of data to the Slave. Then, the Slave sends back an ACK signal when it has received the data. The Host transmits the slave address of the command register to the Slave as soon as it received the ACK signal. And the Slave responds an ACK signal when it has received the slave address. At this moment, the Host sends out a start signal once again, and combines its 7 bit of slave address with Read bit, then, sends this 8 bit data to the Slave. And then, the Slave responds an ACK signal to the Host when it has received the data, and sends out the data stored in the Slave register to the Host. The Host sends back an ACK signal as soon as it received the value. The I2C communication will be continued, till the Host sends out a stop signal.

I2C address

The I2C address of the TSL25911 is as follows: 0x29

File:Example.jpg


P28 of the TSL25911 datasheet Note: The device address of 0x29 is 7 bits, and the 8-bits device address required to be shifted to 0x52 by moving 1 bit to high position.

Raspberry Pi application

Raspberry Pi provides C and python examples

Open the I2C

Open the terminal and execute the code as follow :

sudo raspi-config 
Select Interfacing Options -> i2c-> yes to start the I2C  driver

File:Example.jpg File:Example.jpg File:Example.jpg

Then restart Raspberry Pi:

sudo reboot

Install Libraries

  • Install BCM2835
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.60.tar.gz
tar zxvf bcm2835-1.60.tar.gz 
cd bcm2835-1.60/
sudo ./configure
sudo make
sudo make check
sudo make install
# For more code, please refer to our official website http://www.airspayce.com/mikem/bcm2835/
  • Install wiringPi
sudo apt-get install wiringpi
#For Raspberry Pi 4B, an upgrade may be required:
cd /tmp
wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb
gpio -v
#Running gpio -v will appear version 2.52. If not, the installation is wrong.


Resources

FAQ

Support

Support

If you require technical support, please go to the Support page and open a ticket.