Capacitive discharge/RC Constant math help
xanatos
Posts: 1,120
Hello! I am looking at creating a simple RC circuit that will hang on the collector of an optoisolator. The circuit will consist of a single resistor and small-value cap in parallel with the collector/emitter leads of the photoQ. There will be some value of pull-up resistor on the collector of the photoQ (probably 10k). The RC network and the emitter of the photoQ share the ground level. I am looking to calculate the values of R & C here (and assuming an R-load of several megohms) such that it will give me a "basically" ripple-free DC signal output (within 10% or so ripple... just enough to guarantee a uC can read it reliably as a 1) with a square-wave-ish input with a duty cycle of say - 40%, but will allow the level to drop to 0 within a few cycle-times when the signal is removed from the input to the optoisolator.
I have always been great at just "shooting from the hip" and picking values that do what I want them to do and getting it right within a reasonable range, but I'd love to actually learn some more precise methods of doing this.
Given the following values:
Vcc: 5.0vdc
Rc: 10k
Rload: 10M
Signal Freq: 60Hz
Signal Waveform: Square
Signal %DC: 40%
How would I calculate the value of R for a given value of C (or vice-versa)? For the example, let's say I have a .1uF cap as C.
The math would have to take into account all of the above parameters such that I would be able to adjust for a change in %DC, or Freq, etc.
I am looking to create the following type of output based on the input to the RC network:
Input to network:
--_--_--_--_--_--_--_--_--_--_--_--__________________________
Output From Network:
\__________________________
Within reason of course (and in case your font isn't monospacing, that sloping slash line occurs when the pulse train drops out in the "input" waveform).
Thanks for your pointers here. I remember that I got some of this stuff aeons ago in college, but I never really needed to use it (I hated math back then - now I love it!)
Best,
Dave
I have always been great at just "shooting from the hip" and picking values that do what I want them to do and getting it right within a reasonable range, but I'd love to actually learn some more precise methods of doing this.
Given the following values:
Vcc: 5.0vdc
Rc: 10k
Rload: 10M
Signal Freq: 60Hz
Signal Waveform: Square
Signal %DC: 40%
How would I calculate the value of R for a given value of C (or vice-versa)? For the example, let's say I have a .1uF cap as C.
The math would have to take into account all of the above parameters such that I would be able to adjust for a change in %DC, or Freq, etc.
I am looking to create the following type of output based on the input to the RC network:
Input to network:
--_--_--_--_--_--_--_--_--_--_--_--__________________________
Output From Network:
\__________________________
Within reason of course (and in case your font isn't monospacing, that sloping slash line occurs when the pulse train drops out in the "input" waveform).
Thanks for your pointers here. I remember that I got some of this stuff aeons ago in college, but I never really needed to use it (I hated math back then - now I love it!)
Best,
Dave
Comments
You might ponder I=C dV/dt or as you are thinking RxC=time where R is in Ohms, C is in Farads, and t (of half-life) is in seconds.
If you desire filtering, it really isn't a 'formal RC decay circuit'. It is a filter application using capacitance to remove ripple and the resistance is mostly what in inherent in the circuit.
The basic theory is that you never really get rid of ripple entirely, you just drop it to an acceptable level. With a tiny megaohm load, I suspect a 1uf or 10uf capacitor would be very adequate for something that is 5VDC output, but that would slow down your pulse response - possibly too much. The rule of thumb is the the bigger the capacitor, the less ripple.
But, you may even find that you want a LC circuit to optimize filtering ripple rather than an RC.
Much depends on how much load you have and how unchanging your ripple frequency remains. Here you seem to want to remove a 60 cycle ripple and most discussion of 60 cycle ripple reduction is based around audio amp power stages (which have huge loads).
The bottom line is that the more ripple filtering you have, the slower your response will be. So the rate of your pulse train will become limited by the size of your ripple capacitor. What can you live with? If it is faster than 1/30th a second response, you may have design problems.
The Wikipedia article on Ripple might be more to the point than investigating an audiophile point of view about power supplies.
The central problem is that you want to keep the voltage high enough to keep the logic sensing voltage, but when the voltage shuts down, you don't want to add an unnecessary delay to the shut-down timing.
The Ripple formula applies to the first situation and
RC decay formula applies to the second situation.
Together, they might allow you to optimize the capacitor size. Actually, the two points of view are somewhat opposing. The first is about dropping below a threshold and the second is about keeping above a threshold.
Update: So far, the most useful part of Wikipedia for my inquiry is this page on RC Timing: http://en.wikipedia.org/wiki/RC_time_constant
A quick additional question is: Given that the approximate RISE TIMES for an RC circuit are ~ 1.4t (where t = RC, and you are calculating for a 20% charge to the 80% charge level), or if you are looking at the 10% to 90% charge level, the rise time is calculated as approximately 2.2t (or 2.2RC), would this also hold true for the fall times, given the capacitor discharging through the same resistor? In other words would the FALL TIME 90% to 10% = ~ 2.2RC as well?
That will form one part of my end formula, but doesn't take into account all the other variables... if there are any mathletes out there who have some additional input on what I am trying to do, I'm all ears!
Thanks,
Dave
f = frequency
R = resistance
C = Capacitance
(1/f)/2 << RC * 5
where << means RC * 5 is a lot more than (1/f)/2.
if (1/f)/2 = RC * 5 then the cap will charge to its final value in half the pulse width.
(1/f)/2 = T/2 and is the amount of time a 50% duty cycle is high or low.
RC is the time constant; t
At 5 time constants, RC * 5, the RC network will not full discharge in a single pulse.
Simplify
(1/f)/2 << RC * 5
T/2 << 5t
T << 10t
Solve for RC for a 60Hz 50% duty cycle
RC >> T/10
RC >> 60/10
If the Duty cycle is not 50% then you have two equations. One for the high pulse and one for the low.
On the one hand, the RXC = tau is useful, but not everything. It just provides a conceptual point of 'tau' that represents 0.37 of the original V.
http://www.electronics-tutorials.ws/rc/rc_1.html
You need to locate other points that are less than 'tau' on the natural log cure in order to find out when a certain sized capacitor will trigger you logic shift from 1 to 0.
TRY Vc = Vs (1 - (e x exp(-t/RC))) Where Vs is your 100% voltage and Vc is your ripple target (say 80% or 90%) for Voltage Across Capacitor
* Where:
* Vc is the voltage across the capacitor
* Vs is the supply voltage
* t is the elapsed time since the application of the supply voltage
* RC is the time constant of the RC charging circuit
That represents just half the problem, you still have to keep ripple above your cut off and ripple filtering usually assumes a sine wave. If you want to calculate for a 10% or 20% ripple originating from a sine wave, there are formulas both for full wave and half wave rectification, but other wave forms might require a bit of calculus to get to a real answer. But you are really going to have to dig into calculus if you pulse source is not a sine way or one of the other well published wave forms.
I was suggesting you use the Ripple Formula to get an estimate of capacitor size when power on, And using the Decay Formula to get an estimate of what is a minimal C when power is shut down AT ITS PEAK . Somewhere between the two should offer a good fit.
For a half-wave rectification:
Vpp = I/fC
where
* Vpp is the peak-to-peak ripple voltage
* I is the current in the circuit
* f is the frequency of the ac power
* C is the capacitance
Of course, power may be shut off anywhere in the sine wave cycle and so you have a range of response times dependent on how fully charged the ripple capacitor is at the time power is removed.
Considering that nearly all the the industrial revolution and the space race have been based on Calculus, the modern world wouldn't be what it is without Newton. It is a good thing to learn - even late in life.
Nowadays, the best source for free SPICE is Linear Technology, with their LTspice IV. Once you get over the tiny learning curve, you'll never look back.
@lardom: Isaac Newton, imho, was rather more than "one of the great minds in physics."