Difference between revisions of "TSL25911 Light Sensor"
(50 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
− | {{Infobox item| | + | <font size="4px"> |
+ | <div class="wiki-pages jet-green-color"> | ||
+ | {{Infobox item| | ||
|brief=Ambient Light Detecting | |brief=Ambient Light Detecting | ||
− | |img=[[File:TSL25911-Light-Sensor-1.jpg|300px|link=https://www.waveshare.com | + | |img=[[File:TSL25911-Light-Sensor-1.jpg|300px|{{Amazon_nolink|default={{#ifeq: {{#urlget:amazon|0}}|{{#urlget:Amazon|0}}| default|}}|url=link=https://www.waveshare.com/tsl25911-light-sensor.htm}}]] |
|caption=Light Sensor, detects the ambient light intensity, I2C interface | |caption=Light Sensor, detects the ambient light intensity, I2C interface | ||
|category=[[:Category:Sensors|Sensors]], [[:Category:Light|Light]] | |category=[[:Category:Sensors|Sensors]], [[:Category:Light|Light]] | ||
|brand=Waveshare | |brand=Waveshare | ||
− | |{{#urlget:amazon|default}}=display | + | |{{#ifeq: {{#urlget:amazon|0}}|{{#urlget:Amazon|0}}| default|}}=display |
|website_cn=[http://www.waveshare.net/shop/TSL25911-Light-Sensor.htm 网站] | |website_cn=[http://www.waveshare.net/shop/TSL25911-Light-Sensor.htm 网站] | ||
|website_en=[https://www.waveshare.com/product/modules/sensors/light/tsl25911-light-sensor.htm Website] | |website_en=[https://www.waveshare.com/product/modules/sensors/light/tsl25911-light-sensor.htm Website] | ||
Line 12: | Line 14: | ||
{{Product List|Modules/Sensors/Light}} | {{Product List|Modules/Sensors/Light}} | ||
}} | }} | ||
− | + | = 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. | 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. | ||
− | {{Amazon|{{#urlget:amazon|default}}=display | + | {{Amazon|{{#ifeq: {{#urlget:amazon|0}}|{{#urlget:Amazon|0}}| default|}}=display |
|More =[https://www.waveshare.com/product/modules/sensors/light/tsl25911-light-sensor.htm More]}} | |More =[https://www.waveshare.com/product/modules/sensors/light/tsl25911-light-sensor.htm More]}} | ||
+ | |||
+ | ==Feature== | ||
+ | *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 in strong infrared noise environments. | ||
+ | *Provides interrupt output with programmable upper and lower thresholds. | ||
+ | *Onboard voltage translator, compatible with 3.3V/5V operating voltage. | ||
+ | *Comes with online development resources and a manual (examples for Raspberry Pi/Arduino/STM32). | ||
==Specifications== | ==Specifications== | ||
*Light sensor: TSL25911FN | *Light sensor: TSL25911FN | ||
− | *Communication interface: I2C (constant address: | + | *Communication interface: I2C (constant address: 0 x 29) |
*Effective range: 0~88000Lux | *Effective range: 0~88000Lux | ||
*Operating voltage: 3.3V/5V | *Operating voltage: 3.3V/5V | ||
Line 26: | Line 37: | ||
==Pinouts== | ==Pinouts== | ||
− | {|border=2; style="width: | + | {|border=2; style="width:600px;" |
|-style="background:#eeeeff; color:black;" align="center" | |-style="background:#eeeeff; color:black;" align="center" | ||
|Pin||Instruction | |Pin||Instruction | ||
Line 43: | Line 54: | ||
==Hardware Description== | ==Hardware Description== | ||
===Chip=== | ===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. | + | 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 a 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=== | ===Timing analysis=== | ||
− | TSL2591 | + | TSL2591 uses an I2C interface and has a data line and a clock signal line. There are three types of signals will be used during the I2C bus data transmission. They are the Start signal, Stop signal, and Ack signal.<br/> |
[[File:TSL25911 Light Sensor-1.png|400px]]<br/> | [[File:TSL25911 Light Sensor-1.png|400px]]<br/> | ||
Start signal: When SCL is HIGH and SDA jumps from HIGH to LOW, the data transmission starts. | 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. | Stop signal: When SCL is HIGH and SDA jumps from LOW to HIGH, the data transmission stops. | ||
− | Ack signal: When the receiver IC | + | Ack signal: When the receiver IC has received 8 bits 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==== | ====I2C Write==== | ||
[[File:TSL25911 Light Sensor-2.png|600px]]<br/> | [[File:TSL25911 Light Sensor-2.png|600px]]<br/> | ||
− | + | In 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 these 8 bits 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 receives the ACK signal. The Slave responds to an ACK signal when it has received the slave address. By following, the Host sends the data to the Slave. And the Slave responds with an ACK signal once again. The I2C writing operation will be continued till the Host sends out a stop signal. | |
====I2C Read==== | ====I2C Read==== | ||
[[File:TSL25911 Light Sensor-3.png|600px]]<br/> | [[File:TSL25911 Light Sensor-3.png|600px]]<br/> | ||
− | + | In the beginning, the Host sends out a start signal, and combines the 7 bits of I2C slave address with the Write bit, then, sends these 8 bits 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 receives the ACK signal. The Slave responds to 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 bits of slave address with Read bit, then, sends this 8 bits data to the Slave. And then, the Slave responds to 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 receives the value. The I2C communication will be continued, till the Host sends out a stop signal. | |
====I2C address==== | ====I2C address==== | ||
− | The I2C address of the TSL25911 is as follows: | + | The I2C address of the TSL25911 is as follows: 0x29 |
− | 0x29 | ||
− | [[File:TSL25911 Light Sensor-4.png|600px]]<br/> | + | [[File:TSL25911 Light Sensor-4.png|600px]]<br/> |
+ | P28 of the TSL25911 datasheet<br/> | ||
+ | <font color="#ff0000">Note: The device address of 0x29 is 7 bits, and the 8-bit device address required to be shifted to 0x52 by moving 1 bit to a high position.</font> | ||
− | + | ==Raspberry Pi Application== | |
− | |||
− | |||
− | |||
− | ==Raspberry Pi | ||
− | |||
===Open the I2C=== | ===Open the I2C=== | ||
− | Open the terminal and execute the code as follow :<br/> | + | *Open the terminal and execute the code as follow:<br/> |
+ | <pre> | ||
sudo raspi-config | sudo raspi-config | ||
Select Interfacing Options -> i2c-> yes to start the I2C driver | Select Interfacing Options -> i2c-> yes to start the I2C driver | ||
+ | </pre> | ||
[[File:TSL25911 Light Sensor-5.png|600px]]</br> | [[File:TSL25911 Light Sensor-5.png|600px]]</br> | ||
− | + | *Then restart Raspberry Pi:<br/> | |
− | Then restart Raspberry Pi:<br/> | + | <pre> |
sudo reboot | sudo reboot | ||
− | + | </pre> | |
− | ===Install | + | ===Install libraries=== |
− | *Install BCM2835 | + | *Install BCM2835 libraries |
+ | <pre> | ||
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.60.tar.gz | wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.60.tar.gz | ||
tar zxvf bcm2835-1.60.tar.gz | tar zxvf bcm2835-1.60.tar.gz | ||
Line 91: | Line 101: | ||
sudo make install | sudo make install | ||
# For more code, please refer to our official website http://www.airspayce.com/mikem/bcm2835/ | # For more code, please refer to our official website http://www.airspayce.com/mikem/bcm2835/ | ||
− | + | </pre> | |
− | *Install wiringPi | + | *Install wiringPi libraries |
+ | <pre> | ||
sudo apt-get install wiringpi | sudo apt-get install wiringpi | ||
#For Raspberry Pi 4B, an upgrade may be required: | #For Raspberry Pi 4B, an upgrade may be required: | ||
Line 100: | Line 111: | ||
gpio -v | gpio -v | ||
#Running gpio -v will appear version 2.52. If not, the installation is wrong. | #Running gpio -v will appear version 2.52. If not, the installation is wrong. | ||
+ | </pre> | ||
− | === | + | ===Hardware connection=== |
− | |||
{|border=2; style="width:500px;" | {|border=2; style="width:500px;" | ||
|-style="background:#009955; color:white;" align="center" | |-style="background:#009955; color:white;" align="center" | ||
Line 116: | Line 127: | ||
|-align="center" | |-align="center" | ||
|INT||4 | |INT||4 | ||
− | |} | + | |}<br />[[File:TSL25911-Pi-WS.jpg|900px]] |
===Download and run the test examples=== | ===Download and run the test examples=== | ||
+ | |||
+ | <pre> | ||
sudo apt-get install p7zip-full | sudo apt-get install p7zip-full | ||
− | wget | + | wget https://files.waveshare.com/upload/b/bc/TSL2591X_Light_Sensor_code.7z |
7z x TSL2591X_Light_Sensor_code.7z -r -o./TSL2591X_Light_Sensor_code | 7z x TSL2591X_Light_Sensor_code.7z -r -o./TSL2591X_Light_Sensor_code | ||
sudo chmod 777 -R TSL2591X_Light_Sensor_code | sudo chmod 777 -R TSL2591X_Light_Sensor_code | ||
− | + | </pre> | |
− | You can clone the project on our | + | You can clone the project on our GitHub: |
+ | <pre> | ||
sudo git clone https://github.com/waveshare/TSL2591X-Light-Sensor | sudo git clone https://github.com/waveshare/TSL2591X-Light-Sensor | ||
− | + | </pre> | |
− | + | *C code | |
− | + | <pre> | |
− | + | cd TSL2591X_Light_Sensor_code/TSL2591x_Light_Sensor_code/RaspberryPi/c | |
− | + | make clean | |
− | + | make | |
− | + | sudo ./main | |
− | + | </pre> | |
− | + | Expected result<br/> | |
− | [[File:TSL25911 Light Sensor-7.png| | + | [[File:TSL25911 Light Sensor-7.png|600px]]<br/> |
− | < | + | *Python code |
− | + | <pre> | |
− | + | cd | |
− | + | cd TSL2591X_Light_Sensor_code/TSL2591x_Light_Sensor_code/RaspberryPi/python/examples | |
− | + | sudo python main.py | |
− | + | </pre> | |
− | + | Expected result<br/> | |
[[File:TSL25911 Light Sensor-8.png|600px]]<br/> | [[File:TSL25911 Light Sensor-8.png|600px]]<br/> | ||
− | ==STM32 | + | ==STM32 Application== |
− | |||
− | |||
+ | Download the example [[#Resources|here]] and unzip it. The STM32 projects are located at the path ~/STM32/… | ||
Open \XNUCLEO-F103RB\MDK-ARM\demo.uvprojx project with Keil uVision5. | 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, | + | The example is based on the HAL library. The development board used for the test is XNUCLEO-F103RB of Waveshare, whose chip is STM32F103RBT6. |
− | If you want to port the examples for other STM32 | + | If you want to port the examples for other STM32 chips 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. | + | You can also use STM32CubeMX to port an example. The example uses UART3 (PA3, PA3) to output debug information. It is set to 115200, 8N1. |
===Hardware connection=== | ===Hardware connection=== | ||
The connection is shown in the following table: | The connection is shown in the following table: | ||
− | {|border=2; style="width: | + | {|border=2; style="width:600px;" |
− | |-style="background: | + | |-style="background:green; color:white;" align="center" |
|TCS34725 Color Sensor||STM32 | |TCS34725 Color Sensor||STM32 | ||
|-align="center" | |-align="center" | ||
− | |VCC||3.3V | + | |width=300px|VCC||3.3V |
|-align="center" | |-align="center" | ||
|GND||GND | |GND||GND | ||
Line 169: | Line 182: | ||
|-align="center" | |-align="center" | ||
|INT||D8/PA9 | |INT||D8/PA9 | ||
− | |} | + | |}<br />[[File:TSL25911-STM32-WS.jpg|900px]] |
+ | |||
===Expected Result=== | ===Expected Result=== | ||
− | Open the serial port assistant software on the computer and select the corresponding port to check the output data | + | Open the serial port assistant software on the computer and select the corresponding port to check the output data: <br/> |
− | [[File:TSL25911 Light Sensor-9.png|600px]]</ | + | [[File:TSL25911 Light Sensor-9.png|600px]]<br/> |
==Arduino== | ==Arduino== | ||
− | + | Download the example [[#Resources|here]]. 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 successfully, open TSL25911-demo, select the corresponding COM port, download it to UNO, open the serial monitor, and check the data output. | ||
===Hareware connenction=== | ===Hareware connenction=== | ||
− | {|border=2; style="width: | + | {|border=2; style="width:600px;" |
− | |-style="background: | + | |-style="background:green; color:white;" align="center" |
− | |TCS34725 Color Sensor||Arduino | + | |width=300px|TCS34725 Color Sensor||Arduino |
− | |- | + | |-align="center" |
|VCC||3.3V/5V | |VCC||3.3V/5V | ||
− | |- | + | |-align="center" |
|GND||GND | |GND||GND | ||
− | |- | + | |-align="center" |
|SDA||SDA | |SDA||SDA | ||
− | |- | + | |-align="center" |
|SCL||SCL | |SCL||SCL | ||
− | |- | + | |-align="center" |
− | INT||D8 | + | |INT||D8 |
− | |} | + | |}<br />[[File:TSL25911-Arduino-WS.jpg|900px]] |
====Expected result==== | ====Expected result==== | ||
− | The figure below shows the data of the test: | + | The figure below shows the data of the test:<br/> |
− | |||
[[File:TSL25911 Light Sensor-10.png|600px]]<br/> | [[File:TSL25911 Light Sensor-10.png|600px]]<br/> | ||
+ | = Resources = | ||
+ | *[https://files.waveshare.com/upload/a/a2/Light-Sensor-Schematic.pdf Schematic] | ||
+ | *[https://files.waveshare.com/upload/1/14/TSL2591_Light_Sensor_code.7z Demo Code] | ||
+ | *[https://github.com/waveshare/TSL2591X-Light-Sensor Github] | ||
+ | *[https://files.waveshare.com/upload/3/31/TSL2591.pdf TSL2591 Datasheet] | ||
− | + | = FAQ = | |
− | + | {{FAQ|What happens if the Raspberry Pi is applied incorrectly? | |
− | + | |If the example of running the wiringPi is normal, then running Python or BCM2835 may refresh the screen abnormally, Because the library of bcm2835 is the library function of the Raspberry Pi CPU, operating register directly. The bottoms of the wiringPi library and python are to read and write Linux system device files to opera devices, which may cause the GPIO port to be abnormal. Restart the Raspberry Pi to solve the problem perfectly.}} | |
− | + | {{FAQ|STM32 and Arduino examples serial output have no data or data output garbled? | |
− | + | |Make sure that is it the baud rate set to 115200. For the STM32 examples, make sure that the computer is connected to the development board USART2 (PA2, PA3) properly, PA2 is TXD. And select the correct COM port:Control Panel -> Hardware -> Device Manager.<br/> | |
− | + | [[File:TSL25911 Light Sensor-11.png|400px]]<br/>}} | |
− | + | {{FAQ| The output data of the examples is 0 or did the initialization fail?<br/> | |
− | + | [[File:TSL25911 Light Sensor-12.png|400px]]<br/> | |
− | + | |Please check the connection of the pins..}} | |
− | + | =Support= | |
− | + | {{Servicebox1}} | |
− | |||
− | {{ | ||
[[Category:AlphaBot|AlphaBot]] [[Category:Sensors|Sensors]] [[Category:Light|Light]] | [[Category:AlphaBot|AlphaBot]] [[Category:Sensors|Sensors]] [[Category:Light|Light]] | ||
+ | </font> |
Latest revision as of 08:34, 13 April 2024
| ||
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 |
Feature
- 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 in strong infrared noise environments.
- Provides interrupt output with programmable upper and lower thresholds.
- Onboard voltage translator, compatible with 3.3V/5V operating voltage.
- Comes with online development resources and a manual (examples for Raspberry Pi/Arduino/STM32).
Specifications
- Light sensor: TSL25911FN
- Communication interface: I2C (constant address: 0 x 29)
- Effective range: 0~88000Lux
- Operating voltage: 3.3V/5V
- Dimensions: 27mm × 20mm
- Mounting hole size: 2.0mm
Pinouts
Pin | Instruction |
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 a 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 uses an I2C interface and has a data line and a clock signal line. There are three types of signals will be used during the I2C bus data transmission. They are the Start signal, Stop signal, and Ack signal.
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 has received 8 bits 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
In 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 these 8 bits 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 receives the ACK signal. The Slave responds to an ACK signal when it has received the slave address. By following, the Host sends the data to the Slave. And the Slave responds with an ACK signal once again. The I2C writing operation will be continued till the Host sends out a stop signal.
I2C Read
In the beginning, the Host sends out a start signal, and combines the 7 bits of I2C slave address with the Write bit, then, sends these 8 bits 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 receives the ACK signal. The Slave responds to 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 bits of slave address with Read bit, then, sends this 8 bits data to the Slave. And then, the Slave responds to 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 receives 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
P28 of the TSL25911 datasheet
Note: The device address of 0x29 is 7 bits, and the 8-bit device address required to be shifted to 0x52 by moving 1 bit to a high position.
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:
sudo reboot
Install libraries
- 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.
Hardware connection
TCS34725 Color Sensor | Raspberry Pi(BCM) |
VCC | 3.3V |
GND | GND |
SDA | SDA(2) |
SCL | SCL(3) |
INT | 4 |
Download and run the test examples
sudo apt-get install p7zip-full wget https://files.waveshare.com/upload/b/bc/TSL2591X_Light_Sensor_code.7z 7z x TSL2591X_Light_Sensor_code.7z -r -o./TSL2591X_Light_Sensor_code sudo chmod 777 -R TSL2591X_Light_Sensor_code
You can clone the project on our GitHub:
sudo git clone https://github.com/waveshare/TSL2591X-Light-Sensor
- C code
cd TSL2591X_Light_Sensor_code/TSL2591x_Light_Sensor_code/RaspberryPi/c make clean make sudo ./main
- Python code
cd cd TSL2591X_Light_Sensor_code/TSL2591x_Light_Sensor_code/RaspberryPi/python/examples sudo python main.py
STM32 Application
Download the example here 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 the HAL library. The development board used for the test is XNUCLEO-F103RB of Waveshare, whose chip is STM32F103RBT6.
If you want to port the examples for other STM32 chips 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 an example. The example uses UART3 (PA3, PA3) to output debug information. It is set to 115200, 8N1.
Hardware connection
The connection is shown in the following table:
TCS34725 Color Sensor | STM32 |
VCC | 3.3V |
GND | GND |
SDA | SDA/D14/PB9 |
SCL | SCL/D15/PB8 |
INT | D8/PA9 |
Expected Result
Open the serial port assistant software on the computer and select the corresponding port to check the output data:
Arduino
Download the example here. 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 successfully, open TSL25911-demo, select the corresponding COM port, download it to UNO, open the serial monitor, and check the data output.
Hareware connenction
TCS34725 Color Sensor | Arduino |
VCC | 3.3V/5V |
GND | GND |
SDA | SDA |
SCL | SCL |
INT | D8 |
Expected result
The figure below shows the data of the test:
Resources
FAQ
{{{5}}}
{{{5}}}
Support
Technical Support
If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)