finding capacitor value using RC time constant thingy, you know what i mean

MrChips

Joined Oct 2, 2009
34,884
I believe you are more or less engaging in Reductio ad absurdum
Most digital scopes use an 8-bit ADC. So straight off the bat your best estimate will have a 0.5% error.

We teach students RC time constant and exponential decay.

Charging

Discharging


Hence we want them to find the 1/e point on the curve, or (1-1/e) as the case may be. Hence 63% or 37%.

If they can do this to within 5% that is good enough for me. Our resistors are typically 5% tolerance and capacitors 20% in any case.
 

WBahn

Joined Mar 31, 2012
32,930
I apologize if I said something that you felt was an insult. It was not my intention to make a personal attack. My frustration was with my feeling that you weren't making a real effort to understand my explanation and by dismissing it as making little sense.
And I did mention that your analogy about a rotating shaft to show that a longer measurement is more accurate does not apply to a non-linear measurement (although I certainly understand it does apply to the rotating shaft).
Thanks for showing the detailed mathematical analysis of the problem. It would have taken me days to do that. Perhaps that's why I usually avoid doing them.
But I again apologize for saying something that you thought was insulting or was a personal attack. I feel bad about that. :( Sometimes I live up to my curmudgeon label when I shouldn't.
Apology accepted.

The part of your explanation that made no sense to me, and which I tried to convey, is that you completely ignored the effect of the longer measurement span. As I tried to point out, there are two competing effects, one that improves the measurement and one that degrades it. It is not sufficient to focus on either and just ignore the other. If we can just ignore the effect of the measurement span and focus only on the slope of the response, then we should get better and better results as we use endpoints that are closer and closer to the start of the waveform. But we know that this isn't the case, so an argument based solely on the slopes of the curve at the points where the measurements are taken can't suffice for saying which thresholds are best.

Instead we need to look at both effects and find the point/points where one begins to dominate the other.
 

WBahn

Joined Mar 31, 2012
32,930
Hi,

Actually we dont need an exact result anyway, but my only question is if you want to use 10 percent and 90 percent and end up dividing by 2.2 (actually ln(9)) then why not use 20 percent and 70 percent, which results in a divider of nearly 1.0 ? That way we dont have to remember the 2.2 along with the other stuff, although we do have to remember 20 percent and 70 percent.

I believe you are more or less engaging in Reductio ad absurdum
when you state that we can reduce the time further from the 63 percent point and thus get very bad results. We only need consider 63 percent and nothing less. On the other hand, we also only need consider the 90 percent point and not say 99.9 percent.

The point Carl is making is very simple: that the slope gets less steep the farther we go out from zero, and this makes the amplitude measurement less accurate. This can be easily found by looking at the slope at the two points 63 percent and 90 percent, and also getting a little sarcastic we can look farther out and find that it gets very difficult to figure out where say the 99 percent point is, and that is because the exponential stabilizes so slowly for larger time periods.
Slopes for different time values:
00 percent: 1.00
10 percent: 0.90
20 percent; 0.80
63 percent: 0.37
70 percent: 0.30
90 percent: 0.10

We quickly see that the slope is 1-p where p is the fractional percentage.
All other things equal, this shows that the measurement accuracy for a given fixed constant measurement error would increase for increasing 'percentage'. Since there are two slopes involved for any one measurement, if we take the average of the two slopes involved we get:
00 and 63 percent: 0.685
10 and 90 percent: 0.500
20 and 70 percent: 0.550

So the best average is 00 and 63 percent, although this is only looking at one dimension. We'd need to look at this as a two dimensional problem to really figure out the best accuracy, because scopes also have a limit on the time axis accuracy too. If it was perfect then 00 and 01 percent looks good: average is almost 1.00, but obviously that isnt a good idea either.

What i have to agree with though is that if we use BOTH methods we get a nice way to double check our results. The only question i have left then is why not use 20 percent and 70 percent, which results in a factor that is only 2 percent different from 1.000 (about 1.01 or so). So both 0 to 63 and 20 to 70 result in a factor of nearly 1.
You are trying to base your argument on just the slopes. You are claiming that if you average the slopes at the two measurement thresholds that the higher the average the better the result. Okay, so using this approach and restricting ourselves to the entries you've tabulated, the average at 00%and 10% is 0.95 so that must be far superior to 00 and 63, right. If not, then why not? Remember that whatever reasoning you use to say that 0% to 10% is NOT good, has to be taken into account in the discussion of the any other thresholds.

Also, the optimal thresholds are basically 0% and 67% and the average slopes at these two points is less the average at 0% and 63%.
 

WBahn

Joined Mar 31, 2012
32,930
Most digital scopes use an 8-bit ADC. So straight off the bat your best estimate will have a 0.5% error.

We teach students RC time constant and exponential decay.

Charging

Discharging


Hence we want them to find the 1/e point on the curve, or (1-1/e) as the case may be. Hence 63% or 37%.

If they can do this to within 5% that is good enough for me. Our resistors are typically 5% tolerance and capacitors 20% in any case.
'Good enough' and 'optimal' are not the same thing. While the notion of what is 'good enough' in a particular situation is important (and sadly often neglected), this part of the discussion was focused on what was optimal. And even when the components have a high tolerance we may want/need a particular measurement to exceed that tolerance -- that's what binning, for example, is all about, after all.
 

MrChips

Joined Oct 2, 2009
34,884
I was going to add earlier that there are more 'optimal' ways of measuring capacitance than using the exponential decay curve.

Two ways that come to mind:

1. Use a constant current source to charge (or constant current sink to discharge) the unknown capacitor.

2. Use a frequency/period measurement circuit.
 

WBahn

Joined Mar 31, 2012
32,930
I was going to add earlier that there are more 'optimal' ways of measuring capacitance than using the exponential decay curve.

Two ways that come to mind:

1. Use a constant current source to charge (or constant current sink to discharge) the unknown capacitor.

2. Use a frequency/period measurement circuit.
I definitely agree. Of course, each measurement technique brings its own set of parameter uncertainties into play. But here the issue was measuring the time constant given a first-order rise-time trace.
 

MrChips

Joined Oct 2, 2009
34,884
It's nice to know that once in awhile we are in agreement.

My point is it is good for students to see the exponential curve on the oscilloscope (or by other graphical means) and to relate 1/e with RC.

For accurate measurement of RC the two methods I suggest give better results.
 

MrAl

Joined Jun 17, 2014
13,720
You are trying to base your argument on just the slopes. You are claiming that if you average the slopes at the two measurement thresholds that the higher the average the better the result. Okay, so using this approach and restricting ourselves to the entries you've tabulated, the average at 00%and 10% is 0.95 so that must be far superior to 00 and 63, right. If not, then why not? Remember that whatever reasoning you use to say that 0% to 10% is NOT good, has to be taken into account in the discussion of the any other thresholds.

Also, the optimal thresholds are basically 0% and 67% and the average slopes at these two points is less the average at 0% and 63%.
Hi,

Actually i explained this in my last post second to last paragraph. I explained that this is really a two dimensional problem where we have to consider the time axis too. I even gave the example of 0 percent and 1 percent and noted that would not be good even though the slopes average to a very high value.

Quoted:
"Remember that whatever reasoning you use to say that 0% to 10% is NOT good, has to be taken into account in the discussion of the any other thresholds."

Well that's not really true. All i have to do is show that 0 to 63 percent is better than 10 to 90 percent. If you or anyone else brings up a better solution then i'll have to look at that. We know 0 to 10 percent isnt good, and 0 to 1 percent isnt good either. If we want to find the absolute best then we have to look for that.

Since you brought up 0 to 67 percent now we can look at that. Perhaps you can state how you came up with this solution.

As i stated, we have both amplitude and time to consider with possible errors in both directions.
Listing the amplitudes of full scale is easy, 0 percent is 0, 10 percent is 0.1, 63 percent is 0.63, 67 percent is 0.67, 70 percent is 0.70, and 90 percent is 0.90 .
But what about the time points?
They are (factional percentage of full scale amplitude, time):
0.00, 00
0.10, 0.1054
0.20, 0.2231
0.63, 0.9943
0.70, 1.2040
0.90, 2.3026
1.00, 5.0000

An error in say 0.10 of 1 percent of full scale is 0.01, and the error in 0.1054 of 1 percent of full time scale is 0.005.
That's the same for 0.90 also. So the higher values start to look better because the error in measurement looks lower in comparison. This makes 10 percent look better than 0 percent, but then 20 percent looks better than 10 percent.
Also, 90 percent looks better than 70 percent by a factor of 2.
But the absolute amplitude approach doesnt seem to work because there is a local percentage error due to the slope. The slope at 10 percent would not be as good as the slope at 63 percent, and the slope at 90 percent would not be as good as the slope at 63 percent just for a couple examples. That's because it's hard to spot a change of only say 0.01 percent (or any delta) when the slope is either steep or flatter. In fact looking at slopes alone, the best slope is when the tangent is 45 degrees for a square scope screen and the amplitude is adjusted for 5 units and the time axis adjusted for 5 time constants and the 5 units in vertical distance on the scope screen equals 5 time constants in horizontal distance on the scope screen. I use 5 time constants here as a reference because it means the best slope is a 45 degree angle which is easier to understand why the error must be minimum at that point. This would occur at 80 percent in amplitude and 32.2 percent in time. So the best error when adjusted as above and given a square screen would occur at that point.

So originally it looks like the best slope alone can provide the answer but that's only when we consider the vertical amplitude error. When we consider both vertical and horizontal errors we get a different result. What complicates this even further is that the two errors may be different which means the 45 degree angle above is no longer valid but must be compensated for by noting the errors in the two different directions. If the error in amplitude is twice of that in time, then a steeper slope is going to be preferred. This is probably important because crystals can be quite accurate while ADC units will be off by more.

You can start to see now that this discussion is getting more theoretical than practical. Still interesting though :)
I'd also like to hear more about your 67 percent result.
 

