# Adafruit TSL2561 Light Sensor Driver [![Build Status](https://github.com/adafruit/Adafruit_TSL2561/workflows/Arduino%20Library%20CI/badge.svg)](https://github.com/adafruit/Adafruit_TSL2561/actions)[![Documentation](https://github.com/adafruit/ci-arduino/blob/master/assets/doxygen_badge.svg)](http://adafruit.github.io/Adafruit_TSL2561/html/index.html)
This driver is for the Adafruit TSL2561 Breakout, and is based on Adafruit's Unified Sensor Library (Adafruit_Sensor).
<img src="https://cdn-shop.adafruit.com/970x728/439-00.jpg" height="300"/>
The driver supports manual or 'auto' gain. Adjusting the gain allows you to make the sensor more or less 'sensitive' to light (depending on if you are indoors or outdoors, for example):
```
tsl.setGain(TSL2561_GAIN_1X); /* No gain ... use in bright light to avoid sensor saturation */
tsl.setGain(TSL2561_GAIN_16X); /* 16x gain ... use in low light to boost sensitivity */
tsl.enableAutoGain(true); /* Auto-gain ... switches automatically between 1x and 16x */
```
The driver also supports as automatic clipping detection, and will return '65536' lux when the sensor is saturated and data is unreliable. tsl.getEvent will return false in case of saturation and true in case of valid light data.
## About the TSL2561 ##
The TSL2561 is a 16-bit digital (I2C) light sensor, with adjustable gain and 'integration time'.
Adjusting the 'integration time' essentially increases the resolution of the device, since the analog converter inside the chip has time to take more samples. The integration time can be set as follows:
```
tsl.setIntegrationTime(TSL2561_INTEGRATIONTIME_13MS); /* fast but low resolution */
tsl.setIntegrationTime(TSL2561_INTEGRATIONTIME_101MS); /* medium resolution and speed */
tsl.setIntegrationTime(TSL2561_INTEGRATIONTIME_402MS); /* 16-bit data but slowest conversions */
```
One of the big advantages of the TSL2561 is that it is capable of measuring both broadband (visible plus infrared) and infrared light thanks to two distinct sensing units on the device. This is important in certain lighting environments to be able to read the light level reliably.
More information on the TSL2561 can be found in the datasheet: http://www.adafruit.com/datasheets/TSL2561.pdf
## What is the Adafruit Unified Sensor Library? ##
The Adafruit Unified Sensor Library (Adafruit_Sensor) provides a common interface and data type for any supported sensor. It defines some basic information about the sensor (sensor limits, etc.), and returns standard SI units of a specific type and scale for each supported sensor type.
It provides a simple abstraction layer between your application and the actual sensor HW, allowing you to drop in any comparable sensor with only one or two lines of code to change in your project (essentially the constructor since the functions to read sensor data and get information about the sensor are defined in the base Adafruit_Sensor class).
This is imporant useful for two reasons:
1.) You can use the data right away because it's already converted to SI units that you understand and can compare, rather than meaningless values like 0..1023.
2.) Because SI units are standardised in the sensor library, you can also do quick sanity checks working with new sensors, or drop in any comparable sensor if you need better sensitivity or if a lower cost unit becomes available, etc.
Light sensors will always report units in lux, gyroscopes will always report units in rad/s, etc. ... freeing you up to focus on the data, rather than digging through the datasheet to understand what the sensor's raw numbers really mean.
## About this Driver ##
Adafruit invests time and resources providing this open source code. Please support Adafruit and open-source hardware by purchasing products from Adafruit!
Written by Kevin (KTOWN) Townsend for Adafruit Industries.
快撑死的鱼
- 粉丝: 2w+
- 资源: 9156
最新资源
- gps追踪器源码和pcb资料,量产资料,可以直接生产用
- flash spi w25q128 w25q64 w25q32 w25q16 verilog fpga程序代码 fpga w25q128 64 32 16 verilog代码 资料包清单: 1.w2
- 全国计算机等级考试《三级数据库技术》复习核心内容讲解与备考指导
- 弯管机程序使用三菱FX系列 PLC和昆仑通态触摸屏,也可以用三菱F940系列触摸屏
- 信捷PLC上位机源代码例子,modbusTCP通信,通俗易懂,C#源代码
- 关于粒子滤波在电力负荷预测中的应用 python源代码,代码按照高水平文章复现,有详细说明,保证正确 在线预测电力负荷,在贝叶斯框架的动态模型 提供了顺序蒙特卡罗方法的回顾,并提供了所谓的粒子过滤
- 能源价格风险管理matlab源代码,代码按照高水平文章复现,保证正确 电力价格的波动性远远大于其他通常以极端波动著称的价格 由于电力不能经济地储存,终端用户的需求在很大程度上取决于天气,而电网的可靠
- 电力市场中生产者的战略招标:一种凸松弛方法matlab 源代码,代码按照高水平文章复现,保证正确 电力市场中的战略投标问题在电力系统中得到了广泛研究,通常是通过制定难以解决的复杂的双层优化问题来进行的
- FMC ADC12D2000RF 模块,忍痛出射频直接采集FMC ADC模块,模块基于Ti公司高端ADC12D2000RF芯片,芯片为单通道4GSPS,双通道2GSPS,12bit分辨率,这款芯片国
- 西门子200smart与施耐德ATV变频器modbus通讯 西门子s7-200smart与施耐德ATV12变频器通讯,可靠稳定,同时解决施耐德ATV变频器断电重启后,自准备工作,无需人为准备 器件:
- 2025/1/15 自用
- siddhi 的核心jar
- 上市公司的高压软启动控制源码,源码,需要的联系,平台TI,厂家见图,也有低压软起动的方案,
- 基于Atrix7 Kitex7 Vertex7系列FPGA的DDR3内存驱动器代码(Verilog语言),把2GB的内存做成一个可以同时读写的大型FIFO 有代码,有测试文档
- 圈乘问题求解问题pdf
- 关于配电网调压通信的需求VoltVAR反馈控制法则的比较完全分散与网络化策略 matlab源代码 代码按照高水平文章复现,保证正确 我们首先介绍了一类非常普遍的纯局部控制策略,并通过一个反例演示
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