Designing a lux meter with a phototransistor

Thread Starter

miguel angel expósito 1

Joined Aug 2, 2019
4
Hi,

I believe this is a pretty basic question but I haven't found anything that entirely covers my question in the forum so here I go:

I'm prototyping a feature that requires obtaining the approximate ambient light measurement in lux with a phototransistor and I need some help interpreting the datasheet.

My circuit is a simple common collector configuration (please see the attached file).
I need to adjust the range in a way that it will saturate at 65000 - 70000 lux

I'm trying to make sense of the datasheet (images attached) to choose the value of my load resistor.
The datasheet says:
- ON State Collector current (typical) = 2 mA when Vce = 5V and the irradiance is 1mW/cm2
- Collector-emitter saturation voltage (typical) = 0.4V when Ic = 2mA and the irradiance is 1mW/cm2

I don't have a lux meter to verify or calibrate, so I need to extrapolate this information to my particular case:
- 3.3V supply
- Saturation at 65000-70000 lux

What confuses me is the fact that the irradiance vs collector current chart is relative and not absolute.

So my question is: how to proceed?

Here's my guess:
- Apparently, 1 mW/cm2 = 6830 lux at 555 nm
- If I understand correctly, the relative irradiance vs collector current chart in this case just means that the relationship between irradiance and current is linear.
- If at 5V, 6830 lux is 2 mA, then at 3.3V it is 0,132 mA (3.3V/5V = 0,66 factor)
- Therefore if we put 68300 lux into the sensor (6830 x 10) then the current would be 10 times as much (1.32 mA)
- If the saturation voltage is 0.4V when Vce=5V, then in my case it would be 0.264V (x0.66 factor again)
- Therefore my resistor should be ((3.3V-0.264V) / 1.32 mA) = 23K

- And the ADC voltage reading would linearly scale with the lux reading from roughly 0V (there is a small voltage produced by dark current) and 3.036V, and that would be roughly 22496.7 lux per volt.
- With a 3.3V-referenced 10-bit ADC, I would have about 3.2mV per count or 72 lux per count.

Is this correct or I'm misinterpreting the information or the workings of the phototransistor?
Thanks in advance!
 

Attachments

Alec_t

Joined Sep 17, 2013
14,312
Welcome to AAC!
I haven't checked your calculations but would just like to point out that there is likely a wide spread in light sensitivity from one transistor to another, even with transistors from the same batch. That probably accounts for why you see only relative values, not absolute values, in the datasheet graphs. I think access to a commercial lux meter will be necessary for calibration.
 

Thread Starter

miguel angel expósito 1

Joined Aug 2, 2019
4
Thanks a lot for welcoming me!

I actually made a mistake in my calculations: 2 mA * 0.66 is 1.32 mA., and scaled x10 is 13.2mA
So my load resistor would be 230R, and not 23K

there is likely a wide spread in light sensitivity from one transistor to another, even with transistors from the same batch
Ah I see. Well, it doesn't have to be very precise. A rough estimate will do, as far as I can guess different lighting scenarios such as indoor lighting, darkness, direct sunlinght, ...
 

TeeKay6

Joined Apr 20, 2019
573
Thanks a lot for welcoming me!

I actually made a mistake in my calculations: 2 mA * 0.66 is 1.32 mA., and scaled x10 is 13.2mA
So my load resistor would be 230R, and not 23K



Ah I see. Well, it doesn't have to be very precise. A rough estimate will do, as far as I can guess different lighting scenarios such as indoor lighting, darkness, direct sunlinght, ...
Phototransistors have large variation from unit to unit (even for same model and same lot numbers); e.g. max vs min output at same illumination can vary 3:1 and more. They also exhibit significant temperature sensitivity, and possibly some aging. For some models, closer specs can be had by paying for preselected parts...but cost is high and there is still significant variation. You might consider photodiodes instead. They are more complex to use but can give more uniform results (but still with not insignificant variation). Otherwise, your design must allow for significant variation in sensitivity that is not always clearly revealed in datasheets. That is, calibration will be a necessity and temperature sensitivity must handled. You also need to consider the response vs the wavelength of the illumination.

A phototransistor is a current-controlling device. Specifically, the current through the phototransistor is primarily dependent on illumination and only secondarily dependent on voltage. Ideally your circuit should respond to current without changing the voltage across (collector-to-emitter) the phototransistor. The sensitivity to voltage is shown in one of the datasheet graphs, indicating that there is clearly an undesired effect from varying voltage.

