Flora TSL2561 Lux Sensor
Created by Becky Stern
https://learn.adafruit.com/flora-lux-sensor
Last updated on 2021-11-15 05:56:43 PM EST
©Adafruit Industries
Page 1 of 9
Table of Contents
Overview
3
Wiring
5
Programming
6
• Install Adafruit_TSL2561 library
6
Downloads
8
• Files
8
©Adafruit Industries
Page 2 of 9
Overview
Add light-reactive sensing to your wearable Flora project with this high precision Lux
sensor. The TSL2561 luminosity sensor is an advanced digital light sensor, ideal for
use in a wide range of light situations. Compared to low cost CdS cells, this sensor is
more precise, allowing for exact lux calculations and can be configured for different
gain/timing ranges to detect light ranges from up to 0.1 - 40,000+ Lux on the fly. The
best part of this sensor is that it contains both infrared and full spectrum diodes! That
means you can separately measure infrared, full-spectrum or human-visible light. Most
sensors can only detect one or the other, which does not accurately represent what
human eyes see (since we cannot perceive the IR light that is detected by most photo
diodes).
The sensor has a digital (I2C) interface. Attaching it to the flora is simple: line up the
sensor so its adjacent to the SDA/SCL pins and sew conductive thread from the 3V,
SDA, SCL and GND pins. They line up perfectly so you will not have any crossed lines.
You can connect up to 3 Flora Lux sensors by making sure that each sensor hasd a
unique I2C address. You set the address with the solder jumpers on the reverse side
of the lux sensor. Solder between the center pad and - to set the address to 0x29,
solder between the center pad and + to set the address to 0x49 or leave the
pads floating (unsoldered) to use address 0x39. WARNING! DON'T SOLDER ALL
THREE PADS TOGETHER! That would make a direct short between 3.3V and Ground!
You can connect other I2C sensors/outputs by using the set of SCL/SDA pins on the
opposite side. The current draw is extremely low, about 0.5mA when actively sensing,
and less than 15 uA when in powerdown mode.
For more technical information about the TSL2561 luminosity sensor, check out the TS
L2561 guide (https://adafru.it/aZ1) which shows the more conventional breakout
Adafruit also makes for this sensor.
©Adafruit Industries
Page 3 of 9
To get started making a soft light-sensing circuit on fabric you will need:
• Flora main board (http://adafru.it/659)
• Flora lux sensor (http://adafru.it/1246)
• Alligator clips (http://adafru.it/1008)
• Conductive thread (http://adafru.it/640) (2 or 3 ply)
• Fabric inside an embroidery hoop
• USB A/MiniB cable (http://adafru.it/260)
• 3xAAA battery holder (http://adafru.it/727)
©Adafruit Industries
Page 4 of 9
Wiring
To test the sensor before sewing it into a
project, use alligator clips to hook up the
3.3v, SDA, SCL, and GND pins.
©Adafruit Industries
Page 5 of 9
Stitching the sensor into a project is
easy-- just line up the sensor so its
adjacent to the SDA/SCL pins on Flora or
another I2C sensor, and stitch the four
connections with conductive thread. This
is covered in more detail in the Flora
Accelerometer (https://adafru.it/aYS)
guide and our Conductive
Thread (https://adafru.it/aVx) guide.
Programming
To use this sensor and calculate Lux, there's a lot of very hairy and unpleasant math. Y
ou can check out the math in the datasheet (https://adafru.it/aJR) but really, its not
intuitive or educational - its just how the sensor works. So we took care of all the icky
math and wrapped it up into a nice Arduino library.
Install Adafruit_TSL2561 library
To begin reading sensor data, you will need to install the Adafruit_TSL2561 library
(code on our github repository) (https://adafru.it/aZ9). It is available from the Arduino
library manager so we recommend using that.
From the IDE open up the library manager...
©Adafruit Industries
Page 6 of 9
And type in adafruit tsl2561 to locate the library. Click Install
You will also need the Adafruit Sensor Library (https://adafru.it/aZm) if you do not
already have it installed.
Search the library manager for Adafruit Unified Sensor and install that too (you may
have to scroll a bit)
Now you can run the File->Examples->Adafruit_TSL2561->sensorapi example program
which will read and calculate the lux readings for you.
Open up the serial monitor at 9600 baud to see the measurements. Use a lamp or
your hand to illuminate/shade the sensor to see the values change.
©Adafruit Industries
Page 7 of 9
Open the example sketch by navigating to File->Examples->TSL2561->tsl2561.
Be sure you have the proper serial port
and board selected in the Adafruit
Arduino IDE. For more information about
programming Flora, be sure to read our
Getting Started with FLORA (https://
adafru.it/aSZ) guide.
Upload the example sketch to your Flora.
Open the serial monitor (the upper right
button in the Arduino IDE) and watch the
sensor values pour in.
Try covering the sensor with your hand or
holding it closer to a light source to see
the values change.
Downloads
Files
• TSL2561 Datasheet (https://adafru.it/aJS)
• TSL2561 Driver v2.0 (Unified Sensor Driver) (https://adafru.it/aZ9) - See http://
learn.adafruit.com/tsl2561/use (https://adafru.it/c7O) for installation instructions
• TSL2561 Driver v1.0 on github (obsolete!) (https://adafru.it/aJT)
• Fritzing objects in the Adafruit Fritzing library (https://adafru.it/aP3)
• EagleCAD PCB files for the Flora version (https://adafru.it/rEj)
©Adafruit Industries
Page 8 of 9
©Adafruit Industries
Page 9 of 9
很抱歉,暂时无法提供与“1246”相匹配的价格&库存,您可以联系我们找货
免费人工找货