TSL2591X Light Sensor
- 1 Introduction
- 2 Features
- 3 Specifications
- 4 Connection Diagram
- 5 Raspberry Pi application
- 6 STM32 application
- 7 Arduino
- 8 Resources
The ambient light sensor can sense the surrounding light conditions and tell the processing chip to automatically adjust the brightness of the display backlight to reduce the power consumption of the product. For example, in handheld applications such as mobile phones, notebooks, GPS and other mobile devices, the display consumes up to 30% of the total battery power, and the use of ambient light sensors can maximize the battery's working time.
CQRTSL25911 Ambient light sensor integrates TSL25911FN chip, measures infrared plus visible light (wider range than TSL2561), features 600M: 1 wide dynamic range, Detects Light Intensity up to 88000Lux (Bright Sunlight), Controlled via I2C Interface, low power consumption. It is capable of operating across various light environment. Onboard voltage translator, compatible with 3.3V/5V operating voltage, Compatible with Raspberry Pi, Arduino, STM32 and other motherboards.
- Adopts TSL25911FN, measures infrared plus visible light (wider range than TSL2561)
- Embedded ADC, direct light intensity signal output to I2C interface, less noise jamming
- High sensitivity up to 188uLux, wide dynamic range up to 600M:1
- Embedded infrared-responding photodiode, allows precise measuring even on strong infrared noise environment
- Provides interrupt output with programmable upper and lower thresholds
- Onboard voltage translator, compatible with 3.3V/5V operating voltage
- Comes with development resources and manual (examples for Raspberry Pi/Arduino/STM32)
- Model: CQRTSL25911
- Light sensor: TSL25911FN
- Communication interface: I2C (constant address: 0x29)
- Effective range: 0 to 88000Lux (Bright Sunlight)
- Operating voltage: 3.3V/5V
- Dimensions: 28mm * 28mm
- Mounting hole size: 3.0mm
Raspberry Pi application
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
- Then restart Raspberry Pi:
- Install BCM2835 libraries
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 libraries
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.
|TCS34725 Color Sensor||Raspberry Pi（BCM）|
Download and run the test examples
sudo apt-get install p7zip-full 7z x TSL2591X_Light_Sensor_code.7z -r -o./TSL2591X_Light_Sensor_code sudo chmod 777 -R TSL2591X_Light_Sensor_code
- C code
cd c make clean make sudo ./main
- Python code
cd python sudo python main.py
Download the example from Waveshare Wiki and unzip it. The STM32 projects are located at the path ~/STM32/… Open \XNUCLEO-F103RB\MDK-ARM\demo.uvprojx project with Keil uVision5.
The example is based on HAL library. The development board used for the test is XNUCLEO-F103RB of Waveshare, wich chip is STM32F103RBT6.
If you want to port the examples for other STM32 chip, or change to standard libraries, you can only modify the DEV_Config.c and .h files to implement the functions and acro definitions. You can also use STM32CubeMX to port example. The example uses UART3 (PA3, PA3) to output debug information. It is set to 115200, 8N1.
The connection is shown in the following table:
|TCS34725 Color Sensor||STM32|
Download the example from Waveshare Wiki and unzip it. The Arduino projects are located at the path ~/Arduino/…
Copy the folder in the Arduino directory to the library in the Arduino installation directory.
Open the Arduino IDE: Click File-> Example to see if there is a TSL25911 option.
If so,the library is imported successful, open TSL25911-demo, select the corresponding COM port, download it to UNO, open the serial monitor, and check the data outputed.
|TCS34725 Color Sensor||Arduino|