I'm trying to use an LED. Its datasheet gives 1.8V to 3.3VDC as the minimum to maximum operating voltage. It also gives a 20 mA maximum operating current. The forward voltage of the LED is 2.2V. For the maximum operating current:

5V-R*I-2.2V= 0

5V-R*20mA-2.2V= 0

2.8V = R*20mA

R = 140

As long as I stay over 140 ohms for the current limiting resistor the operating voltage doesn't matter, right?

  • 1
    \$\begingroup\$ No as long as you don’t exceed 5V with that value. What you might mean is an active current limiter and watch out for Pd if Vin is excessive. \$\endgroup\$ Commented Aug 7, 2021 at 4:32
  • 1
    \$\begingroup\$ We infer that your supply of current comes from a fixed-voltage 5V source. In that case, you're all OK. An efficient modern LED may be rather bright @ 20mA. \$\endgroup\$
    – glen_geek
    Commented Aug 7, 2021 at 4:54
  • \$\begingroup\$ @TonyStewartEE75 can you elaborate "What you might mean is an active current limiter and watch out for Pd if Vin is excessive." I don't follow \$\endgroup\$
    – user256639
    Commented Aug 7, 2021 at 6:53
  • \$\begingroup\$ @glen_geek yeah you think so at 20mA? Guess I can just play around with different values later \$\endgroup\$
    – user256639
    Commented Aug 7, 2021 at 6:54
  • 1
    \$\begingroup\$ Single LED's do not vary this much in voltage, from 1.8 to 3.3. They are more like 2 to 2.2 or 3 to 3.2 for 20mA LEDs depending on colour and quality. Here is a simple current limiter using a 1.25V /R with a voltage regulator diyaudioprojects.com/Technical/Current-Regulator \$\endgroup\$ Commented Aug 7, 2021 at 12:56

3 Answers 3


The LED doesn't know what the supply voltage is - it only knows the current it is required to pass.

If you change the supply voltage, the current through the LED will change, because the voltage drop over the resistor will change.

You calculated the resistor value to give 20 mA with a 5 volt supply. If you change the supply to 9 volts, you will have to re-calculate the resistor value to maintain the 20 mA current.

Just a FYI: LEDs will work over a wide range of currents, but will be dimmer with lower currents (I once had to reduce the current for a green LED to less than 1 mA to get it dim enough for my application!).


Here is a useful formula (if needed, I can derive it for you):

$$\begin{align*} \%\,I_{_\text{LED}}&=\%\,V_{_\text{LED}}\cdot \frac{-1}{\frac{V_{_\text{CC}}}{V_{_\text{LED}}}-1} \end{align*}$$

Your LED specification says that the LED voltage is \$\sqrt{1.8\:\text{V}\cdot 3.3\:\text{V}}\approx 2.44\:\text{V}\pm 35\%\$.

We can use the above formula now to compute an expected \$-33\%\$ variation (the minus sign just means that an increase in the LED voltage leads to a decrease in the LED current) in current when trying out various LEDs using \$R=128\:\Omega\$. That may be fine to accept. But I think your idea of going with, perhaps, \$R=150\:\Omega\$ (or \$R=120\:\Omega\$), would also be acceptable. (The above doesn't take into account operating temperature variations.)

A more complex circuit using of two resistors and two BJTs can provide consistent current regulation almost without regard to the applied voltage and would certainly be workable in this situation of \$V_{_\text{CC}}\ge 5\:\text{V}\$. But it is probably an unnecessary complication here. If interested in that idea, look here.

  • \$\begingroup\$ I don't understand what you are trying to show me here. \$\endgroup\$
    – user256639
    Commented Aug 7, 2021 at 6:58
  • \$\begingroup\$ @kefffin Not much, then. I just wanted to point out that resistors have limitations in their ability regulate current. If none of what I said makes any sense to you, that's fine. Just take it to mean that "Yes, I think you are fine" with the resistor value you are headed towards given the voltage you mentioned. If you intend on supporting higher voltages, that is a different case. \$\endgroup\$
    – jonk
    Commented Aug 7, 2021 at 7:01
  • \$\begingroup\$ @kefffin -- In the link Jonk gave you is a constant current circuit that does better than the resistor for producing an even brightness over falling voltage of a battery power source. There is a slightly more efficient version in my answer to the Low Overhead Constant Current LED Driver question, which might be clearer to you, as the constant-current circuit is embedded in a bigger discussion. \$\endgroup\$ Commented Aug 13, 2021 at 19:38
  • \$\begingroup\$ @MicroservicesOnDDD It defeats all the work that goes into temperature and part variation stability, unfortunately. Worse, for the low overhead mentioned you must saturate the high side BJT and thereby lose current regulation for the LED, entirely. The high side BJT turns into a simple voltage source, then. Not so good. It will follow \$\beta\$ with more overhead tossed in, again. But then you've still lost the management properties and are subject to the BJT in use on the high side, both temperature and part vagaries. \$\endgroup\$
    – jonk
    Commented Aug 13, 2021 at 20:06
  • \$\begingroup\$ @jonk -- I thought I simulated my circuit vs the simpler (but less efficient) version in LTSpice, and my circuit seemed to have less variation due to temperature. What gives? I'm really just a beginner, and I'm not sure that I understand what you are saying. I think I need to ask an official question... So, what question do I ask? (please). \$\endgroup\$ Commented Aug 13, 2021 at 20:27

If you use the following circuit, the forward voltage of your LED will not matter -- you can actually swap in different LEDs and the constant-current circuit adjusts for it. The circuit also adjusts for changes in input voltage, so, as you'll see in the graph, the voltage is plotted from zero to 7 volts. This picture is of a white LED, which has a forward voltage of about 3.2 volts (which you can sort of see by where the voltage comes up).

LTSpice screen shot of circuit and graph of V1 and 3.2v-LED current.

Now, for this alternative run, I tried to approximate your circuit a bit more closely, by using three 1N4148 diodes in series, which has a total forward voltage of approximately 2.2 volts, which you said is what your LED presents. You can see that the circuit is exactly the same, and yet the LED current is still 20mA, even though the forward voltage is different. And this graph once again sweeps over the entire voltage range. You can see that, because of the lower forward voltage of your particular LED, that the current comes up at a lower voltage than with the white LED.

LTSpice screen shot of circuit and graph of V1 and 2.2v-LED current.

I have also done temperature variability runs on LTSpice with this, and the performance seems to be pretty good. The following graph of the temperature performance of the circuit is from -55 degrees Celsius to 125 degrees Celsius, in 10 degree steps.

LTSpice Temperature simulation of LED from -55C to 125C

I have been told that there are problems with this circuit, but I have made multiple prototypes and they have worked fairly well, yet I still consider myself to be a beginner, so I may not know what I'm talking about. Yet I have not seen this circuit elsewhere.

There are a few problems that I suspect. The first is oscillation. Because I'm using a circuit that has a much higher gain, it's basically a very strong amplifier, and that gives the opportunity for just a little bit of stray capacitance to ruin my day.

The second problem I suspect has the same cause as the first -- the high amplification. I believe, because of the high amplification, this circuit may be more susceptible to EMI, such as the ever-present 60Hz/50Hz line hum, but it could be anything. And I may not know until I've got a certain number in the field. So I should start small, and ramp up production lots slowly. Like 100, then 1,000, then ten-thousand.

The third problem that I suspect, is Beta variability, that transistors are known to have a large and wide bell curve of Beta values, and that means that unless the circuit automatically calibrates itself, or I get all my transistors from a source that's already been semi-binned (like I think a BC327-25 is?) And I'm sure it would help to have all of the transistors come from the same reel. Honestly, I don't know how bad this is because I don't know the variance of the Beta. The implication of this is that the constant-current value will be different for each circuit that is produced. I just don't know how much.

Do we put in a potentiometer at R9, find the value, then solder-in the right-valued resistor? Do I put a trim-pot in? An Arduino and a digi-pot? (Now that's overkill!) I don't know.

Hopefully, some of the true Electrical Engineers can verify where I'm right, and tweak/add/correct elsewhere.

Why do I like this circuit? I like this because I can separate that constant current part from PNP1, the "power" transistor, that drops all of the current, and that helps the circuit behave, and hopefully last longer. I like that I can switch out PNP1 with a bigger cheapo transistor, like a TO-220, which I can easily heat-sink or screw to the enclosure.

As your circuit stands, PNP1 gives off 60mW of heat at v1=5V, and 100mW at v1=7V. If you think this answer is the one, please accept it. If not, but you think it helped, (or I tried real hard), please hit the up-arrow and give me some credit. We work hard for the money! ;-)

  • \$\begingroup\$ Please see Jonk's answer and discussion on this circuit in the comments on his answer. And please give his answer a point too. \$\endgroup\$ Commented Aug 14, 2021 at 3:01
  • 1
    \$\begingroup\$ Just do what you didn't do -- run a simulation varying BF, ranging from 100 to 300, for your PNP1. That's all you'll need to see. Don't even bother with temperature. \$\endgroup\$
    – jonk
    Commented Aug 14, 2021 at 4:51
  • 1
    \$\begingroup\$ Something like this. I used my circuit developed from the other (long) link. And I used your circuit here. That way I avoided needing to do a redesign for my earlier circuit (which I wanted to avoid) and also avoided any need to criticize or think about your design. Just used both, as given. \$\endgroup\$
    – jonk
    Commented Aug 14, 2021 at 4:59
  • 1
    \$\begingroup\$ For lower-overhead voltage, a current mirror is indicated. It can get to about one diode drop (or slightly less, but then perhaps an added 100 mV or so more to handle BJT vagaries) and this is somewhat better than two diode drops (less a very little bit.) But even if you were to use a well-designed current mirror arrangement as I'm suggesting, it's still not all that good as there are other problems related to the different emitter resistors required. It just doesn't really pay off well enough. For something like this, you want an IC design where more is under their control. \$\endgroup\$
    – jonk
    Commented Aug 14, 2021 at 8:06
  • 1
    \$\begingroup\$ The cost of about 1 mA for delivering 20 mA is well worth its cost. It's simple and it works and it costs only an added 5%. It's just not worth screwing around to reduce this, further. Not in discrete circuits, anyway. \$\endgroup\$
    – jonk
    Commented Aug 14, 2021 at 8:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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