Making sense of RC delay setup

Started by knutolai, March 03, 2014, 05:39:21 PM

Previous topic - Next topic

knutolai

Hi y'all!
I need to fade a LED on and off for use as a soft gate. The circuit below achieves this, but the fade-out time is approx. 8 times the fade-in time. From my understanding the time is takes for the capacitor to reach full charge is roughly equal to R1*C and the discharge time is close to R2*C (right?). I'm guessing the voltage drop over the diode has something to do with it, but even with R1=100k, R2=10k the fadeout time is longer. How come? I'm unable to test it without the diode as I need it to "read" the time delays.

Quackzed

not sure, but it occurs to me you could use a dpdt to connect to 9v and with the other pole, on the off side connect another resistor in parallel to the bottom resistor say 3.3k ish so theres a quicker fade out...
does that make sense? on the on side its as shown, on the off side theres less resistance to ground, due to the other resistor now being connected in parallel to the first, so the cap discharges faster.
nothing says forever like a solid block of liquid nails!!!

knutolai

That's a good idea. Thanks! I'm still interested in any explanation as to why this behaves as it does  :)

duck_arse

why not put the common of the switching element on the top of R1, whatever value. n/c to ground, n/o to +9 (or versi visa)? then you charge and discharge through the same resistance.

I think.
" I will say no more "

lungdart

Caps are considered fully charged usually at 4*RC if memory serves me.

Discharge time might be different because the LED is in the discharge path, but not the charge path. This will cause a smaller current flow while discharging to be less, which will make the cap stay charged for longer. Increasing R1s value should increase the charge time to match, likewise dropping R2 would lower the discharge time to match.
Electronics product designer
Stomp Labs Inc
Stomplabs.com

GibsonGM

Quote from: lungdart on March 04, 2014, 11:39:40 AM
Caps are considered fully charged usually at 4*RC if memory serves me.

Discharge time might be different because the LED is in the discharge path, but not the charge path. This will cause a smaller current flow while discharging to be less, which will make the cap stay charged for longer. Increasing R1s value should increase the charge time to match, likewise dropping R2 would lower the discharge time to match.

This is very close, I think.  5 time constants are required to say "fully charged/discharged", though - altho neither is ever really FULLY achieved.  Very close, however!! 

Could the threshold voltage of the LED be doing something here??
  • SUPPORTER
MXR Dist +, TS9/808, Easyvibe, Big Muff Pi, Blues Breaker, Guv'nor.  MOSFace, MOS Boost,  BJT boosts - LPB-2, buffers, Phuncgnosis, FF, Orange Sunshine & others, Bazz Fuss, Tonemender, Little Gem, Orange Squeezer, Ruby Tuby, filters, octaves, trems...

lungdart

Quote from: GibsonGM on March 04, 2014, 03:14:16 PM
Quote from: lungdart on March 04, 2014, 11:39:40 AM
Caps are considered fully charged usually at 4*RC if memory serves me.

Discharge time might be different because the LED is in the discharge path, but not the charge path. This will cause a smaller current flow while discharging to be less, which will make the cap stay charged for longer. Increasing R1s value should increase the charge time to match, likewise dropping R2 would lower the discharge time to match.

This is very close, I think.  5 time constants are required to say "fully charged/discharged", though - altho neither is ever really FULLY achieved.  Very close, however!! 

Could the threshold voltage of the LED be doing something here??

Woops, I meant 5 time constants, not 4!

And yes, I think the forward voltage drop is what is causing the discrepancy.
Electronics product designer
Stomp Labs Inc
Stomplabs.com

knutolai

Quotewhy not put the common of the switching element on the top of R1, whatever value. n/c to ground, n/o to +9 (or versi visa)? then you charge and discharge through the same resistance.

I think.

Tried this out and got really good results. Thanks a lot!

Does it draw a lot for current when repeatedly charging and discharging big caps? I'm currently using a 100uF cap. I would have used a smaller one, I cant increase the resistor values as that would decrease the maximum brightness of the LED.

GibsonGM

Throw a meter in series with it, see what it draws - maybe you can work out an average. I wouldn't think it would be too much, though. 

Woops, I meant 5 time constants, not 4!

Figured, it happens to me all the time!  Esp. since the last couple are almost "meaningless" for our purposes (so small a change, the 1st TC is major).
  • SUPPORTER
MXR Dist +, TS9/808, Easyvibe, Big Muff Pi, Blues Breaker, Guv'nor.  MOSFace, MOS Boost,  BJT boosts - LPB-2, buffers, Phuncgnosis, FF, Orange Sunshine & others, Bazz Fuss, Tonemender, Little Gem, Orange Squeezer, Ruby Tuby, filters, octaves, trems...

PRR

#9
> I'm unable to test it without the diode as I need it to "read" the time delays.

Get a good voltmeter.

If it's too fast for your needle/LCD, use a much larger cap to slow things down so as you can see what is really going on.

> Caps are considered fully charged usually at 4*RC {or 5*RC}

This is totally arbitrary. Something from textbooks.

What is "fully charged"? I put fuel in my car until "full". Is that...

*) an inch of air-space?
*) roof of tank is wet?
*) I see gas in the filler pipe?
*) overflow on my shoe?

Look what is really happening, in circuit, and in Knut's eye.

For a moment, neglect LED drop.

Take One RC. Voltage at that time will be 0.63 of supply. LED will be 63% of maximum brightness. You can hardly see the difference 100% bright or 63% bright. So it comes-on in One RC.

Now drain it. At One RC the voltage has dropped to 0.37. Even this 37% is not a lot dimmer than 100%. The LED is certainly "on". At Two RC it has dropped to 13%, which is dimming, but NOT "off". You can probably see a "glow" at 2%, which is Four RC.

> equal to R1*C and the discharge time is close to R2*C (right?).

No. You have the discharge right, but the charge calculation involves BOTH R1 and R2. What you really have is a 4.5V source and an 11K resistor. So your RC product is half what you thought, so the Voltage charges-up twice as fast as it drains.

And we've seen that the long tail of discharge gives "glow" far-far down the voltage curve.

Put the voltage drop back in. (Would be good to know what color. Red will have small effect but a 4V White LED against half a 9V supply can not be neglected.) I believe this increases the asymmetry as seen by the eye.

Duck's idea to slam the WHOLE shebang with a double-throw switch eliminates the electric asymmetry, but not the way the eye perceives a fade-out.

For faster fade with a single-throw switch.... wire top of R1 to +9V. LED stays on. To fade, put a resistor R3 across the 47ufd, perhaps 2K-3K. This diverts current from the R2+LED leg, and gives a faster discharge RC so the tail does not linger so long in the eye.
  • SUPPORTER

merlinb

#10
Quote from: GibsonGM on March 04, 2014, 05:59:57 PM

Woops, I meant 5 time constants, not 4!
Figured, it happens to me all the time!  Esp. since the last couple are almost "meaningless" for our purposes (so small a change, the 1st TC is major).

Actually, in most of the electronics industry, the figure used is 4*RC, because in control theory it is defined as the settling time. (4*RC is the time to charge to 98% of the final value. 5*RC is the time to charge to 99%).

GibsonGM

Quote from: merlinb on March 05, 2014, 04:16:01 AM
Quote from: GibsonGM on March 04, 2014, 05:59:57 PM

Woops, I meant 5 time constants, not 4!
Figured, it happens to me all the time!  Esp. since the last couple are almost "meaningless" for our purposes (so small a change, the 1st TC is major).

Actually, in most of the electronics industry, the figure used is 4*RC, because in control theory it is defined as the settling time. (4*RC is the time to charge to 98% of the final value. 5*RC is the time to charge to 99%).

+1, Merlin
I typically only consider 3 TC's, as that's close enough for most anything we do (95%).  But the "5TC" is the textbook definition, as you know.

I'm glad to hear that they DO use 4, it makes more sense.   Unless one enjoys sitting around (and around, and around) for the last 1%!!!!

Nice explanation on what's happening there, Paul - thanks.  It's all about the phsyics of the diode!
  • SUPPORTER
MXR Dist +, TS9/808, Easyvibe, Big Muff Pi, Blues Breaker, Guv'nor.  MOSFace, MOS Boost,  BJT boosts - LPB-2, buffers, Phuncgnosis, FF, Orange Sunshine & others, Bazz Fuss, Tonemender, Little Gem, Orange Squeezer, Ruby Tuby, filters, octaves, trems...

knutolai


merlinb

Quote from: GibsonGM on March 05, 2014, 08:49:32 AM
But the "5TC" is the textbook definition, as you know.

Not in any of my textbooks... it's always 4RC?

GibsonGM

#14
Really?? Wow.  
I was 'brought up on' old Navy texts....they were from the 60's, and you'd see, in passing, references to "a capacitor is considered fully charged after 5 time constants" with respect to input caps and the like.  Often found in conjunction with bleeders and such, for safety.  