One more point: You reference operation at 555nm. Per the graphs you attached and the datasheet, that specific model phototransistor has max sensitivity at 940nm--a very significant difference. From the graph of sensitivity vs wavelength you can see that your operation would be far away from the peak in an area of the graph having much slope. That means that at 555nm you could expect significantly more variation than at 940nm (and likely more temperature sensitivity as well).
 
Last edited:

DickCappels

Joined Aug 21, 2008
10,169
To measure Lux you need to measure incident light under the photopic curve (the black curve in the illustration below), which is represented by the Y curve in the 1931 CIE standard. To measure without this shaping of the response will result in large errors unless you always measure the same light source being reflected from the same surface (note: This is a loophole, though a limiting loophole.). Any change in coloration of the source or reflecting surface will cause errors, sometimes huge.
upload_2019-8-3_21-28-22.png
A typical phototransistor has a response similar to the one shown below.
upload_2019-8-3_21-22-32.png
Instead you can use a sensor with an appropriate response such as the ROHM BH1745NUC-E2 color sensor. The Green channel is a very good approximation of the CIE Y curve and the output is calibrated in Lux.

The IC is very small but I found a couple of places on the web where you can get breakout boards:
https://shop.pimoroni.com/products/bh1745-luminance-and-colour-sensor-breakout
https://www.robotshop.com/en/bh1745-luminance-colour-sensor.html

They are also on eBay starting at about US $3 per assembly but with long delivery times.

Or, you can just search using the term "BH1745" without the quotes.

Electronic Source in Thailand has the integrated circuits for less than $1 each, not counting mailing cost.
http://www.es.co.th/detail.asp?Prod=017610107

Remember that your luxmeter measures incident light coming from all angles so a hemispherical diffuser will needed for the best performance.
upload_2019-8-3_22-4-12.png.
This diffuser can be made by cutting a white ping-pong ball in half. Re-calibration is then necessary but that might be as easy as noting the difference in sensitivity with the diffuser off and on, though that puts some restrictions on the angle of light being used as a reference.
 

Attachments

Thread Starter

miguel angel expósito 1

Joined Aug 2, 2019
4
Hi @DickCappels ,
First, thank you very much for all the information!. Your reply shows a remarkable level of research and detail.
Now I understand why a simple phototransistor falls short when it comes to accurately measuring ambient light. I'll definitely take a look at the sensor you suggested.

This brings up a closely related question though:
I have another project where I have to design a device that needs to be able to distinguish between these 9 levels of ambient lighting perception as described here: https://docs.microsoft.com/en-us/windows/win32/sensorsapi/understanding-and-interpreting-lux-values
This device is not a measurement instrument, it's really low spec'd and its operation is not expected to be accurate at all. It's only expected to give consistent results across different units of the product.

The budget is very tight, and our provider suggested to use the same above mentioned phototransistor. Do you think I could get away with it if I:
1.- Calibrate every unit against a known source of light (bright and dim levels)
2.- Take into account collector voltage, ambient temperature and assume a 40 to 60% of variability due to the sensitivity of the phototransistor in the center of the visible spectrum.
3.- Do my real-life measurements with the actual device instead of relying on absolute lux values in the chart
4.- Don't care about a certain level of error

My guess is that the ranges of the lower lighting steps in the chart are so small, and the error potentially so big that I might not be able to detect them.
What do you think?
Can you suggest another low-cost alternative taking the phototransistor as a reference?

Best Regards
 

DickCappels

Joined Aug 21, 2008
10,169
You can probably succeed using a photo transistor. The instruments can be made repeatable if you measure the same light source, or more precisely if you always measure light sources with the same spectral distribution.

Offhand I would expect a little bit better linearity if you run the current from the transistor into a transimepdance amplifier. To get around the bottom end of the scale being compressed, you can run the signal through a logarithmic amplifier which may need temperature compensation for its drifting gain or a diode breakpoint approximation of a log function. Then the centers of the illumiinance levels will be linearly spaced.

The ranges:
upload_2019-8-5_20-18-34.png

The logs of the ranges:
upload_2019-8-5_20-19-0.png

Given that you want to indicate such a wide range, you might want to consider dark current compensation because the bottom of the range will drift with temperature.

You probably want to use a phototransistor for which you have a good datasheet so you can check on linearity, dark current, and a few other things.
 
Top