Reply to topic  [ 1 post ] 
TSL2561 Luminosity Sensor Module (HCMODU0102) 
Author Message
Site Admin

Joined: Sun Aug 05, 2012 4:02 pm
Posts: 670
Post TSL2561 Luminosity Sensor Module (HCMODU0102)
Image




The TSL2561 (HCARDU0102) Luminosity sensor module is a light to digital interface module. The sensor contains two photodiodes, one which can detect visible light and infrared (IR), and a second which can detect IR light. Two integrating analog-to-digital converters (ADC) integrate currents from the two photodiodes to produce a digital representation of the the light intensity hitting the sensor. Communication to the device is accomplished through a standard, two-wire I2C serial bus. Consequently, the TSL256x device can be easily connected to a microcontroller or embedded controller. No external circuitry is required for signal conditioning. Solderable jumper pads on the module allow 3 possible I2C addresses to be selected for up to 3 sensors or other I2C devices to co-exist on the same bus. An on-board regulator means the module can be powered from a convenient 5V source.

ImageImageImage


Features:

Approximates Human Eye Response

Programmable Interrupt Function with User-Defined Upper and Lower Threshold Settings

16-Bit Digital Output with SMBus (TSL2560) at 100 kHz or I2C (TSL2561) Fast-Mode at 400 kHz

Programmable Analog Gain and Integration Time Supporting 1,000,000-to-1 Dynamic Range
Automatically Rejects 50/60-Hz Lighting Ripple
Low Active Power (0.75 mW Typical) with Power Down Mode RoHS Compliant

Power supply: 5V
Interface: I2C (0x39 default, 0x29 or 0x49 optional)
Module dimensions: 19mm x 14mm


Image



Raspberry Pi users:

For Raspberry Pi uses we have tested this module with the free Cayenne cloud based IoT software platform. Simply connect the module to your Raspberry Pi as shown below and use the Cayenne software platform to get remote luminosity readings without writing a single line of code.


Image

You can create a free account simply by clicking our referral link below:

                    Image





Arduino users:

To make using this module with your Arduino as easy as possible we have written an exclusive library (HCTSL2561). This library can be downloaded from the software section of our support forum here:

viewtopic.php?f=58&t=2021

The library will allow you to obtain readings from both sensors. Additionally, it can use the information from both sensors to perform a calculated Lux measurement as perceived by the human eye.


Image


Example sketch using the HCTSL2561 library:

Code:
/* FILE:    HCTSL2561_Example
   DATE:    26/05/16
   VERSION: 0.1
   AUTHOR:  Andrew Davies

   Created by Hobby Components Ltd (HOBBYCOMPONENTS.COM)
   
26/05/16 version 0.1: Original version

   
This Arduino sketch demonstrates how to use the HCTSL2561 library to interface to the
TSL2561 light to digital interface sensor. Although this library and sketch should work with
any module using this sensor it has been written particularly for the Hobby Components
TSL2561 (GY-2561) light to digital interface sensor (HCMODU0102).

The sketch will take measurements from both channels on the sensor:

Channel 0 is a visible light + IR sensor.
Channel 1 is an IR only sensor.

The library can also use the results from the two sensors to perform a calculated
Lux measurement that approximates the human eye response.

To use the module connect it to your Arduino as follows:


TSL2561....Uno/Nano

VCC.......+5V (for HCMODU00102) for other TSL2561 modules check for correct supply voltage.
GND.......GND
SCL.......A5
SDA.......A4


You may copy, alter and reuse this code in any way you like, but please leave
reference to HobbyComponents.com in your comments if you redistribute this code.
This software may not be used directly for the purpose of selling products that
directly compete with Hobby Components Ltd's own range of products.

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES,
INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY
REASON WHATSOEVER.
*/


/* Include the HCTSL2561 library */
#include "HCTSL2561.h"

/* Create an instance of the library */
HCTSL2561 HCTSL2561(TSL2561_I2C_ADD_FLOAT);

void setup()
{
  /* Initialise the HCTSL2561 library and the serial interface */
  Serial.begin(9600);
  HCTSL2561.Init();
}


void loop()
{
  unsigned int Ch0, Ch1, Lux;

  /* Take a measurement from channel 0 (visible + IR) */
  Ch0 = HCTSL2561.Get_Chan_0();
  /* Take a measurement from channel 1 (IR) */
  Ch1 = HCTSL2561.Get_Chan_1();

  /* Take a measurement from both channels and calculate the Lux level
     TSL2561_Package_T is the package type used on the HCMODU0102 */
  Lux = HCTSL2561.GetLux(TSL2561_Package_T);

  /* Output the results to the serial interface */
  Serial.print("Channel 0 (visible + IR):\t");
  Serial.println(Ch0);
  Serial.print("Channel 1 (IR): \t\t");
  Serial.println(Ch1);
  Serial.print("Calculated Lux level:\t\t");
  Serial.println(Lux);
 
  Serial.println();
  delay(1000);
}




Image

The HCTSL2561 Arduino compatible library required for the above sketch can be downloaded from the software section of our support forum here:

viewtopic.php?f=58&t=2021

Attachment:
HCMODU0102_TSL2561_Datasheet.pdf




Disclaimer: The Cayenne platform is an external free service and is not provided by, or connected to, Hobby Components Ltd. It is therefore not being sold as part of the product advertised on this page. As such we do not provide any guarantees or warranties with regards to this service. Issues or questions related to the Cayenne platform should be directed to Cayenne and not Hobby Components Ltd.

Libraries, example code, and diagrams are provided as an additional free courtesy by Hobby Components and are not sold as part of this product. We do no provide any guarantees or warranties as to their accuracy or fitness for purpose.

Descriptions and diagrams on this page are copyright Hobby Components Ltd and may not be reproduced without permission.


You do not have the required permissions to view the files attached to this post.


Fri May 27, 2016 1:21 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Thank you to phpBB.com & phpBB.ro.
Design created by Florea Cosmin Ionut.
© 2011 All contents of this site are © Hobby Components LTD