WBahn

Joined Mar 31, 2012
32,930
Hi,

Actually i explained this in my last post second to last paragraph. I explained that this is really a two dimensional problem where we have to consider the time axis too.
Yes, you did. Sorry.

Quoted:
"Remember that whatever reasoning you use to say that 0% to 10% is NOT good, has to be taken into account in the discussion of the any other thresholds."

Well that's not really true. All i have to do is show that 0 to 63 percent is better than 10 to 90 percent. If you or anyone else brings up a better solution then i'll have to look at that. We know 0 to 10 percent isnt good, and 0 to 1 percent isnt good either. If we want to find the absolute best then we have to look for that.
But if you are using a purely sloped-based argument to claim that 0 to 63 percent is better than 10 to 90 percent, then that argument better hold up at other percentages as well. After all, if it would say that 0 to 10 percent is better than 0 to 63 percent when we are in agreement that it isn't, then how can we accept it as a valid justification for saying that 0 to 63 percent is better than 10 to 90 percent?

Since you brought up 0 to 67 percent now we can look at that. Perhaps you can state how you came up with this solution.
The error analysis is done explicitly in Post #17. The only thing that is missing is to find the optimal points by taking the partial derivatives and setting them to zero and then solving the resulting two equations for the two limits, keeping in mind that we also have to allow for the possibility that the optimal points are at the ends of the domain and not necessarily where the derivatives go to zero. I chose to simply use Excel to graph the error multiplier and search for the minima. But we can do it analytically for completeness and to see if I actually found the correct value.

In this case, it is pretty obvious that the optimal limit for the lower limit (provided it is a sufficiently clean). This makes life a lot simpler.

\(
\frac{\Delta \tau}{\tau} \; = \; \( \frac{1}{\ln \( \frac{1 - \alpha}{1 - \beta} \)} \) \sqrt{ \( \frac{1}{\(1-{\alpha} \)} \)^2 \; + \; \( \frac{1}{\(1-{\beta} \)} \)^2} \( \frac{\Delta v}{V_0} \)
\)

For α=0, this reduces to

\(
\frac{\Delta \tau}{\tau} \; = \; \( \frac{1}{\ln \( \frac{1}{1 - \beta} \)} \) \sqrt{ 1 \; + \; \( \frac{1}{\(1-{\beta} \)} \)^2} \( \frac{\Delta v}{V_0} \)
\)

Taking the derivative is straight-forward, but does involve invoking the chain rule a number of times. At the end of this, we are looking for the value of β where

\(
\ln \( \frac{1}{1-\beta}\) \; = \; \[ 1 + \( \frac{1}{1-\beta}\)^2\] \( 1-\beta\)^2
\)

This is non-analytic and must be solved numerically. The solution is β≈0.67006431.
 

MrAl

Joined Jun 17, 2014
13,720
But if you are using a purely sloped-based argument to claim that 0 to 63 percent is better than 10 to 90 percent, then that argument better hold up at other percentages as well. After all, if it would say that 0 to 10 percent is better than 0 to 63 percent when we are in agreement that it isn't, then how can we accept it as a valid justification for saying that 0 to 63 percent is better than 10 to 90 percent?

