Home
Grove - Digital Light Sensor User Manual
Contents
1. re se re if ambient Oxffff or IR Oxffff f LUX None f ambient None f IR None turn self ambient self IR self ambient self IR self LUX if Self gain 1 self ambient 16 ambient Scale 1x to 16x self IR 16 IR Scale 1x to 16x else self ambient 1 ambient self IR 1 IR if self debug print IR Result without scaling IR print IR Result self IR print Ambient Result without scaling ambient print Ambient Result self ambient if self ambient 0 Sometimes the channel 0 returns 0 when dark 1f LUX 0 0 turn ambient IR self ambient self IR self LUX ratio self IR float self ambient Change to make it run under python 2 if self debug arime Tatio Tatio if Cario amd atio lt 0 52 self LUX 0 0315 self ambient 0 0593 self ambient ratio elif ratio lt 0 65 self LUX 0 0229 self ambient 0 0291 self IR elif ratio lt 0 80 self LUX 0 0157 self ambient 0 018 self IR elif ratio lt 1 3 self LUX 0 00338 self ambient 0 0026 self IR elif ratio gt 1 3 14 y seeed Grow the Difference self LUX 0 return ambient IR self ambient self IR self LUX def partno revision self nnn nnn Read Partnumber and revision of the sensor cmd CMD _REG_ID value self i2
2. Grow the Difference y seeed Grove Digital Light Sensor User Manual Release date 2015 9 22 Version 1 0 Wiki http www seeedstudio com wiki Grove Digital Light Sensor Bazaar http www seeedstudio com depot Grove Digital Light Sensor p 1281 html cPath 25 128 y seeed Grow the Difference Document Revision History y seeed Grow the Difference Contents Document Revision History ssss 2 1 Introduction Bras maise Site Sb W S ect des mo nd dia ons en E Bob 806 0 sc dt tn ne das last E EE 88018 ce E st 2 2 Features Titre re eee ee or ee Eee ee Tee ee eee soma 3 3 Specifications 4 4 Interface Function scene mare ent ace Sm ar ec ee nee NaC OU na en ee nm Sn ne Bi aya dare a 5 5 TSL2561 Functional Block Diagram 6 6 Usage rss eee seeneeeseeseeseeseeessesssesssees 7 6 1 With Arduino cc sssessssesessesseseressesssesseseessesseesesese 7 6 2 With Raspberry Pi ssssssssseees 9 7 Reference ser arenete a euers es ae EEEE ETES ET EEEREN LEETE EEES TTETAS ETEEN S E EEEE EE er eielie 1 8 7 1 Register Map E a A were eo mi 18 7 2 Spectrum Response Curye serssereeenreenreeneeneneereerereeereeenenennets 18 8 Resource E E LEE AES EOE EE E EYLE ATEUA TA ESEE eee ee 20 y seeed Grow the Difference Disclaimer For physical injuries and possessions loss caused by those reasons which are not related to produc
3. C to 85 C Programmable interrupt function with User Defined Upper and lower threshold settings y seeed Grow the Difference 3 Specifications Items Supply voltage VDD Operating temperature SCL SDA input low voltage SCL SDA input high voltage 3 3 30 0 5 2 3 Type Max 5 1 70 0 8 5 1 Unit y seeed Grow the Difference 4 Interface Function o SCL SDA EU GND o U1 TSL2561 IC Light To Digital Converter U3 XC6206MR332 IC Positive Voltage Regulators Q1 Q2 BSN20 IC N channel Enhancement Mode Vertical D MOS Transistor SCL SDA I2C Signal Interface y seeed Grow the Difference 5 TSL2561 Functional Block Diagram A D Converter Channel 0 Ye Visible and IR Integrating Channel 1 Voo 2 7 V to 3 5 V IR Only Command ADC ae sid Ra Two Wire Serial Interface Uk INT SCL SDA y seeed Grow the Difference 6 Usage 6 1 With Arduino 1 Plug the Grove Digital Light Sensor onto the I2C port on Grove Base Shield and then plug the base shield onto Arduino 2 Download the library from here Digital Light Sensor Library 3 Unzip it into the libraries file of Arduino IDE by the path arduino 1 0 1 libraries 4 Create an Arduino sketch and paste the following codes to it or open the code directly by the path File gt Example gt Digital_Light_Sensor gt Digital_Light_Sensor Digital Light Sen
4. _IR 7 sivie ILO 7 ilo 7 print Light else print There is light print ambient str ambient print CIR sir TRI print ambient str ambient arime CIR swr IN priat Lism 7 SCO 7 lux time sleep 2 ambient None IR None _ambient 0 _IR _ LUX None TSL2561 control POWER DOWN 3 2 if _ name main main 5 Run the demo sudo python grove i2c digital light sensor py 6 Result 16 Wy olpnis seeed Grow the Difference amp pi raspberrypi software GrovePi Software Python grove_i2c_digital_light_s pi raspberrypi software GrovePi Software Python grove i2c digital light sensor sudo python grove i2c digital light _sensor py Power ON responce 80 PartNo not TSL2560 or TSL 2561 RevNo gain 0 Setting high gain I2C Device 0x29 returned OxOBBF from reg 0x8C I2C Device 0x29 returned 0x0310 from reg Ox8E IR Result without scaling 4099 IR Result 4099 Ambient Result without scaling 48907 Ambient Result 48907 ratio 0 0838121332325 There is light ambient 48907 IR 4099 _ambient 48907 _IR 4099 Light 1450 40189109 lux Power OFF gain 0 I2C Device 0x29 returned OxOBBC from reg O0x8C v 17 y seeed Grow the Difference 7 Reference 7 1 Register Map The TSL2561 is controlled and monitored by sixteen registers three are reserved and a
5. ation self pause must be bigger than integration time def readWord self reg Reads a word from the TSL2561 12C device Lo wordval self i2c readU16 reg newval self i2c reverseByteOrder wordval if self debug print 12C Device 0x 02X returned 0x 04X from reg 0x 02X self addr wordval amp OxFFFF reg return newval except 0Error print Error accessing 0x 02X Chcekcyour 12C address self addr return 1 def readFull self reg Ox8C Read visible IR diode from the TSL2561 I2C device return self readWord reg def readIR self reg Ox8E 77 Reads only IR diode from the TSL2561 I2C device return self readWord reg def readLux self gain 0 77 Grabs a lux reading either with autoranging gain 0 or with specific gain 1 16 77 if self debug print gain gain i aim il oe gain I6 self setGain gain Low highGain ambient self readFull IR self readIR elif gain 0 Auto gain self setGain 16 First try highGain ambient self readFull if ambient lt 65535 13 WY 1 4 seeed Grow the Difference IR self readIR if ambient gt 65535 or IR gt 65535 Value s exeed s datarange self setGain 1 Set lowGain ambient self readFull IR self readIR If either sensor is saturated no acculate lux value can be achieved se se se
6. c readS8 cmd part str value 7 4 if part 0000 PartNo TSL2560CS elif part 0001 PartNo TSL2561CS elif part 0100 PartNo L2560T FN CL elir ari T0 s PartNo TSL2561T FN CL aon wn else PartNo not TSL2560 or TSL 2561 RevNo str value 3 0 if self debug print responce value print PartNo PartNo print RevNo RevNo return PartNo RevNo def control self params if params POWER UP print Power ON elif params POWER DOWN print Power OFF else print No params given cmd _CMD _REG CONTROL params self i2c write8 self addr cmd select command register and power on time sleep 0 4 Wait for 400ms to power up or power down def main TSL2561 Ts12561 TSL2561 init I2C SMBUS 12C ADDRESS while True gain 0 15 y seeed Grow the Difference val TSL2561 readLux gain ambient val 0 IR val 1 _ambient val 2 _IR valla _LUX val 4 if ambient Oxffff or IR Oxffff print Sensor is saturated no lux value can be achieved print ambient ambient prime CMR 7 I print light _LUX elif ambient 0 print It s dark print ambient str ambient print IR str IR print ambient str ambient print _IR str
7. command register accessed through the serial interface These registers provide for a variety of control functions and can be read to determine results of the ADC conversions The register set is summarised as show below COMMAND _ Specifenregiteradiress on contor Contotafbasictunatons Cid Pim _ TIMING fiograton imefgnin contro LE ES ES C2 Pe one fraoyus nrauergme SSCSC RS PS C2 an TD E Beh Reserved Low byte of ADC channel 0 High byte of ADC channel 0 Eh DATAILOW Low byte of ADC channel 1 High byte of ADC channel 1 7 2 Spectrum Response Curve Channel 0 Photodiode Normalized Responsivity Channel 1 Photodiode 300 400 500 600 700 800 900 1000 1100 i Wavelength nm 18 y seeed Grow the Difference Two channels of the digital light sensor have different response characteristic That s why you can choose its working mode by having both of them on or one of them off y seeed Grow the Difference 8 Resource e Grove Digital Light Sensor Eagle File e Grove Digital Light Sensor Schematic Library Github Repo e TSL2561 Datasheet 20
8. ht value is Serial print 1n TSL2561 readVisibleLux delay 1000 5 Upload the code Please click here if you do not know how to upload 6 Open the serial monitor to see the result y seeed Grow the Difference COMS The Light value i The Light value i The Light value is The Light value 1 The Light value is 348 The Light value is 401 The Light value is 401 The Light value is 533 The Light value is 588 The Light value is 560 The Light value is 578 The Light value is 578 The Light value is 578 The Light value is 578 The Light value is 609 The Light value is 1103 The Light value is 36 The Light value is 376 The Light value is 475 The Light value is 2641 The Light value is 3484 V Autoscroll To line ending 9600 baud k In the case of completely light matte The output result is 0 6 2 With Raspberry Pi 1 You should have got a raspberry pi and a grovepi or grovepi 2 You should have completed configuring the development enviroment otherwise follow here 3 Connection Plug Digital Light Sensor to the I2C sockets on grovepi 4 Navigate to the demos directory ed yourpath GrovePi Software Python grove i2c digital light sensor To see the code nano grove i2c digital light sensor py Ctrl x to exit import time import smbus from Adafruit_I2C import Adafruit_12C import RPi GPIO as GPIO y seeed Grow
9. meters ambient None IR None _ambient 0 _IR _ LUX None class Ts12561 object i2c None def init self bus I2C SMBUS addr I2C ADDRESS debug 1 pause 0 8 set debug 0 stops debugging output on screen 11 y seeed Grow the Difference assert bus is not None assert addr gt 0b000111 and addr lt 0b1111000 self i2c Adafruit_I2C addr self pause pause self debug debug self gain 0 self _bus bus self addr addr ambient None IR None self ambient 0 self IR 0 self LUX None self control POWER UP self partno revision property def lux self gain 299 Returns a lux value Returns None if no valid value is set yet var readLux gain ambient var 0 IR var 1 self ambient var 2 self IR var 3 self LUX var 4 return ambient IR self ambient self IR self LUX def setGain self gain 1 nnn nnn Set the gain if gain self gain if gain 1 cmd _CMD _REG_TIMING value 0x02 self i2c write8 cmd value Set gain 1X and timing 402 mSec if self debug print Setting low gain else cmd CMD _REG TIMING 12 y seeed Grow the Difference value 0x12 self i2c write8 cmd value Set gain 16X and timing 402 mSec if self debug print Setting high gain self gain gain Safe gain for calculation time sleep self pause Pause for integr
10. sor ino A library for TSL2561 Copyright c 2012 seeed technology inc Website www seeed cc Author zhangkun Create Time Change Log The MIT License MIT Permission is hereby granted free of charge to any person obtaining a copy y seeed sf Grow the Difference of this software and associated documentation files the Software to deal in the Software without restriction including without limitation the rights to use copy modify merge publish distribute sublicense and or sell copies of the Software and to permit persons to whom the Software is furnished to do so subject to the following conditions The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software THE SOFTWARE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND EXPRESS OR IMPLIED INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM DAMAGES OR OTHER LIABILITY WHETHER IN AN ACTION OF CONTRACT TORT OR OTHERWISE ARISING FROM OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE include lt Wire h gt include Digital Light TSL2561 h gt void setup Wire begin Serial begin 9600 TSL2561 init Q void loop Serial print The Lig
11. t quality such as operating without following manual guide natural disasters or force majeure we take no responsibility for that Under the supervision of Seeed Technology Inc this manual has been compiled and published which covered the latest product description and specification The content of this manual is subject to change without notice Copyright The design of this product including software and its accessories is under tutelage of laws Any action to violate relevant right of our product will be penalized through law Please consciously observe relevant local laws in the use of this product y seeed Grow the Difference 1 Introduction This module is based on the 12C light to digital converter TSL2561 to transform light intensity to a digital signal Different from traditional analog light sensor as Grove Light Sensor this digital module features a selectable light spectrum range due to its dual light sensitive diodes infrared and full spectrum You can switch among three detection modes to take your readings They are infrared mode full spectrum and human visible mode When running under the human visible mode this sensor will give you readings just close to your eye feelings y seeed Grow the Difference 2 Features Selectable detection modes High resolution 16 Bit digital output at 400 kHz I2C Fast Mode Wide dynamic range 0 1 40 000 LUX Wide operating temperature range 40
12. the Difference import grovepi from smbus import SMBus global I2C_ADDRESS global I2C_SMBUS global CMD global _CMD_CLEAR global CMD WORD global _CMD BLOCK global _REG_CONTROL global _REG_TIMING global REG ID global _REG_BLOCKREAD global _REG_DATAO global _REG DATAI global POWER UP global POWER DOWN global GAIN LOW global GAIN HIGH global _INTEGRATION START global _INTEGRATION_STOP global _INTEGRATE 13 global _INTEGRATE 101 global _INTEGRATE 402 global _INTEGRATE_DEFAULT global _INTEGRATE NA global GAIN global MANUAL global _INTEG global _CHANNELO global _CHANNEL1 global _DO global Dl global _LUX bus parameters rev GPIO RPI_REVISION if rev 2 or rev 3 12C_SMBUS smbus SMBus 1 else 2C_SMBUS smbus SMBus 0 Default I2C address 10 y seeed Grow the Difference 2C ADDRESS 0x29 Commands _CMD 0x80 _CMD CLEAR 0x40 _CMD WORD 0x20 _CMD_BLOCK 0x10 Registers _REG CONTROL 0x00 _REG_TIMING 0x01 _REG_ID 0x0A _REG_BLOCKREAD 0x0B _REG_DATAO 0x0C _REG_DATA1 Ox0E Control parameters _POWER_UP 0x03 _ POWER DOWN 0x00 Timing parameters _GAIN_LOW 0b00000000 _GAIN_HIGH 0b00010000 _ INTEGRATION START 0b00001000 _ INTEGRATION STOP 0b00000000 _INTEGRATE_13 0b00000000 _INTEGRATE_101 0b00000001 _INTEGRATE_402 0b00000010 _INTEGRATE_DEFAULT _INTEGRATE_402 INTEGRATE_NA 0b00000011 Testing para
Download Pdf Manuals
Related Search
Related Contents
Ligne d`eau n°12 - Fédération Française de Natation Altronix BC800 IAN 102867 - Lidl Service Website COOL ARC® 40 Stand Alone Retail Intermediaries Online Reporting Frequently Asked Questions CAMÉRA CCD 二説明書 - 日本アンテナ EZiCaddy EZi-5 Digital User Manual Faber Spectra Instructions - Draft BRUGERMANUAL BEDIENUNGSANLEITUNG USER MANUAL Copyright © All rights reserved.
Failed to retrieve file