This sensor has a usable range of about 3-55,000 lux. This covers a pretty wide range of indoor and outdoor lighting conditions:

Illuminance Example
0.002 lux Moonless clear night sky
0.2 lux Design minimum for emergency lighting (AS2293).
0.27 - 1 lux Full moon on a clear night
3.4 lux Dark limit of civil twilight under a clear sky
50 lux Family living room
80 lux Hallway/toilet
100 lux Very dark overcast day
300 - 500 lux Sunrise or sunset on a clear day. Well-lit office area.
1,000 lux Overcast day; typical TV studio lighting
10,000 - 25,000 lux Full daylight (not direct sun)
32,000 - 130,000 lux Direct sunlight

Simple Lux Measurement:

This sensor is simple to use with a microcontroller like the Arduino. Just connect the output to an analog pin and read. The sketch below reads the raw sensor input and converts the value to Lux. Since the logarithmic part of the output range extends from approximately 0.3v to 3.3v, we use the 3.3v pin as an external voltage reference to maximize the resolution.
/*
  Test sketch for the Adafruit Analog Light Sensor
  by Bill Earl
  for Adafruit Industries
  
  Connect sensor output to Analog Pin 0
  Connect 5v to VCC and GND to GND
  Connect 3.3v to the AREF pin 
 */

int sensorPin = A0;    // select the input pin for the potentiometer

float rawRange = 1024; // 3.3v
float logRange = 5.0; // 3.3v = 10^5 lux

void setup() 
{
  analogReference(EXTERNAL); //
  Serial.begin(9600);
  Serial.println("Adafruit Analog Light Sensor Test");
}

void loop() 
{
  // read the raw value from the sensor:
  int rawValue = analogRead(sensorPin);    
  
  Serial.print("Raw = ");
  Serial.print(rawValue);
  Serial.print(" - Lux = ");
  Serial.println(RawToLux(rawValue)); 
  delay(1000);
}

float RawToLux(int raw)
{
  float logLux = raw * logRange / rawRange;
  return pow(10, logLux);
}

This guide was first published on Jun 22, 2013. It was last updated on Jun 22, 2013.

This page (Programming) was last updated on Jun 11, 2013.

Text editor powered by tinymce.