The error analysis is done explicitly in Post #17. The only thing that is missing is to find the optimal points by taking the partial derivatives and setting them to zero and then solving the resulting two equations for the two limits, keeping in mind that we also have to allow for the possibility that the optimal points are at the ends of the domain and not necessarily where the derivatives go to zero. I chose to simply use Excel to graph the error multiplier and search for the minima. But we can do it analytically for completeness and to see if I actually found the correct value.

In this case, it is pretty obvious that the optimal limit for the lower limit (provided it is a sufficiently clean). This makes life a lot simpler.

\(
\frac{\Delta \tau}{\tau} \; = \; \( \frac{1}{\ln \( \frac{1 - \alpha}{1 - \beta} \)} \) \sqrt{ \( \frac{1}{\(1-{\alpha} \)} \)^2 \; + \; \( \frac{1}{\(1-{\beta} \)} \)^2} \( \frac{\Delta v}{V_0} \)
\)

For α=0, this reduces to

\(
\frac{\Delta \tau}{\tau} \; = \; \( \frac{1}{\ln \( \frac{1}{1 - \beta} \)} \) \sqrt{ 1 \; + \; \( \frac{1}{\(1-{\beta} \)} \)^2} \( \frac{\Delta v}{V_0} \)
\)

Taking the derivative is straight-forward, but does involve invoking the chain rule a number of times. At the end of this, we are looking for the value of β where

\(
\ln \( \frac{1}{1-\beta}\) \; = \; \[ 1 + \( \frac{1}{1-\beta}\)^2\] \( 1-\beta\)^2
\)

This is non-analytic and must be solved numerically. The solution is β≈0.67006431.

Hello again,

For what is is worth, if we define:
a=Sum(((-k)^(k-1)*2^k)/(e^(2*k)*k!),k,1,N)

which in words is:
"The sum of all [((-k)^(k-1)*2^k)/(e^(2*k)*k!)] for k from 1 to N"

for N odd and sufficiently large, then your Beta is:

Beta=1-sqrt(a/2)

But i did not follow your post #17 yet.

What i was getting at was that if we assume that the slope method is good for estimating the error in one dimension, then if we flip the scope up on it's side and look at the waveform like that then we have another slope to consider, the slope dt/dy rather than dy/dt.
Since a steeper slope results in less error one way and worse error the other way, it makes sense that a 45 degree slope would be the most accurate.
What complicates matters is the adjustment of the scope. If we adjust the vertical for a max of 1 and the time for a max of 5, then the 'perfect' slope appears at t=0, but if we adjust the vertical for a max of 5 and the time for a max of 5, then the 'perfect' slope appears around t=1.6 or so. So before we can define the right point we have to specify the scope adjustment also. We also need the relative accuracy of both vertical and horizontal.

You might also have noticed that i am trying to reduce the complexity of the discussion by trying to find the best point to make a single measurement (not two yet). Since we are now working in two dimensions, we find that 0 percent probably isnt as good as something higher unless the horizontal accuracy is much better than the vertical.

I'll have to look over your post 17 again and follow what your reasoning was. Are you using total differentials?
Very interesting BTW.
 
Last edited:
Top