Skip to content

TSL2563

Antonio Lignan edited this page Jan 28, 2016 · 2 revisions

TSL2563 digital Ambient light sensor

Breakout boards and sensors can be purchased at the following places:

Technical details

  • Supply voltage: 2.4V to 3V
  • Approximates human eye response
  • Current consumption (vdd=3V at 25°C): Sleep Typ. 3.2µA, Measuring Typ. 0.24mA
  • Lux Range: 0.1 to 40000
  • I2C frequency bus: Max. 400KHz
  • Operating temperature range: -30 to +70ºC
  • Board dimensions 35.7x26.5x8.6 mm

Available documentation (manufacturer)

Libraries and examples

The Contiki sensor library can be found at platform/zoul/dev/tsl2563.c, check out the most updated version in Contiki repository.

TSL2563 ambient light sensor

To test the TSL2563 sensor follow the next steps

  1. Grab Contiki and prepare the development setup (skip if you already have it)

  2. Connect the sensor to the RE-Mote using the 5-pin cable as shown in the photo above. This is a 5-pin connector with 2.54 mm pitch spacing, if you are to connect using a different cable than the one provided, check out the RE-Mote pin-out and the connector information.

  3. Compile the test example and program the RE-Mote:

cd examples/zolertia/zoul
make test-tsl2563.upload && make login

You should see on your screen something similar to this:

(...)
  CC        test-tsl2563.c
  LD        test-tsl2563.elf
arm-none-eabi-objcopy -O binary --gap-fill 0xff test-tsl2563.elf test-tsl2563.bin
python ../../../tools/cc2538-bsl/cc2538-bsl.py -e -w -v -a 0x00202000 test-tsl2563.bin
Opening port /dev/ttyUSB0, baud 500000
Reading data from test-tsl2563.bin
Firmware file: Raw Binary
Connecting to target...
CC2538 PG2.0: 512KB Flash, 32KB SRAM, CCFG at 0x0027FFD4
Primary IEEE Address: 06:15:AB:25:00:12:4B:00
Erasing 524288 bytes starting at address 0x00200000
    Erase done
Writing 516096 bytes starting at address 0x00202000
Write 8 bytes at 0x0027FFF8F00
    Write done                                
Verifying by comparing CRC32 calculations.
    Verified (match: 0x741b3711)
rm obj_zoul/startup-gcc.o test-tsl2563.co
using saved target 'zoul'
../../../tools/sky/serialdump-linux -b115200 /dev/ttyUSB0
connecting to /dev/ttyUSB0 (115200) [OK]

Contiki-3.x-2102-g9f1376d
Zolertia RE-Mote platform
Rime configured with address ab:25
 Net: Rime
 MAC: CSMA
 RDC: nullrdc
Light = 125
Light = 124
Light = 124
Light = 94
Light = 65
Light = 141
Light = 138
Light = 50

If the above doesn't work, or if you see the following values without changing (not even cloaking or covering the sensor):

Light = 65535

Check the wiring and connections, this error is likely due to a bad connection. Try also enabling the DEBUG flag in platforms/zoul/dev/tsl2563.c by changing the current value to #define DEBUG 1, this will print more information on screen useful for debugging.

The TSL2563 sensor allows to trigger interrupts when a given threshold is over or below a certain value configured by the user, this is done in the example in the following block:

  /* Enable the interrupt source for values over the threshold.  The sensor
   * compares against the value of CH0, one way to find out the required
   * threshold for a given lux quantity is to enable the DEBUG flag and see
   * the CH0 value for a given measurement.  The other is to reverse the
   * calculations done in the calculate_lux() function.  The below value roughly
   * represents a 2500 lux threshold, same as pointing a flashlight directly
   */
  tsl2563.configure(TSL2563_INT_OVER, 0x15B8);

You should see the following message in your screen:

* Light sensor interrupt!

And the RE-Mote should blink each time with the LED set on purple.

Clone this wiki locally