# Caution: noob question enclosed

Thread Starter

#### EvolveElectronics

Joined May 22, 2011
5
As the title suggests i have somewhat of a noob question. I require the use of a series of LED's to fade out as they turn off. I do not want to use any PWM because all available PWM channels of my Uc are in use doing something else. So my alternative is to just use a transistor or mosfet to turn the circuit on and then have the current drain through a capacitor and resistor in series with one another to ground.

The question is how would i calculate the wattage of the resistor that is in series with the capacitor. The reason i can't wrap my head around this is because not all of the current is actually going through the capacitor / resistor combo. Some of that current is still going to be going through the series of LED's other wise it wouldn't fade. Is there a way to know how much current is going through each?

I have attached an image for the sake of clarity. The cap would be 68uf the resistor in line with that would be 1.5kΩ, the current limiting resistor for the LED's would be 2.5Ω the LED's draw about 750ma each. The supply voltage is 12V. This causes the current limiting resistor to be a very high wattage. Lets say about 10W. Just wondering if there is a formula to calculate the wattage of the resistor in series with the cap then. Thanks for any help you can give.

Thread Starter

#### EvolveElectronics

Joined May 22, 2011
5
Sorry for the image being so big, i will be sure to make them smaller, or attachments next time.

#### ErnieM

Joined Apr 24, 2011
8,199
dang that image is BIG. next time try the preview button.

I don't see how this is powered as Vss is typically at ground. Is that your 12V? Then I don't see how the N FET is being driven.

And as to what you asked, I don't see what the cap is doing either; if the 12V has ripple it's probably OK to let it trickle into the LEDs.

With no cap you don't need no resistor.

#### Adjuster

Joined Dec 26, 2010
2,148
If you really want 750mA drive current (those must be big LEDs!), then I do not think that the resistor in series with the capacitor can possibly be as big as 1.5kΩ for a decent fade effect.

When the FET turns off, the only path for the current will be via the capacitor and 1.5kΩ: I think you will find that the current would drop instantly to just a few mA, so the afterglow would be extremely feeble.

I think you would be better to work out a way of turning off the FET slowly, but note that the FET may need more heat-sinking if this is other than PWM.

Thread Starter

#### EvolveElectronics

Joined May 22, 2011
5
Thanks for the fast response time. The fet in the circuit was just thrown in there it is not what i plan on using. I just had to whip something together for a graphical representation. The LED's are big, 3 watt's a piece. That was my mistake i meant to label the voltage source vdd. The schematic is just a concept i will probably use more lower powered LED's rather than 4 higher power ones.

@ErnieM

The cap is there to fade out the LED's once the mosfet is turned off.

When the FET turns off, the only path for the current will be via the capacitor and 1.5kΩ
Wouldn't the current still be flowing through the LED's to ground as well, thus creating the fade effect? This is where my question stems from, how do i know how much current is actually going through the capacitor vs the series of LED's

I think you will find that the current would drop instantly to just a few mA, so the afterglow would be extremely feeble.
Would raising the value of the capacitor to say... 1000uf be more suitable? and potentially use a higher Ω resistor to slow the drain time?

#### Wendy

Joined Mar 24, 2008
22,647
There are other ways to do PWM besides microcontrollers. It really is the more efficient method. However, you can use transistors in the linear mode to do the same thing, and not use the giant capacitors you are thinking about.

LEDs, 555s, Flashers, and Light Chasers
Chapter 5 - PWM
Chapter 12 - Special effects

There is another problem with what you drew. Assuming those are red LEDs you are going to need more than 12V just to turn them on. If they are white or blue you will need more than 17 volts.

#### Adjuster

Joined Dec 26, 2010
2,148
Would raising the value of the capacitor to say... 1000uf be more suitable? and potentially use a higher Ω resistor to slow the drain time?
A big cap. might help, but I concur with Bill Marsden that this is not the best approach. More importantly, can't you see that a large resistor in series with the capacitor almost isolates it from the LEDs, so that although the time constant may be long, only an insignificant current will be maintained through the LEDs, making the fadeout ineffective?

#### hobbyist

Joined Aug 10, 2008
890
Hi,

Here is another approach to your design,
it was built and it works fine.

Maybe you could gleem something from this concept, to work with in a solution for your design.

The switch represents a input signal positive going.

The capacitor can be made smaller to change lower the RC time constant (delay in turn off).

R1 and C1 forms a time constant for charging up, R1 is used only to keep the capacitor from shorting the signal input, the actual delay in turn off of the LED is a time constant consisting of the base current discharging the capacitor through the diode.

So the LED current is to some extent having a play in the discharge of the capacitor as well.

The diode allows the LED to turn on imediately, while steering current through the Discharging of the capacitor during delay off duration.

Last edited:

#### ErnieM

Joined Apr 24, 2011
8,199
OK, so the cap is in parallel with the LEDs for "dimming."

With the FET on, the cap charges to Vdd. When the FET turns off, you want the cap to supply the same current as just before the FET turns off, so the series resistors with the cap should be zero; of course this means when the FET turns on an uncontrolled but very large chunk of current flos into the cap.

So don't do that. Plus the fade is going to be unpredictable and very hard to change.

You seem to have a spare micro output but no PWM hardware. Do you have any spare processing cycles to make a software PWM? You get it up to anything over 30 Hz and it should appear on solid.

Thread Starter

#### EvolveElectronics

Joined May 22, 2011
5
@Bill_Marsden

I read through a bunch of your blog entries and found it quite educational. I have only been doing hardware design for about a year now. Unfortunately because of my background in programming i went straight to Uc's due to there convenience of use. However, if i could do it again i would have started with the basics of analog circuitry and worked my way up. Thanks for your insight.

@Adjuster

I can understand what you are saying now about the isolation of the capacitor in series with the resistor to ground. The flow of electrons will try to find the path of least resistance to ground. By raising the value of the resistor essentially more current will be flowing through the series of LED's causing the fading effect to be minimal if not visibly present at all.

@hobbyist

I believe the design that you referenced is what Adjuster suggested.
I think you would be better to work out a way of turning off the FET slowly, but note that the FET may need more heat-sinking if this is other than PWM.
Like he stated above the mosfet would be in the linear state rather than in saturation mode causing excessive amounts of heat. As this would be occuring for only a short time and not to often I believe that this would be the best solution for my problem.

Thanks to all of you for your replies i have learned a lot here today and I am happy to now be a member of this forum. Happy Designing!

Thread Starter

#### EvolveElectronics

Joined May 22, 2011
5
@ErnieM

Yes i have a digital I/O left. The micro (ATMEGA328 ... told you i was noob) has a set number of PWM output pins that are internally oscillated via internal hardware at a rate that is set by the firmware. I also thought about using software timers in conjunction with regular digital I/O pin to create a high condition , delay for a set number of micro seconds, then pull the digital output low. This could be repeated in a loop however, this seems like a waste of programming space and processing power.To me its not the most proper way of accomplishing what i needed. Like i said before I'm kind of a noob, so i could be totally wrong about that.

Similar threads