American Radio Relay League (ARRL) Handbooks and the ubiquitous RC charts (http://www.alexpetty.com/wp-content/uploads/2011/06/figure12.png also use this convention, so I was under the assumption that a cap is universally (dis)charged after 5TC.    I do not know why there's a difference in 'what we'd call (dis)charged', only thought that it was universal - I never heard of the 4 TC thing before.  

This is from a Wiki entry(http://en.wikibooks.org/wiki/Electronics/Capacitors):
"Time Constant

In order to find out how long it takes for a capacitor to fully charge or discharge, or how long it takes for the capacitor to reach a certain voltage, you must know a few things. First, you must know the starting and finishing voltages. Secondly, you must know the time constant of the circuit you have. Time constant is denoted by the Greek letter 'tau' or τ. The formula to calculate this time constant is:

    \tau ={R}{C}\,\!

Great, so what does this mean? The time constant is how long it takes for a capacitor to charge to 63% of its full charge. This time, in seconds, is found by multiplying the resistance in ohms and the capacitance in farads.

According to the formula above, there are two ways to lengthen the amount of time it takes to discharge. One would be to increase the resistance, and the other would be to increase the capacitance of the capacitor. This should make sense. It should be noted that the formula compounds, such that in the second time constant, it charges another 63%, based on the original 63%. This gives you about 86.5% charge in the second time constant. Below is a table.
Time Constant    Charge
1    63%
2    87%
3    95%
4    98%
5    99+%

For all practicality, by the 5th time constant it is considered that the capacitor is fully charged or discharged." 
-----------------------------------------------------------------------------------------------------------------------------------------------

But again, that 1% is almost meaningless to every person I can think of!   Didn't mean to get anyone bugged by saying 5; I can picture somewhere that it might make a difference, but hardly for what we're doing!   Our frequencies aren't high enough....    

  • SUPPORTER
MXR Dist +, TS9/808, Easyvibe, Big Muff Pi, Blues Breaker, Guv'nor.  MOSFace, MOS Boost,  BJT boosts - LPB-2, buffers, Phuncgnosis, FF, Orange Sunshine & others, Bazz Fuss, Tonemender, Little Gem, Orange Squeezer, Ruby Tuby, filters, octaves, trems...

MaxPower

My first electronics textbook (© 1996) also says 5 time constants.
What lies behind us and what lies before us are tiny matters, compared to what lies within us - Emerson

duck_arse

Quote from: knutolai on March 04, 2014, 05:27:17 PM
Quotewhy not put the common of the switching element on the top of R1, whatever value. n/c to ground, n/o to +9 (or versi visa)? then you charge and discharge through the same resistance.

I think.

Tried this out and got really good results. Thanks a lot!

Does it draw a lot for current when repeatedly charging and discharging big caps? I'm currently using a 100uF cap. I would have used a smaller one, I cant increase the resistor values as that would decrease the maximum brightness of the LED.

the more I thort about this, and the more diagrams I drew, the mor complex it got, the more sure I was it was wrong. phewww! it works.

I think Mr. Ohm would tell us that the current charging/discharging would be limited by the series resistance and applied voltage.
" I will say no more "

lungdart

Quote from: PRR on March 05, 2014, 12:38:26 AM
> I'm unable to test it without the diode as I need it to "read" the time delays.

Get a good voltmeter.

If it's too fast for your needle/LCD, use a much larger cap to slow things down so as you can see what is really going on.

> Caps are considered fully charged usually at 4*RC {or 5*RC}

This is totally arbitrary. Something from textbooks.

What is "fully charged"? I put fuel in my car until "full". Is that...

*) an inch of air-space?
*) roof of tank is wet?
*) I see gas in the filler pipe?
*) overflow on my shoe?

Look what is really happening, in circuit, and in Knut's eye.

For a moment, neglect LED drop.

Take One RC. Voltage at that time will be 0.63 of supply. LED will be 63% of maximum brightness. You can hardly see the difference 100% bright or 63% bright. So it comes-on in One RC.

Now drain it. At One RC the voltage has dropped to 0.37. Even this 37% is not a lot dimmer than 100%. The LED is certainly "on". At Two RC it has dropped to 13%, which is dimming, but NOT "off". You can probably see a "glow" at 2%, which is Four RC.

> equal to R1*C and the discharge time is close to R2*C (right?).

No. You have the discharge right, but the charge calculation involves BOTH R1 and R2. What you really have is a 4.5V source and an 11K resistor. So your RC product is half what you thought, so the Voltage charges-up twice as fast as it drains.

And we've seen that the long tail of discharge gives "glow" far-far down the voltage curve.

Put the voltage drop back in. (Would be good to know what color. Red will have small effect but a 4V White LED against half a 9V supply can not be neglected.) I believe this increases the asymmetry as seen by the eye.

Duck's idea to slam the WHOLE shebang with a double-throw switch eliminates the electric asymmetry, but not the way the eye perceives a fade-out.

For faster fade with a single-throw switch.... wire top of R1 to +9V. LED stays on. To fade, put a resistor R3 across the 47ufd, perhaps 2K-3K. This diverts current from the R2+LED leg, and gives a faster discharge RC so the tail does not linger so long in the eye.

Very good points as always.

The charge voltage would actually be (9v-Vf)/2 which would be roughly 3.6V depending on the LED drop of course. And yes, the discharge rate would be based on the the charge of the cap, so if it was switched at 1TC, the discharge rate would appear much slower than the charge rate from a "fully charge" charged cap, and this would be the predominate factor in the difference.
Electronics product designer
Stomp Labs Inc
Stomplabs.com