Go Down

Topic: Converting TEMT6000 value to lux (Read 2372 times) previous topic - next topic

cklim85

My apology as I'm a newbie in arduino.

Can anyone please advice me how do I convert the
output of TEMT6000 into lux?

I followed the code in bildr.org guide
http://bildr.org/2011/06/temt6000_arduino/

and the output value is from 0 - 1023.

I would like to convert the readings to LUX. How do I do it?

Please advice.

johnwasser

In the datasheet you will find a chart that shows the relationship between lux and collector current.  From that chart you can calculate the formula.  Then you just need to convert the voltage measured to a current measurement.

The series resistor is 10,000 Ohms so the current should be voltage / 10000.

The voltage is: analogRead() * 5.0 / 1024.0
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

cklim85


In the datasheet you will find a chart that shows the relationship between lux and collector current.  From that chart you can calculate the formula.  Then you just need to convert the voltage measured to a current measurement.

The series resistor is 10,000 Ohms so the current should be voltage / 10000.

The voltage is: analogRead() * 5.0 / 1024.0


Thank you for your advice. Based on the chart I find out that the formula is y = 1/2(x) + 0. Please correct me if I'm wrong.


johnwasser


Thank you for your advice. Based on the chart I find out that the formula is y = 1/2(x) + 0. Please correct me if I'm wrong.


I agree.  So lux = 2 * microamps.

Code: [Select]

float volts = analogRead() * 5.0 / 1024.0;
float amps = volts / 10000.0;  // across 10,000 Ohms
float microamps = amps * 1000000;
float lux = microamps * 2.0;


Or to mash it all together:
Code: [Select]

float lux = analogRead() * 0.9765625;  // 1000/1024


This should give you a value between 0 and 1000 lux.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

cklim85

Thank you for all your advices. Really appreciate it very much.

bitNine

Just found this thread while trying to figure out how to calculate lux with a cheap light meter I bought. NO data sheet available. I've checked the resistance of the photoresistor, and it's 20k ohms when dark, and close to 200 ohms with a bright flashlight. Attempting to use the code above, it seems that one flaw is that the voltage is backwards. The lux value goes down when light is added, and up when light is taken away. Swapping it so that it's the difference from 5 volts of the volts value (volts = 5.0 - volts), gets pretty close, but it's still not right. I have a cheap lux meter that I used to try to calculate a lux:ohms table. It's crazy how NOT linear the photoresistor is. While darkness is 20k ohms, 41 lux is ~6k ohms. 14k ohms for 40lux is certainly not linear to the max of 155 ohms at 110,000 lux.

The question is, might this just have to do with this specific photoresistor, or is it common for them to not have linear values like that? I have a TEMT6000 on order, and really want to be able to calculate lux values. Maybe my cheap lux meter is, um... cheap.

bitNine

For the record, I got the TEMT6000, and while it works, it FREAKS out with any light that is over 1000 lux. The calculation here works relatively well. Definitely different from the other light sensor I tested.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy