# Using a variable resistor to dim an LED

My question is this: Can I use a variable resistor to control the brightness of an LED?

I was originally planning on using a potentiometer and an MCU to control the brightness with PWM, but that'd be a bit more difficult :). So, could I just connect the LED straight to my batteries through a variable resistor to control the brightness?

• What current range do you want to vary the LED? – jippie Jan 19 '13 at 14:54

## 3 Answers

Theoretically, yes you could use a pot to control the brightness of an LED. In practice, not so much.

To start with, let's assume that the LED has a $V_F$ of 2.0v, an $I_F$ of 20 mA, and our power supply has 5v. If we wanted a standard current limiting resistor it would have to be 150 ohms to limit the current to 20 mA.

With a pot, we also want a 150 ohm fixed resistor in series. The reason for this is that the pot will go down to 0 ohms, and we don't want to blow anything up in that case. So by putting the 150 ohm resistor in there there will be a maximum current of 20 mA through the LED.

Let's also say that we want the LED current to go down to 1 mA. Unless the pot has a super high resistance, it won't go down to 0 mA, and 1 mA seems like a reasonable lower limit. To make that work, our pot needs to be about 2K Ohms.

Going through the math, the maximum power dissipation on the pot is when it is at about 8%, and the resistance is 160 ohms. In this case the dissipation in the pot is about 0.016 watts -- which is fine for almost every pot. Even so, it is an important step to make sure you won't be burning up your pot.

But here is the important thing: The human eye has a logarithmic response to brightness. Let's say that we have 100% power going through the LED and we want to turn it down. It needs to go down to about 50% before we sense that as being reasonable. The next step down would be at 25%, etc.

Put a different way, if our knob was marked 1 to 10, then 10 would be 100%, 9 would be 50%, 8=25%, 7=12%, 6=6%, 5=3%, etc.

The problem is that a standard pot doesn't quite do that. It will work, and the LED will be dimmed. But a large part of the pots range (maybe 50%) will essentially be useless, producing very little change in brightness.

You might be able to use an audio pot, which has a logarithmic taper, but I'm guessing that the log part is in the wrong direction. (Sorry, even though I work in audio I don't use log taper pots.)

So yes, you can use a pot. It just might not give you the effect you seek.

• Wow incredible! I only got one line answer and you wrote a book in the same time. you are not human! +1 – RTOSkit Jan 19 '13 at 15:04
• Wow, thanks. You are clearly an electrical master. – Rees Jan 19 '13 at 15:58
• The POT will also, for some LED's, change the colour of emission. Often it isn't noticeable, but it can matter for some applications. – Lucas Jan 20 '13 at 2:21

Yes, you can. David isn't wrong that if you just had one variable resistance in series with the resistor, adjusting it wouldn't seem very linear in relation to perceived brightness. But if you introduce some resistors in parallel, the picture changes:

I tested these values with a red LED and it works pretty great. You could do all the math, but really it's just easiest to stick it on a breadboard and play with the values until you get the response you want. This works because as the current through the parallel combination of R2 and D1 increase, the dynamic resistance (that is, the resistance you would figure based on ohm's law at the voltage and current observed an one point) of D1 decreases, and it steals more current away from R2. Think of them like parallel resistors. The relationship isn't exactly logarithmic, but it's close enough no one can tell with unaided eyes.

You can also do pretty well just connecting the diode between the wiper of R1 and ground, and putting R1 across the power rails. Effectively, half of R1 becomes R2. The problem here is that at the low range of the pot's travel, the voltage at the wiper isn't high enough to turn the LED on at all.

I didn't worry about R1 going all the way to zero because most pots don't do that. Test your pot and add another $180\Omega$ or so in series with R1 if it's a problem.

• I just simulated this TINA TI free and find it really interesting how this works. I plan to use this method to tweak LED current using a potentiometer. I added a dropping resistor in series with the LED to absolutely limit the current and I like how I can now safely control the current without the power exceeding safe limits for the pot. Thanks for this. – BartmanEH Feb 14 '16 at 19:37

I just happened to have drawn an adjustable brightness LED driver that does use PWM. Maybe overkill, but it does work nicely:

3V is below spec for the NE555, but it does work anyway. Pick a CMOS 555 variant to get around this, or use more than 3V.

The interesting thing about this circuit is that, at least in theory, it is more efficient than driving an LED through a resistor. A resistor converts excess voltage into heat, but by using an inductor you can store energy at one voltage then release it at a different voltage with (in theory) no loss.

Of course this is just a proof of concept, not so carefully engineered, and almost surely far more complicated than necessary, but I thought it would be interesting to share, if only for educational purposes.

• You don't need the transistor circuitry when it's a normal LED. – user17592 Jan 19 '13 at 16:10
• @CamilStaps He is actually showing how to make a higher efficiency buck for controlling and has a dimmer control. It seems applicable, but not for the user who asked, maybe for many others. – Kortuk Jan 19 '13 at 16:34
• I know, and it's a good solution. But you can also use the 555 without the transistor, by connecting the LED directly to OUT. Does this, with transistor circuitry on pin 3, use fewer current than when connecting the LED directly to pin 3 of the IC? – user17592 Jan 19 '13 at 16:46
• @CamilStaps: the transistor is necessary in this application because the 555 output will both sink and source current. If the 555 were connected directly to L1 and D1, then its output would be fighting to drive the inductive load. You could get rid of L1 and instead put a resistor in series with D1, then drive it directly with the 555, but that wasn't the point of this circuit. Or, if the 555 had an open collector output, it could be made to work without an external transistor. – Phil Frost Jan 19 '13 at 18:20
• @CamilStaps you are right, and it is easier, but that's not the point. A resistor works by converting excess power to heat. An inductor stores it, then releases it into the LED. In theory, this circuit is more efficient. I haven't measured the efficiency of this circuit, so I don't know if it actually is, but the concept is sound, and with proper design, efficiencies can be in excess of 90%. – Phil Frost Jan 19 '13 at 20:36