TSL2561

From Let's Control It
(Redirected from LuxSensor2)
Jump to: navigation, search

Introduction

TSL2561 1.jpg

TLS2561 Breadboard-Example.jpg

The TSL2561 sensor is a luminosity sensor. It's spectral sensivity approximately meets the human eye sensivity. The gain of the sensor can be set to a 16xgain mode with the settings. It is connected to the ESP via I²C so connecting even with several sensors and a display is easy to do. The sensor gives luminosity as a digital value.

Precautions

The TSL2561 runs well on 3,3V so no level shifter or special power supply is needed.

The bare circuit is very small and difficult to handle and solder. Usually you will use a breakout board from the market that is much easier to handle.

Hardware

Connecting the TSL2561 is easy. Just connect it as shown in the schematic:

  TSL2561	ESP
  GND		GND
  VCC		3,3V
  SCL		D1(GPIO5)
  SDA		D2(GPIO4)
  ADDR		not connected.

TLS2561-Schematic.jpg

If you're connecting several devices to I²C and/or using longer cabling please see the "Basics: The I²C Bus" wiki for further informations. [[1]]

ESPEasy

First check if the TSL2561 show up:

Go to the "Advanced" Tab and click "I²C Scan" It should show this result:

TLS2561 Scan-Result.jpg

Set up the ESPEasy task according to the screenshot.

TLS2561 Settings.jpg

Additional settings:

Integration time: The sensor uses two photo detectors to meter luminosity. The values are calculated with a built-in circuit into "Lux" value. The "integration time" can be equaled to the shutter of a camera. For a darker environment a longer shutter time is usefull as it makes the sensor more senitive.

Technically the integration time says how many measurement cycles are done and the values collected before the conversion into a lux value takes place. A long integration time makes the sensor more sensitive this way - and somewhat slow. This is nice if a short light in the night might influence your home control, in case of controlling window blinds by outside light for example.

Rule of thumb: the longer the integration time is, the more exact is the result, the more sensitive is the sensor and the slower the sensor works.

Gain: The sensivity can be set to 16x gain with this setting.

Submit your settings. After some seconds the tasklist will show like this:

TLS2561 Task-List.jpg

If it shows all values as zero, don't worry. Wait a minute and refresh the browser page.


Calibrating

See "Basics: Calibrating" for further information [[2]]

Troubleshooting

Your TSL2561 does not show up at I²C-scan

Usually this failure results of cabling faults. If your device does not show up, SCL and SCA might be swapped or the module does not get power or ground. If you are testing on a breadboard, the breadboard contacts might be worn out or you got some faulty cables. A digital multimeter will help with this sutuations.

Your TSL2561 shows all values zero

The I²C-scan showed your TSL2561 but after submitting and returning to the task list all values are zero. First, wait a minute and then refresh the page. Depending on the "Delay" value in the settings it might take some seconds until the first measurement takes place. If that does not help, switch the ESP completely off and back on after some seconds.

Your TSL2561 shows deviating values

This might have several reasons.

These sensors all have their own tolerances. On top the analog to digital conversion produces a deviation of about +/- 1...2 digits.

It is possible to calibrate sensors using a formula See "Basics: Calibrating" for further information [[3]]

Last but not least problems with the power supply are quite usual. See "Basics: Taming false positives" in the wiki for info about filtering power supply. [[4]]

Optional settings

Use of formulas

Use of value names