Skip to content

ESP32-compatible example for TSL2561 Light to Digital Converter

License

Notifications You must be signed in to change notification settings

DavidAntliff/esp32-tsl2561-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

esp32-tsl2561-example

Platform: ESP-IDF Build Status license

Introduction

This is an example application for the TAOS TSL2561 Light-to-Digital Converter device.

It is written and tested for v3.3 of the ESP-IDF environment, using the xtensa-esp32-elf toolchain (gcc version 5.2.0).

Ensure that submodules are cloned:

$ git clone --recursive https://github.com/DavidAntliff/esp32-tsl2561-example.git

Build the application with:

$ cd esp32-tsl2561-example.git
$ idf.py menuconfig    # set your serial configuration and the I2C GPIO - see below
$ idf.py -p (PORT) flash monitor

The program should detect your connected device and periodically obtain a light reading from it, displaying it on the console.

Dependencies

This application makes use of the following components (included as submodules):

Hardware

To run this example, connect one TSL2561 device to two GPIOs on the ESP32 (I2C SDA and SCL). If external pull-up resistors are not provided with the sensor, add a 10 KOhm resistor from each GPIO to the 3.3V supply.

idf.py menuconfig can be used to set the I2C GPIOs and TSL2561 device I2C address.

The TSL2561 can be set to one of three I2C addresses depending on the connection state of the ADDR SEL pin:

  • If ADDR SEL is tied to ground, the address is 0x29.
  • If ADDR SEL is floating (not connected), the address is 0x39.
  • If ADDR SEL is tied to VCC (3.3V), the address is 0x49.

Features

This example provides:

  • Visible, InfraRed and Full Spectrum light level measurements.
  • Lux calculation .
  • Compile-time selection of integration time and gain.

Source Code

The source is available from GitHub.

License

The code in this project is licensed under the MIT license - see LICENSE for details.

Links

Acknowledgements

"I2C" is a registered trademark of Phillips Corporation.

"SMBus" is a trademark of Intel Corporation.

About

ESP32-compatible example for TSL2561 Light to Digital Converter

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published