ESPEasy and TSL2561

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Martijn
Normal user
Posts: 2
Joined: 22 Apr 2017, 16:26

ESPEasy and TSL2561

#1 Post by Martijn » 27 Nov 2017, 17:12

Hi!

I just got my TSL2561 connected to a WEMOS D1 Mini working. Works great, much easier then when it was connected directly to my RPi with a very long cable.

I do notice a very large difference in the values produced with this setup and with the Python script I used before. This is a bit hairy, because my whole Domoticz is setup on these "old" values. I tried to replicate the output from the script in ESPEasy, but I'm missing a second value, that is used to calculate the outcome in the script (which I did't write myself BTW).

The script is:

Code: Select all

# TSL2561
import smbus
import time
# Get I2C bus
bus = smbus.SMBus(1)
# TSL2561 address, 0x39(57)
# Select control register, 0x00(00) with command register, 0x80(128)
#		0x03(03)	Power ON mode
bus.write_byte_data(0x39, 0x00 | 0x80, 0x03)
# TSL2561 address, 0x39(57)
# Select timing register, 0x01(01) with command register, 0x80(128)
#		0x02(02)	Nominal integration time = 402ms
bus.write_byte_data(0x39, 0x01 | 0x80, 0x02)
time.sleep(0.5)
# Read data back from 0x0C(12) with command register, 0x80(128), 2 bytes
# ch0 LSB, ch0 MSB
data = bus.read_i2c_block_data(0x39, 0x0C | 0x80, 2)
# Read data back from 0x0E(14) with command register, 0x80(128), 2 bytes
# ch1 LSB, ch1 MSB
data1 = bus.read_i2c_block_data(0x39, 0x0E | 0x80, 2)
# Convert the data
ch0 = data[1] * 256 + data[0]
ch1 = data1[1] * 256 + data1[0]
# Output data to screen
print "Full Spectrum(IR + Visible) :%d lux" %ch0
print "Infrared Value :%d lux" %ch1
print "Visible Value :%d lux" %(ch0 - ch1)
I haven't found a way to replicate the esults.

Any ideas?

With kind regards,

Martijn

Ton_vN
Normal user
Posts: 116
Joined: 21 Oct 2016, 15:20
Location: Hengelo (Ov)/ NL
Contact:

Re: ESPEasy and TSL2561

#2 Post by Ton_vN » 08 Apr 2019, 11:41

Also looking at ESPEasy and TSL2561.

In the Adafruit-info I see that Light and IR can be separately called from TSL2561, but also 'joined' under Broadband and Luminosity.
The description in ESPEasy's wiki seems to describe the application of Luminosity.

First question
Can the Light-, IR- or Broadband--outputs of TSL2561 anywhere separately be called from ESPEasy, or are they just simply 'not available'?

Second question
The WiKi-description shows a possible selection for Gain*16.
In which version of the firmware has this feature been introduced?
[I apply R147, which misses this function]
Can this gain-feature be remotely controlled (e.g. to temporarily boost the measurement at night)?

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 10 guests