Measuring and Calculating Lux Values
Turn your photosensor signal into an illuminance measurement.
In a previous article, we defined illuminance as the perceived level of ambient brightness, taking into account the objective light intensity and the spectral response of the human eye. Illuminance is the standard metric for predicting how well a human being can see and perform necessary activities under given lighting conditions. Thus, if an electronic device needs to imitate a human response to ambient illumination—e.g., automatically dimming a display to compensate for lower light levels, or adjusting interior lighting in response to natural illumination from windows—the device must know how to determine illuminance.
The trouble is, photosensitive components tend to generate output signals in the form of current or voltage, not lux. Furthermore, lux is inherently specific to human vision: the defining characteristic of illuminance is that measurements are adjusted according to the wavelength sensitivity of the human eye. If the sensitivity characteristics of your photosensor are not consistent with those of the human eye, you are not measuring illuminance.
Irradiance measures the objective intensity of electromagnetic radiation per unit area. The SI unit is watts per meter squared. Watts is defined as joules per second, and the joule is a unit of energy—thus, irradiance is proportional to the rate of electromagnetic energy transfer per unit area. This transfer of energy is what evokes a subatomic response from photosensitive electronic components, so calculating a lux value begins with establishing the relationship between irradiance and the output of a sensor.
Let’s look at some sensitivity specs for a few different photosensors.
OSRAM PIN photodiode, p/n SFH 2701:
Fairchild phototransistor, p/n KDT00030TR:
Rohm red-green-blue-clear ambient light sensor IC, p/n BH1745NUC:
The first thing you may have noticed is that the folks at Fairchild have saved us some trouble—the phototransistor’s sensitivity is provided as a plot of output current vs. illuminance. You can use this plot to estimate the lux value from the output current generated by the sensor; however, this is not quite as straightforward as it seems, as we will discuss later in the article.
The other two parts provide sensitivity data that some might consider more intellectually satisfying, because it is less abstracted from the physical phenomena that determine the relationship between light intensity and output response. The photodiode generates 1.2 µA for 0.5 mW/cm2 of 650 nm irradiance. A little unit conversion tells us that the sensitivity is
1.2 μA5 Wm2=0.24 μAWm21.2 μA5 Wm2=0.24 μAWm2
In other words, if the photodiode is generating 0.24 µA of output current, the irradiance is 1 W/m2 (of course this is true only if the wavelength of the light is 650 nm—more on that later). In contrast to the simple photodiode, the Rohm part is a highly integrated ambient illumination sensor that provides separate digital output values for red, green, blue, and full-spectrum light intensity. The spec shown above is for the full-spectrum (aka “clear”) detector. In this case the sensitivity relates irradiance to digital counts rather than current. The average output value is 160 with irradiance of 20 µW/cm2, so the sensitivity is
160 counts0.2 Wm2=800 countsWm2=1 count0.00125Wm2160 counts0.2 Wm2=800 countsWm2=1 count0.00125Wm2
Once you know sensitivity, you can make an initial conversion from sensor output to illuminance in lux. The magic number is 683:
1 Wm2 at 555 nm=683 lux1 Wm2 at 555 nm=683 lux
Unfortunately, if you simply apply this conversion factor to the output of your sensor, your illuminance measurement could be pretty bad. As you probably already noticed, this factor is valid only for electromagnetic radiation at 555 nm. Remember the luminosity function, discussed in a previous article:
The sensitivity of the human eye changes drastically from one wavelength to another, and consequently the conversion factor from irradiance to illuminance also changes drastically. The number given above is the conversion factor for the wavelength of peak human-eye sensitivity, and thus every other conversion factor will be less than 683. To make matters even worse, the spectral response of the photosensor is not the same as the spectral response of the human eye! So somehow we have to compensate for the fact that two separate photosensitive elements—the human eye and the photosensor—are more or less sensitive to the countless different wavelengths of electromagnetic radiation concealed within the whitish light illuminating our environment.
This seems hopeless, but the first thing to understand is that illuminance simply cannot be measured with the sort of precision we expect from thermometers or voltmeters or digital calipers. For that we would need either 1) a photosensitive device with spectral response identical to that of the human eye or 2) separate narrowband photodetectors, each with known sensitivity, fine-tuned to numerous wavelengths within the visible spectrum. Furthermore, such precision is by no means necessary or even possible. Who really cares whether their office is illuminated at 450 lux or 470 lux? Indeed, a high-precision lux measurement is almost a contradiction in terms, because illuminance is supposed to represent a human response to lighting conditions—and how often do humans agree on something so subjective? Bring two people into a room and ask them to rate the ambient brightness on a scale of 0 to 1000 . . . how often do you think you’ll get the same number?
So calculating lux is an exercise in approximation, and in this case, an approximate value is just fine.
Don’t burden yourself by selecting a photodiode or phototransistor that isn't designed to approximate the spectral sensitivity of the human eye. The following image shows the spectral response of the OSRAM photodiode (mentioned above) superimposed on the luminosity function:
Trying to compensate for such extreme discrepancy is simply not a good use of time.
Instead, select a device with a human-vision-based spectral response and with output-to-lux conversion information provided in the datasheet. Such devices are not hard to find; one example is the Fairchild phototransistor mentioned above.
However, something in this plot doesn’t seem quite right—why are there two different current vs. lux relationships, one for an incandescent bulb and one for a fluorescent bulb? We should not need to adjust illuminance measurements based on the nature of the light source, because the process of calculating illuminance automatically accounts for variations in spectral composition. Well, what you see in the plot is a way of compensating for the difference between the phototransistor’s sensitivity curve and the luminosity function:
These are fairly consistent, but far from perfectly matched, so the light intensity detected by the phototransistor cannot be directly converted to lux. The workaround is to determine different conversion factors based on the spectral composition of different light sources. Fairchild did this for incandescent and fluorescent light, but what about sunlight? Or white LEDs? Or halogen bulbs? Well, as we said, an approximation should be good enough when it comes to illuminance. Just look for a part with a datasheet that provides sufficient information for your particular application. Here is an overlay for an ambient light sensor (Vishay p/n TEPT4400) described as “sensitive to visible light much like the human eye”:
Clearly, an uncorrected lux value based on this device will not be fabulously accurate. The peak wavelength is close to optimal, but wavelengths in the upper and lower third of the visible spectrum will make far too much contribution to the output current.
We have covered the basics of photodetector sensitivity and how this sensitivity is related to illuminance. You know what sort of parts to look for if you need to generate simple, reasonably accurate lux values. In the next article we will discuss a more complex approach in which the output from a wideband photosensor is modified based on spectral data from red, green, and blue photosensors.