TSL2561 lux sensor - resolution 0.1lx

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
gerbelli
 
Posts: 6
Joined: Tue Nov 28, 2017 4:24 pm

TSL2561 lux sensor - resolution 0.1lx

Post by gerbelli »

Help!.

I bought this brightness sensor to be able to detect 1/10 of lux, but in fact it would seem that the minimum resolution is 1lux !. Does anyone know the code for ARDUINO to detect a brightness of 0.1lux? if YES, can you share it with the whole forum? if NO, adafruit does not produce another sensor able to have that resolution of brightness?

Any help will be greatly appreciated !.

Thank you
Gerbelli M.

User avatar
Franklin97355
 
Posts: 23910
Joined: Mon Apr 21, 2008 2:33 pm

Re: TSL2561 lux sensor - resolution 0.1lx

Post by Franklin97355 »

I don't know what code you are running. Try setting this in your code.

Code: Select all

 // tsl.setIntegrationTime(TSL2561_INTEGRATIONTIME_402MS);  /* 16-bit data but slowest conversions */

User avatar
gerbelli
 
Posts: 6
Joined: Tue Nov 28, 2017 4:24 pm

Re: TSL2561 lux sensor - resolution 0.1lx

Post by gerbelli »

Cattura.JPG
Cattura.JPG (39.3 KiB) Viewed 691 times
Of course ... this setting was the first step I had done !. see below:

tsl.setGain(TSL2561_GAIN_16X); /* 16x gain ... use in low light to boost sensitivity */
tsl.setIntegrationTime(TSL2561_INTEGRATIONTIME_402MS); /* 16-bit data but slowest conversions */


I supposte that the problem is the resolution of the variable lux that it's a integer and not a decimal (float) number!.
See also the result in the attached image: the resolution is 1.00 lux and not 0.10lux !,
Below I enclose the code used:

Code: Select all

#include <Adafruit_TSL2561_U.h>
#include <pgmspace.h>
#include <Adafruit_Sensor.h>
#include <Wire.h>
#include <SPI.h>
Adafruit_TSL2561_Unified tsl = Adafruit_TSL2561_Unified(TSL2561_ADDR_FLOAT, 12345);

void setup() {
Serial.begin(9600);
Serial.println("Light Sensor Test"); 
  Serial.println(""); 
  if(!tsl.begin()) 
   { 
     Serial.print("Ooops, no TSL2561 detected ... Check your wiring or I2C ADDR!"); 
     while(1); 
   } 
    
    tsl.setGain(TSL2561_GAIN_16X);     /* 16x gain ... use in low light to boost sensitivity */ 
    tsl.setIntegrationTime(TSL2561_INTEGRATIONTIME_402MS);  /* 16-bit data but slowest conversions */ 

   sensor_t sensor; 
   tsl.getSensor(&sensor); 
   Serial.println("------------------------------------"); 
   Serial.print  ("Sensor:       "); Serial.println(sensor.name); 
   Serial.print  ("Driver Ver:   "); Serial.print(sensor.version); Serial.println(TSL2561_LUX_LUXSCALE); //(sensor.version); 
   Serial.print  ("Unique ID:    "); Serial.println(sensor.sensor_id); 
   Serial.print  ("Max Value:    "); Serial.print(sensor.max_value); Serial.println(" lux"); 
   Serial.print  ("Min Value:    "); Serial.print(sensor.min_value); Serial.println(" lux"); 
   Serial.print  ("Resolution:   "); Serial.print(sensor.resolution); Serial.println(" lux");   
   Serial.println("------------------------------------"); 
   Serial.println(""); 
   delay(500); 
}

void loop() {
   sensors_event_t event; 
   tsl.getEvent(&event); 
   /* Display the results (light is measured in lux) */ 
   if (event.light) 
   { 
     Serial.print(event.light); Serial.println(" lux");
   } 
   else 
   { 
     Serial.println("Sensor overload"); 
   } 
   delay(250); 
} 
Last edited by Franklin97355 on Fri Dec 01, 2017 5:58 pm, edited 1 time in total.
Reason: Added missing code tags.

User avatar
gerbelli
 
Posts: 6
Joined: Tue Nov 28, 2017 4:24 pm

Re: TSL2561 lux sensor - resolution 0.1lx

Post by gerbelli »

So, nobody is able to modify the TSL2561 shield library to increase the brightness reading resolution to 0.1lux?
I am very sorry for this ...

I am always listening if someone has found the solution ....
Marcello

User avatar
gerbelli
 
Posts: 6
Joined: Tue Nov 28, 2017 4:24 pm

Re: TSL2561 lux sensor - resolution 0.1lx

Post by gerbelli »

Honestly I thought that an Adafruit technician would explain me why it is indicated that the sensor has a sensibility of 0.1 lux but in the reality this is limited with a resolution of 1lux !. Perhaps it was better that this limitation on the website was better specified.
The same also applies to the TSL2591 board! (it's indicate that the sensor detect light ranges from 188 uLux up to 88,000 Lux on the fly, it's wrong!. the resolution is always 1 lux!.)

Thanks anyway.
Gerbelli

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: TSL2561 lux sensor - resolution 0.1lx

Post by adafruit_support_carter »

Sorry. If you're concerned about that reported output, don't be. It's unfortunately a red herring. It's just hardwired to 1.0 and nothing changes it:
https://github.com/adafruit/Adafruit_TS ... U.cpp#L536
Calling tsl.setIntegrationTime(TSL2561_INTEGRATIONTIME_402MS); should configure it properly:
https://github.com/adafruit/Adafruit_TS ... U.cpp#L246

User avatar
ktownsend
 
Posts: 1447
Joined: Thu Nov 05, 2009 2:18 am

Re: TSL2561 lux sensor - resolution 0.1lx

Post by ktownsend »

The issue here is that the driver is based on integer math, which obviously necessitates steps of 1 lux. This code and the algorithm used to convert to lux is based on the app notes from the manufacturer, and is the only information we have to go on unfortunately: https://github.com/adafruit/Adafruit_TS ... U.cpp#L379

User avatar
gerbelli
 
Posts: 6
Joined: Tue Nov 28, 2017 4:24 pm

Re: TSL2561 lux sensor - resolution 0.1lx

Post by gerbelli »

Thanks for the answers, but I was looking for a luxmeter with a resolution of 0.1 ° C and not 1 ° C !.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”