Adafruit has an ALS-PT19 Analog Light Sensor Breakout. It looks like it has a 10K resistor on it:

enter image description here

The ALS-PT19 datasheet says that resistor is to convert the output current of the transistor to voltage. Why would Adafruit have selected a 10K resistor?

Given a 5V power supply, I would assume the breakout would max out at about .5mA. Is that right?

Based on this graph, it looks like it'll max out at about 4K Lux, right?

enter image description here

If an overcast day is 1000 Lux and daylight is 10K Lux, was the decision to maintain precision at lower levels of the scale and let it saturate at anything higher than "almost daylight?"

Let's say I wanted to also have accuracy toward the really bright incandescent range where the output is as high as 5mA. If I wanted to do that, would I put a 1K resistor there instead?

If I wanted accuracy at both ends is there a way to include both the 10K resistor output and the 1K resistor output from the same phototransistor or would you put 2 phototransistors on the board for that?


The datasheet says that the

loading resistor shall be chosen to meet the requirement of maximum ambient light, and output saturation voltage

However, Adafruit cannot know what ambient light level and supply voltage you will be using, so the resistor is somewhat random. If it's too small for you, put another one in series; it it's too large, solder another one in parallel, or replace it.

You can switch between multiple resistors at the same phototransistor. Current flows only if the other end of the resistor is connected somewhere, so route the resistors to multiple GPIOs, and switch those between ground (low-level output) and high impedance (input).

  • \$\begingroup\$ Wow. That’s super smart and pragmatic! Both of those observations make so much sense. Thanks!! \$\endgroup\$ – D. Patrick Jan 18 at 12:09

You can do this


simulate this circuit – Schematic created using CircuitLab

The circuit attempts to regulate the "Vout"

  • \$\begingroup\$ What do you mean it regulates it? How does it do it? Thanks for answering my several newbie questions. \$\endgroup\$ – D. Patrick Jan 18 at 12:13
  • \$\begingroup\$ Suppose the clouds part, and the sun comes out, shining on D1 and producing 1milliAmp. Vout starts to rise, heading toward (1mA * 100Kohm = 100 volts) However, as C2 charges up to about 0.7 volts, that 1mA is almost totally conducted thru the transistor [we'll allocate that 0.7v as 0.1volt across R5 and 0.6 volts across emitter-base of the transistor. What Vout supports this?Assuming beta = 100, we need 10uA Ibase to provide Ic (or Ie) of 1,000uA (1mA). The current thru. R2 is 10uA Ibase plus 1uA thru R3, or 11uA total. Notice we assume D2 matches Q1, even tho the current is 1% of Q1. \$\endgroup\$ – analogsystemsrf Jan 19 at 3:42
  • \$\begingroup\$ In other words, Q1 provides negative feedback just like a properly wired and powered and loaded and input-biased OpAmp; however the transistor has low open-loop gain and imperfect sensing. We get useful behavior because of (a) the LOW VALUE of R5, and (b) the exponential nature of the emitter-base response to changes in voltage (0.026 delta V gives 2.718X change in current). \$\endgroup\$ – analogsystemsrf Jan 19 at 3:48
  • \$\begingroup\$ The transistor Vbe will change 0.058 volts per 10:1 increase (or decrease) in Ic (or Ib). To handle photodiode currents over a 1,000:1 ratio, the Vbe must change 3 * 0.058 or approx. 180 milliVolts. Given the use of that voltage divider ( those 2 100Kohm resistors), you should expect double that, or about 0.36 volts change in the STEADY STATE Vout. Thus changes in SOLAR FLUX and some 50Hz/60Hz fluctuations in incandescent bulb output, will be attenuated. \$\endgroup\$ – analogsystemsrf Jan 19 at 3:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.