Go Down

Topic: Grove - light sensor - Does it need to be converted to Lux/Lumens? (Read 5684 times) previous topic - next topic

BagOfBones

I'm currently using this Grove light sensor:

http://www.seeedstudio.com/wiki/Grove_-_Light_Sensor#Specifications

It's working fine, the sensor is displaying onto the serial monitor and an LCD screen no problems.

BUT! I'm unsure if the readings are in any sort of measurement or if they are just showing the resistance. I basically want it to display in either lux/lumens, and I'm struggling to find the correct information or specification of the light sensor, which explains properly how its measuring the light.

If you've had a similar issue or understand what I'm talking about, I would greatly appreciate a push in the right direction. Thanks!

knut_ny

Without a scematic, its impossible to see if that amplifier is connected as an amplifier or a comparator.
If it is amplification only:
  do as example:
Code: [Select]
int sensorValue = analogRead(0);
  Rsensor=(float)(1023-sensorValue)*10/sensorValue;

Then: float myvalue=log(Rsensor); // note myvalues for "office light" (ca. 200 lux) and direct sunlight, clear day (ca 50000lux)
Last map(...); // resistance to lux
Ny

BagOfBones

I'm unsure what you mean, I'm relativity new at this hopefully this helps...

Code: [Select]

#include <Wire.h>
#include "rgb_lcd.h"
int light;

rgb_lcd lcd;
int a;
int del=1000;                // duration between temperature readings
float temperature;
int B=3975;                  //B value of the thermistor
float resistance;
int pin=8;
void setup(){
    lcd.begin(16, 2);
    Serial.begin(9600);
}

void loop()
{
  //temperature sensor
  a=analogRead(0);
  resistance=(float)(1023-a)*10000/a;
  temperature=1/(log(resistance/10000)/B+1/298.15)-273.15;
  delay(del);
  lcd.clear(); lcd.print("TEMP  = "); lcd.print(temperature); lcd.print("C");
  //light sensor
  light=analogRead(1);
  lcd.setCursor(0, 16); lcd.print("Light = "); lcd.print(light);
  Serial.print(light); Serial.print(" ; "); Serial.println(temperature);
}


I'm basically looking for a formula to convert the reading from analog (1) into Lux. What I'm confused about is the reading coming from the LDR, are all the LDR's measuring at the same standard? When I shine a bright light against the LDR it reaches a reading of 758/761 never any higher. When I cover the LDR in complete darkness it goes to 0.

I added the formula lux=500/resistance("light" in my code) but it doesn't seem to work, especially when I covered the LDR again in darkness. It went to -1.

I can't find a schematic sorry. Do you think its a matter of me testing and calibrating the LDR to my own measurements of darkness and bright? or does a formula actually exist to change it straight into Lux, so that I can display it on the Lcd screen...

knut_ny

..direct sunlight, bright day, is 50 000..100 000 lux  (reading 800)
complete darkness is 1 lux

u've got:   light=analogRead(1); // values 0.. 800

then add:
    float lux = exp(float(light)/80.0);   // the number 80 must be adjusted
   // adjust to lux-value  close to 100 000 in clear sunlight (sun in senith)
Ny

Archibald

I'm basically looking for a formula to convert the reading from analog (1) into Lux.
Look at the datasheet for the GL5528 photo-resistor (here) and look at the two tables. It is not clear what the six rows of device data in the second table relate to. However I'm fairly sure they relate to the six versions of the photo-resistor as in the first table. So I assume for example  "10-20" in the second column is for the GL5528. The last column refers to illuminance resistance figure numbers, but they look incorrect. I assume Figure 2 is for the GL5528.  That figure shows how the resistance varies with Lux but instead of a single line graph, the grey area allows for variation between devices.

The slope of the grey area of the graph is not -1. In other words increasing the light level by a factor of 10 does not reduce the resistance by factor of 10.  The table shows γ = 0.6 for the GL5528, which is a measure of the slope of the graph. At higher light levels, the log-log graph will tend to flatten out; the resistance at high light levels will not tend towards zero.  I expect this is why you are not getting values higher than 761.

knut_ny

datasheet says fig 3, but its not very logic.  the 6 graphs are 2,3,4,4,5,6 (why not 1..6 ?)
I agree on fig 2.

the "flatten out" ??  That is the temp-factor?

Can u calculate R  (LDR and a known resistor is in series)  Only unknown factor is that amplifier - what does it do ??

With a known LDR resistamce (in kOhm), u can use the formula shown in the attached picture.
Ny

Archibald

datasheet says fig 3, but its not very logic.  the 6 graphs are 2,3,4,4,5,6 (why not 1..6 ?)
I agree on fig 2.

the "flatten out" ??  That is the temp-factor?

Can u calculate R  (LDR and a known resistor is in series)  Only unknown factor is that amplifier - what does it do ??

With a known LDR resistamce (in kOhm), u can use the formula shown in the attached picture.
It's better than most Chinese datasheets!

Log-log graphs of resistance and luminance from some other websites over a wider range of luminance do not show a straight line. They show some curvature, tending to flatten out at higher values of luminance.  I am not sure what the "758/761" in post #2 is because the code seems to muddle up the code for a light sensor with the code for a temperature sensor.

I guess that amplifier is just a unity gain buffer put there to make it look as if the board is worth more money.

I get the formula to be approximately  L = 350 * R-1.43  where R is in kΩ.

knut_ny

Swapped axis =>>  L = 350 * R-1.43  where R is in kΩ.

I still believe:  L =   63 * R-0.7    where R is in kΩ.

Ny

Archibald

I still believe:  L =   63 * R-0.7    where R is in kΩ.
Try putting R = 2.4 kΩ into your formula.  That should give L ≈ 100 lx.

knut_ny

Thank you. I swapped my axis.
Using the points from picture posted earlier, I get numbers 325*R-1.4

Ny

Go Up