Sizing a potentiometer

Thread Starter

twoskinsoneman

Joined Dec 8, 2022
3
Hi. I'm putting together a panel that will have 27 small indicator LEDs on it. I'm thinking I'd like to have a way to dim them all if the room the panel is in has the lights turned off.
There are 3 different colors so each LED will have a resistor to on it sized to typical IF. (example- Red LED 2.0v IF=20ma. It's 12vdc so 500ohm resistor).
(12v-2.0v/.02a =500ohm). I'd then like to take the common from all the LEDs and run them through a POT to "ground".
I'm trying to figure out what size POT I need. Not only how ohms it will take to dim them down but also how many watts the POT needs to dissipate.
Thanks!
 

Ya’akov

Joined Jan 27, 2019
6,854
Welcome to AAC.

The right way to dim LEDs is with PWM. If you use a variable resistor you will create a lot of heat and you might need a rather large component.

In theory you could use a small potentiometer and a transistor which isn't as good but it's better than everything through one pot.
 

BobTPH

Joined Jun 5, 2013
6,073
Another problem with using a resistor to dim is that the brightness will vary depending on the number of indicators that are on. Using PWM in the common does nor have this problem.
 

ElectricSpidey

Joined Dec 2, 2017
2,179
First: Running different color LEDs at the same current won't produce the same apparent brightness.

Second: The method you propose will dim the blue and green LEDs before the others.

I would suggest you test each LED for the brightness you want, then use PWM to dim the entire display.
 

Tonyr1084

Joined Sep 24, 2015
7,198
What pops into my head is a current mirror controlled with an LDR and a "Max" current resistor (or pot). As light gets brighter, depending on which LDR you choose, the current mirror will allow more current go to the LED's or dim them.

I've never built a current mirror but I hear they're pretty simple. However, I don't know how much heat they will dissipate. 27 LED's running at a max current (max brightness) of 20mA would only be 540mW. That's not a small wattage, but it's not a huge wattage either.

Here's a text on current mirrors. Something even I need to review.
https://www.allaboutcircuits.com/textbook/semiconductors/chpt-4/current-mirrors/

[edit] LDR's resistance decreases as light increases.
http://lednique.com/opto-isolators-2/light-dependent-resistor-ldr/
[end edit]
 
Last edited:

dl324

Joined Mar 30, 2015
15,439
I'm putting together a panel that will have 27 small indicator LEDs on it. I'm thinking I'd like to have a way to dim them all if the room the panel is in has the lights turned off.
You haven't told us how the LEDs are wired. If it's 27 LEDs in parallel, each with their own current limiting resistor, that would be over half an amp. That's a lot of current for a pot; aside from the fact that PWM is the better choice.

If you add a photo sensor, you could have the brightness change be automatic.

Here's a single comparator PWM from National Semiconductor AN74:
1670514346643.png
Circuit description:
1670514400863.png
1670514464718.png

PDF contains oscillator equations referenced. The frequency for the PWM isn't very critical. A kHz would be fast enough to avoid issues with flicker.
 

Attachments

Last edited:

Reloadron

Joined Jan 15, 2015
7,074
There are 3 different colors so each LED will have a resistor to on it sized to typical IF. (example- Red LED 2.0v IF=20ma. It's 12vdc so 500ohm resistor).
I can tell you how I would go about it. First and as covered already using a potentiometer is not a good way to control LED brightness or intensity. That is a given. The way LEDs are normally controlled is using PWM (Pulse Width Modulation) which is really not all that complex. Next I would take a play from Tony's playbook:
What pops into my head is a current mirror controlled with an LDR
I would use an LDR (Light Dependent Resistor) to sense ambient room light. Just about any inexpensive LDR will likely work just fine. An LDR in series with a resistor will give an analog voltage out proportional to the ambient light. So now I have an analog voltage based on light to work with. I run this signal into a small micro controller and get 3 channels of PWM out. one channel for each LED color. I would use a cheap MOSFET to drive each channel of LEDs. That would look a little like this:

LED RGB MOSFET DRIVEN.png

In this example there are three channels and the LEDs are red, green and blue. Common anode LEDs with three LEDs in series and a single current limiting resistor and 12 VDC applied. The MOSFETs are actually FQP3906L logic level mosfets driven with PWM. The LED brightness will be a function of room ambient light. Not as complex as it sounds depending on your abilities. I have used the concept in the past. The uC code also is not difficult and can likely be found on the web or here if you take this route.

Ron
 

Tonyr1084

Joined Sep 24, 2015
7,198
We still don't know if each individual LED has power - resistance - LED - Gnd - - - OR if LED's are in series by color, or if ALL LED's are in a single series. We don't know the starting voltage either. The TS does give us an "Example" but doesn't say that's specifically how things are powered. With 12V and LED's with a Vf of 2 (RED only) we would have to make a number of assumptions. But "Assuming" 12V and 2Vf, we can series up to 5 LED's. At 20mA, the TS would want a 100Ω resistor for those five LED's. BUT - we don't know how many of each color, how they are wired, what colors the others are or what their individual Vf's are. The best we can do is give general guidance. A current mirror and an LDR could give an automated dimming affect when ambient light level drops. We just need to wait until the TS comes back with more details. Hopefully some sort of wiring schematic as well, along with each color and Vf of the LED's and the numbers of each type of LED being used. Also, since these are indicators, I would again assume they are individually controlled. IF that's the case I'd recommend a master voltage and current applied to each LED, then each LED is switched by whatever sensor or switch it is monitoring takes that individual LED to ground.

I will remain silent until the TS makes further comment with details as requested.
 

WBahn

Joined Mar 31, 2012
27,863
Hi. I'm putting together a panel that will have 27 small indicator LEDs on it. I'm thinking I'd like to have a way to dim them all if the room the panel is in has the lights turned off.
There are 3 different colors so each LED will have a resistor to on it sized to typical IF. (example- Red LED 2.0v IF=20ma. It's 12vdc so 500ohm resistor).
(12v-2.0v/.02a =500ohm). I'd then like to take the common from all the LEDs and run them through a POT to "ground".
I'm trying to figure out what size POT I need. Not only how ohms it will take to dim them down but also how many watts the POT needs to dissipate.
Thanks!
As others have stated, you won't get the results you are looking for by trying to put a potentiometer in series with all of these. This approach MIGHT work if all of the LEDs were nominally the same AND the number of LEDs that were on at the same time was always constant. In your case, the first assumption is definitely not valid and since these LEDs are there to indicate things, the second is almost certainly just as invalid.

Using current mirrors is a very elegant approach, but you need a transistor per LED. Also, don't use the classic current mirror topology that you'll find in textbooks, almost all of which assume you are working with closely matched transistors (as would be the case in an IC design). Instead, use ballast resistors to set the current. With 12 V, you have plenty of voltage overheard for this. Doing so will make the matching between the transistors completely irrelevant.

If you want to use PWM, then a single FET in the place where you want to use a pot will work. It's basically a switch that turns on or off all of the LEDs simultaneously. A given LED will either be on at full brightness or it will be off if that LED is not being powered. What fraction of the time they are on will determine the perceived brightness. One problem you might have is if an LED that is OFF has 0 V applied to its anode (as opposed to being electrically isolated as would be the case with a switch), then when the entire array is switched off, all of the LEDs that are "on" will apply a reverse voltage to all of the LEDs that are "off", and many LEDs can't tolerate more than about 5 V of reverse voltage. The current limiting resistors that are in place MAY prevent damage, but a better approach is to put a normal silicon diode in series with each LED and let it block the reverse voltage and limit any reverse current to its reverse leakage current. Again, with 12 V, you have plenty of overhead for this.
 

Thread Starter

twoskinsoneman

Joined Dec 8, 2022
3
Thanks everyone. Your insights are appreciated. Especially the fact (though I should have thought about it) that similar current through different color LEDs will produce different apparent brightness. Some more details. It's a 12vdc system. No LEDs are in series. They are all indicators that must be lit individually. The circuit is mostly 12+ - LED - Res -Gnd. Though sometimes that same LED will be switched over by relay to 555 output - LED - Res - Gnd to make the LED flash. There are some bi-color common anode LEDs that will be 12+ - Anode - separate res on cathodes based on color - then cathodes feed SPDT switch so one or the other is grounded.
 

dl324

Joined Mar 30, 2015
15,439
No LEDs are in series. They are all indicators that must be lit individually. The circuit is mostly 12+ - LED - Res -Gnd. Though sometimes that same LED will be switched over by relay to 555 output - LED - Res - Gnd to make the LED flash.
It would be helpful if you posted a schematic so we can understand more clearly what you're trying to describe.

A bipolar 555 timer will sink or source 200mA, so you might not need relays.
 

Reloadron

Joined Jan 15, 2015
7,074
On second thought forget my last post. If you are good with manual just go and Google 3 channel LED dimmer. Something like this or similar. Actually you will find versions using a single control. Google will bring up plenty of options to choose from and most really inexpensive. I would also add if each LED is an indicator for a specific reason then all bets are off as to using 3 or any in series configuration. :)

Ron
 
Last edited:

ThePanMan

Joined Mar 13, 2020
519
Hello. Are you saying each LED is a 12 volt LED in its own housing? If so then it already has current limiting internally. No series LED's - 12 volts - that sounds like an indicator like this. If so - then PWM is the way to go.
 

MrAl

Joined Jun 17, 2014
9,626
Hi,

I dont know how much power you are dealing with but if there is significant power involved then a buck is the way to go.
A buck circuit is a true power converter while PWM is not. PWM can dim, but it will waste just as much power as using a resistor. That seems strange, but it is true. What happens is there is still resistance in the circuit no matter what you do, and the PWM works into that resistor. Since the PWM pulses are always maximum and the PWM switch is near zero Ohms, that one resistor will be found to dissipate just as much power as if the resistor was sized for the required brightness and there was no PWM just connected to the main voltage power source.
A buck on the other hand actually converts the power from the power source to the power required for the given brightness at the time, and that means it is usually much more efficient. The time when it is not as efficient is if the LED (or string) voltage is matched closely to the power source voltage, but that can only be true for a narrow brightness setting range so it's not a significant design point for full variable brightness schemes.
This does require a decent buck circuit too though as the efficiency of the buck circuit should be as high as possible.

If you have any doubts about the efficiency of PWM vs BUCK we can go through the math or you can do a simulation and measure power consumption in both circuits and compare.
Of course if you can not do a buck circuit then PWM is still much better than a potentiometer. With PWM you can dim the LED without needing a pot rated for high power, sometimes referred to as a rheostat, which can be both bulky and expensive.
 

WBahn

Joined Mar 31, 2012
27,863
I dont know how much power you are dealing with but if there is significant power involved then a buck is the way to go.
The problem with using a buck converter to adjust the supply voltage, relative to using PWM, is when you are trying to control the brightness of multiple LEDs that have different voltage drops, which is what the TS is trying to accomplish.

If you use PWM, then the duty cycle of the waveform translates into the fraction of full LED current regardless of forward voltage. But if you adjust the supply voltage to reduce the current in one of the LEDs by a particular fraction, LEDs that have higher forward voltages will be reduced by a greater fraction (and LEDs that have a lower Vf will be reduced by a lesser fraction). The more you move away from the design point, the greater the discrepancy. At some point you completely shut off the high-Vf LEDs while still allowing current in the others.
 

Jerry-Hat-Trick

Joined Aug 31, 2022
207
Assuming you are not using a processor, maybe use a 555 to generate your PWM signal. See https://www.electronicshub.org/pwm-led-dimmer-using-ne555/
Please forgive me for repeating myself but this is the simplest possible solution. From your original post it looks as if you are selecting resistors which will vary in value according to the typical voltage drop across the different colour LEDs so that the current with a 12V supply will be 20mA in each. Whilst you are doing this, it would be good to compare the perceived brightness of the different colours at 20mA - typically the green LEDs appear brighter so you might want to increase the resistor values for green LEDs to reduce the maximum current.

With 27 x 3 x 20mA you are looking at a maximum of 1.6 Amps - a walk in the park for a power transistor turned on and off with the 555 as shown. This will control the overall brightness. Scroll down the link to see:1670589528489.pngTo turn on and off LEDs individually, insert a (small signal) transistor between the LEDs and the 2N2222 collector.

Hope this helps
 

MrAl

Joined Jun 17, 2014
9,626
The problem with using a buck converter to adjust the supply voltage, relative to using PWM, is when you are trying to control the brightness of multiple LEDs that have different voltage drops, which is what the TS is trying to accomplish.

If you use PWM, then the duty cycle of the waveform translates into the fraction of full LED current regardless of forward voltage. But if you adjust the supply voltage to reduce the current in one of the LEDs by a particular fraction, LEDs that have higher forward voltages will be reduced by a greater fraction (and LEDs that have a lower Vf will be reduced by a lesser fraction). The more you move away from the design point, the greater the discrepancy. At some point you completely shut off the high-Vf LEDs while still allowing current in the others.
I am not sure i see what you mean here.
Are you saying that, for example, if you use a constant voltage to power two LEDs of different forward voltage that one will get less current than the other, but using PWM they will run fine?
Remember that PWM is adjusted for the current but the current is also dependent on the equivalent resistance of the LED and any extra series resistance used to reduce the current to start with. The peak current is going to be higher for the lower voltage LEDs than the higher voltage LEDs, there's no way around that. If you use resistors to match them up, then you would use resistors to match them up with the buck also.
This is if i understand you correctly.

Last resort use two buck circuits one for each color LED, or three bucks if there are three different color LEDs (with different voltages of course).
 

WBahn

Joined Mar 31, 2012
27,863
Are you saying that, for example, if you use a constant voltage to power two LEDs of different forward voltage that one will get less current than the other, but using PWM they will run fine?
Do the math.

What is the maximum current through an LED with a source voltage of Vmax, a forward voltage drop of Vf, and a series resistance of R?

Imax = (Vmax-Vf) / R

What does the duty cycle of a PWM waveform need to be in order to make the average current a fraction, α, of Imax?

Id = α·Imax

Since the average current is simply the fraction of the time that the LED is on at full current, α is merely the duty cycle of the PWM waveform, independent of what either Vf or R happens to be. So if you have two LEDs, one of which has a forward voltage drop of 1.8 V and a series resistance of 680 Ω to yield a max current of 15 mA at that the max supply voltage of 12 V, then a 40% duty cycle PWM waveform will reduce that to 20% of its max value (or 6 mA). If the other has a forward voltage drop of 3.6 V and a series resistance of 330 Ω to yield a max current of 25 mA at a that same max supply voltage of 12 V, then a 40% duty cycle PWM waveform will also reduce that to 20% of its max value (or 10 mA).

But what does the supply voltage need to be reduced to in order to achieve that same reduction in current?

Id = (Vs-Vf) / R = α·Imax = α·(Vmax-Vf) / R

Vs = α·(Vmax-Vf) + Vf

Vs = α·Vmax + (1-α)·Vf

For the first LED, the supply voltage needs to be reduced to

Vs = (40% · 12 V) + (1 - 40%) · 1.8 V = 5.88 V

This produces a current of

Id1 = (5.88 V - 1.8 V) / (680 Ω) = 6 mA

as desired. But what is the current in the other LED?

Id2 = (5.88 V - 3.6 V) / (330 Ω) = 6.9 mA

which is only ~28% of its original current, not 40%

If you go to 10% brightness on the first LED, which needs 3.84 V, the second LED is reduced to 0.7 mA (or just 3%). Although this has significant uncertainty in it because you are now operating very close to the forward voltage and so small variations in Vf have significant impact, either due to process variation or do to the fact that Vf is not a constant, but is rather a function of current.

This is another advantage of using PWM. Since the LED is always operating with the same current, the variation in Vf with current is taken off the table. The variation in Vf from device to device is also minimized because that variation as a function of the voltage across the resistor is at its lowest at the maximum voltage.


Id
 

MrAl

Joined Jun 17, 2014
9,626
Do the math.

What is the maximum current through an LED with a source voltage of Vmax, a forward voltage drop of Vf, and a series resistance of R?

Imax = (Vmax-Vf) / R

What does the duty cycle of a PWM waveform need to be in order to make the average current a fraction, α, of Imax?

Id = α·Imax

Since the average current is simply the fraction of the time that the LED is on at full current, α is merely the duty cycle of the PWM waveform, independent of what either Vf or R happens to be. So if you have two LEDs, one of which has a forward voltage drop of 1.8 V and a series resistance of 680 Ω to yield a max current of 15 mA at that the max supply voltage of 12 V, then a 40% duty cycle PWM waveform will reduce that to 20% of its max value (or 6 mA). If the other has a forward voltage drop of 3.6 V and a series resistance of 330 Ω to yield a max current of 25 mA at a that same max supply voltage of 12 V, then a 40% duty cycle PWM waveform will also reduce that to 20% of its max value (or 10 mA).

But what does the supply voltage need to be reduced to in order to achieve that same reduction in current?

Id = (Vs-Vf) / R = α·Imax = α·(Vmax-Vf) / R

Vs = α·(Vmax-Vf) + Vf

Vs = α·Vmax + (1-α)·Vf

For the first LED, the supply voltage needs to be reduced to

Vs = (40% · 12 V) + (1 - 40%) · 1.8 V = 5.88 V

This produces a current of

Id1 = (5.88 V - 1.8 V) / (680 Ω) = 6 mA

as desired. But what is the current in the other LED?

Id2 = (5.88 V - 3.6 V) / (330 Ω) = 6.9 mA

which is only ~28% of its original current, not 40%

If you go to 10% brightness on the first LED, which needs 3.84 V, the second LED is reduced to 0.7 mA (or just 3%). Although this has significant uncertainty in it because you are now operating very close to the forward voltage and so small variations in Vf have significant impact, either due to process variation or do to the fact that Vf is not a constant, but is rather a function of current.

This is another advantage of using PWM. Since the LED is always operating with the same current, the variation in Vf with current is taken off the table. The variation in Vf from device to device is also minimized because that variation as a function of the voltage across the resistor is at its lowest at the maximum voltage.


Id
Hello again,

Ok i see your point now, the main problem is that the current is not linear with a change in Vcc because of the series voltage drop of the LED(s).

One way around this would be to get the two non linear curves to be about the same. This would improve the match as Vcc changes.
The efficiency still suffers though so perhaps the better solution is to use two different buck circuits.

Here are two plots one with just two resistors for the two LEDs set for max current at max Vcc, and the other with a diode in series with the lower voltage LED as well as a series resistor to set the max current at the max Vcc voltage. The match over the Vcc range gets better. If there are series strings it may be possible to adjust the number in one string vs the other with a possible readjustment of the top end currents. The plots show the normalized percentage of current not the actual percentage unless the two LEDs have the same efficacy.
If these were higher power LEDs or several strings (series/parallel) though the losses could be extreme so two bucks would be better i think.

Here are the two plots. We can see the series diode helps but wont be perfect.
The horizontal green line is the 50 percent current for the top most trace in both plots.
 

Attachments

Top