# Measuring and Calculating Lux Values, Part 2

### A Quick Review

One way to measure illuminance, as discussed in the preceding article, is to use an optical sensor that is designed to approximate the spectral response of human vision. The datasheets for these devices usually have information that allows you to convert directly from output to lux; however, owing to the discrepancy between the ideal spectral response (i.e., the luminosity function) and the sensor’s spectral response, the accuracy of the measurement will vary depending on the spectral composition of the ambient illumination.

### The RGB Approximation

A highly accurate illuminance measurement could be performed as follows: first, you need an optical sensor with a “flat” spectral response—i.e., the sensitivity is the same for every wavelength in the visible spectrum. Call this the wideband detector. In addition, you arrange in close proximity numerous narrowband detectors fine-tuned to a particular wavelength. The wideband detector produces an output proportional to the overall light intensity, with each wavelength contributing equally, and the narrowband detectors reveal the spectral composition of the light. You can then apply the luminosity function,*based on this spectral information*, to the output of the wideband detector.

The precision achieved with this approach will be proportional to the number of narrowband detectors—more detectors means a more accurate representation of the actual spectral composition. Practical limitations quickly come into play, though, and furthermore—as discussed in the first article—highly precise illuminance measurements are unnecessary and, in a certain sense, impossible.

Thus, we can implement this approach but in a highly simplified form: we need a wideband detector with a fairly flat spectral response and three narrowband detectors. The obvious choice for the narrowband detectors are red, green, and blue—first, because RGB sensors are readily available, and second, because the RGB wavelengths divide the visible spectrum into three more or less equal portions:

This is the spectral sensitivity information for the Rohm RGBC sensor IC (p/n BH1745NUC) mentioned in the previous article. As you can see, the blue detector corresponds to about the lower one-third of the visible spectrum, the green detector corresponds to the middle one-third, and the red detector corresponds to the upper one-third. Note also that the response of the clear detector is fairly flat—actually, it is

*very*flat compared to the curves presented in the previous article, such as this one for the Fairchild phototransistor (p/n KDT00030TR) :

Nevertheless, the response of the Rohm part drops significantly at the lower wavelengths . . . I fully understand the difficulty this causes for those inclined to perfectionism—but remember, low-cost, low-complexity illuminance measurements are not an exercise in precision!

### Step by Step

$$\frac{160\text{}counts}{0.2\text{}\frac{W}{{m}^{2}}}=\frac{800\text{}counts}{\frac{W}{{m}^{2}}}=\frac{1\text{}count}{0.00125\frac{W}{{m}^{2}}}$$$$\frac{\frac{{\mathrm{}}^{}}{}}{}$$$$\frac{\frac{{\mathrm{}}^{}}{}}{}$$

1. We need to adjust the RGB measurements to compensate for the major differences in sensitivity. From the above plot we see that R is about 0.72 and B is about 0.56 when G is 1. Thus, we multiply the R and B values by the appropriate correction factor:

$$C{F}_{R}=\frac{1}{0.72}=1.39,\text{}\text{}\text{}C{F}_{B}=\frac{1}{0.56}=1.79$$$$\mathrm{}$$$$\mathrm{}$$

2. Determine the “portion” of the ambient light contained in the R, G, and B bands by adding up the three values and dividing each by the total. This approach presupposes the assumption whereby the R, G, and B values represent all the irradiance in the upper, middle, and lower third of the visible spectrum. For example, let’s say the corrected RGB outputs are as follows:

$$R=75\text{}counts,\text{}\text{}G=100\text{}counts,\text{}\text{}B=75\text{}counts$$$$$$$$$$

The “irradiance portion” (IP) for each color is thus
$$I{P}_{R}=\frac{75}{250}=30\mathrm{\%},\text{}\text{}I{P}_{G}=\frac{100}{250}=40\mathrm{\%},\text{}\text{}I{P}_{B}=\frac{75}{250}=30\mathrm{\%}$$$$\mathrm{}$$$$\mathrm{}$$

3. Find the irradiance-to-illuminance conversion factor for each color:

From this overlay plot we can estimate the following irradiance-to-illuminance factors, recalling that the maximum at 555 nm is 683:

$$IRtoI{L}_{R}=683\times 0.3=205,\text{}\text{}IRtoI{L}_{G}=683\times 0.9=615,\text{}\text{}IRtoI{L}_{B}=683\times 0.06=41$$$$\mathrm{}$$$$\mathrm{}$$

4. Multiply the irradiance portions by the appropriate IRtoIL factor, and add up the results to determine the overall IRtoIL factor for the particular spectral composition of the currently measured illumination:

$$IRtoI{L}_{overall}=(205\times 0.3)+(615\times 0.4)+(41\times 0.3)=320$$$$\mathrm{}$$$$\mathrm{}$$

5. Use the clear detector’s sensitivity to determine the wavelength-independent irradiance. Let’s say the clear output is 300 counts:

$$300\text{}counts\xf7\frac{800\text{}counts}{\frac{W}{{m}^{2}}}=0.375\text{}\frac{W}{{m}^{2}}$$$$\frac{{\mathrm{}}^{}}{}$$$$\frac{{\mathrm{}}^{}}{}$$

6. Finally—multiply the irradiance by the overall irradiance-to-illuminance conversion factor:

$$0.375\text{}\frac{W}{{m}^{2}}\times 320=120\text{}lux$$$$$$$$$$

### Discussion and Conclusion

*is finding the “average” conversion factor based on how much R, G, and B radiation is in the ambient light*. If the light were pure red, IR

_{R}would be 100%, and IP

_{G}and IP

_{B}would be 0%. Thus, the overall conversion factor would be the same as the conversion factor for red, i.e., 205. If the light were half pure red and half pure green, the overall conversion factor would be the average of the red and green conversion factors, i.e., (205 + 615)/2 = 410.

You might be wondering if the clear detector is really necessary here. That’s a difficult question. We could ignore the clear detector and simply interpret the sum of the three RGB measurements as the total irradiance, but we would end up ignoring irradiance that falls in the wavelengths not covered by the RGB sensitivity bands. However, if the wavelengths of this ignored irradiance are toward the edges of the luminosity function, it would actually be better to ignore it—if the RGB detectors don’t see it and the clear detector does, it will make an erroneously large contribution to the final lux value. I suppose the bottom line is that both approaches are feasible, with one or the other being more accurate depending on the spectral characteristics of the lighting conditions and of the clear detector—ignoring the clear detector is an easy way to eliminate error caused by its nonideal (i.e., non-wavelength-independent) sensitivity.

The procedure described here is perhaps more of a starting point. It should provide reasonably accurate illuminance measurements with minimal investment of time and money, but you should definitely consider ways to refine your algorithm based on empirical observations or, even better, by comparing your results to those of a high-quality lux meter.