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.
float volts = analogRead() * 5.0 / 1024.0;float amps = volts / 10000.0; // across 10,000 Ohmsfloat microamps = amps * 1000000;float lux = microamps * 2.0;
float lux = analogRead() * 0.9765625; // 1000/1024