# Measuring light intensity with LEDs

I was curious how well could an LED work as a light meter, like the ones used in photography. In principle LEDs should work well when treated like photodiodes, their current response should be linear in terms of incident light power.

### LEDs

So I grabbed a few different LEDs, connected them one by one to a multimeter, and checked the generated current. Well, actually I measured the voltage, because the current itself was too low, and I am hoping that Ohm's law applies to my multimeter. It turned out that among the LEDs I have the red one in transparent casing was the most light sensitive one. I wrapped it around with black paper to allow light to hit the junction only after entering through the head of the casing.

![A red, transparent-casing LED used for this experiment] (/static/posts_content/led_meter/led_wrapped.jpg)

To check whether the LED of my arbitrary choice is responding linearly to incident light I had to find another light-sensitive device. I used my DSLR camera, a Nikon D60. When set to fixed-aperture, fixed-ISO mode, a DSLR camera is essentially a light measuring device, where the computed inverted shutter time is proportional to the incident light power.

### The angle of view

In this setting, the remaining variable that needs a little bit of consideration is the focal length of the lens. Intuitively, the camera should cover roughly the same are the LED does.

![Estimating LED sensitivity spherical angle] (/static/posts_content/led_meter/led_angle_measurement.jpg)

By holding the LED above a flat, fixed surface and plugging it to a power source we can calculate the angle of radiation, $$\alpha$$. In this case, where the diode is about $$89 \textrm{mm}$$ above the surface, and the diameter of the red area is about $$37 \textrm{mm}$$, we compute that $$\tan\left(\frac{\alpha}{2}\right) = \frac{37 \textrm{mm}/2}{89\textrm{mm}} = 0.208$$

The CCD sensor in a Nikon D60 has dimmensions $$23.6 \textrm{mm}$$ by $$15.8 \textrm{mm}$$. The average of these numbers is $$19.7 \textrm{mm}$$, and yes, computing the average of these quantities is an arbitrary choice here. The question is: what focal length should we choose to get the angle of view $$\alpha$$ in the DSLR?

By doing a sketch and applying a few optics rules (or by going to Wikipedia), we get the formula for the angle of view: $$\tan\left(\frac{\alpha}{2}\right) = \frac{d}{2 \cdot f}$$ where $$d$$ is a distance as measured on the sensor, and $$f$$ is the focal length. Let's set $$d$$ to be the average of CCD sensor's dimensions, this is $$d = 19.7 \textrm{mm}$$. Overall, the above calculations give us the answer: $$f = 47.4 \textrm{mm}$$.

### Measurements

By setting the camera into fixed-ISO, fixed-aperture mode, and changing the focal length to around $$47 \textrm{mm}$$, we should get a device that measures about the same light intensity as the LED connected to a multimeter does. So I attached the black-paper-wrapped LED next to the camera, aligned it to look in the same direction as the camera does. I set the focal length in the camera lens to about $$47 \textrm{mm}$$, the aperture to f/7.1, and the ISO to 400.

Finally, the entire set has been positioned to look at my neighbor's wall for a few hours during sunset, while I took readings every once in a while. The results are on the below plot:

![LED voltage vs inverted shutter time] (/static/posts_content/led_meter/plot.png)

While reading this plot the important fact to remember is that cameras do not use arbitrary shutter speeds. The speeds are aligned to nearest "round" value, where the "round" values are spaced approximately exponentially through the shutter speed range.

### Conclusion

The conclusion: LED does behave linearly when treated as a photodiode, at least when compared to a Nikon DSLR. So it could work as a light meter.