Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Calculs, tricks, stuff when learning capacitor ?

Status
Not open for further replies.
Hello!

Capacitor, condensor, it's all the same ?

That is the subject I entered today in my class.

We have a class of mathematics that will explain the calculation of capacity and stuff, with time, and the electro class which will be more focused but I guess pretty much the same somehow.

If I remember (I don't have my book in front of me) I can write a formula here:

C(t) = CV(1-e^(- t/RC)
 
Hi,

Sounds like he might be looking for math info on capacitors or trying to remember some of the theory or formulas. We'll have to wait for the return...
 
Hello,

Well, im not exactly sure what you mean by 'trick'. Do you mean you would like to approximate the behavior of a circuit with a capacitor in it without resorting to calculus and differential equations?
 
I don't want to burn the steps but yeah, if there's a global vision to have, maybe. I dunno, but I soon will have a more detailed question in the following days (I'll post here)
 
Hello again,


Well, one 'trick' would be to use a numerical solving method instead of trying to solve using calculus.
I want to warn readers that the derivation of this is going to sound a little involved, but in the end it works out very simply.

For example, for the circuit with one capacitor C being charged through one resistor R with a voltage source E we would write:

i=(E-Vc)/R

This is quite intuitive because if we know the cap voltage Vc and the source voltage E and the resistor value R then we can calculate the current though this series circuit.

Now taking the defining time equation for the capacitor (and read this as algebraic rather than from calculus, because we are ignoring calculus so far):
dv/dt=i/C

and to make the diversion from calculus more apparent we will write dv/dt as simply lower case v with an single quote like this: v'. Now rewriting we get:
v'=i/C

and if you ignore the quote this is still algebraic.

Now we multiply both sides by C and we get:
C*v'=i

Note this is still algebraic.


And now going back to the original equation for the circuit:
i=(E-Vc)/R

and substituting what we got for the capacitor:
i=C*v'

we get the whole equation:
C*v'=(E-Vc)/R

and now we solve for v' by dividing both sides by C and we get:
v'=(E-Vc)/(R*C)

and just to abbreviate R*C as simply RC we can write it as:
v'=(E-Vc)/RC

This equation has meaning as a differential equation, but here we look at it as purely algebraic, as if all the variables were simply algebraic so we never integrate. What this means is we dont have to use calculus if we use a numerical trick instead. That trick is to is to approximate v' as h*(E-Vc)/RC, where h is a very small number like 0.001 or even smaller, and that happens to be the increment in time. The idea is that successive Vc can be calculated by knowing both the old Vc value and the approximate value of v'.

The result looks like this:
Vc_new=Vc_old+h*v'

where Vc_old was the last value we got for Vc (the capacitor voltage) and Vc_new is the next capacitor voltage for the new time t+h.

Now i hope this doesnt sound like a lot of work, because for this circuit in practice it works out very simply. We calculate the first value of Vc knowing that the original value of Vc is zero (the start of time) and then that gives us the value of cap voltage for time t=0.001 (with increment h=0.001 again), then we use that new value of Vc to calculate the next value of Vc using the same equation. To see how simple this works out we have to do at least one example.

Example:
We have a 10v voltage source (say a battery) and a 1k resistor and a 1000uf capacitor. The voltage of the capacitor starts out at 0v at time t=0 and we want to find out what the voltage is after 0.010 seconds (10ms).

Starting with the circuit equation:
Vc=Vc+h*v'

Vc on the right is 0, and h is 0.001, and v' is calculated from the v' equation:
v'=(E-Vc)/RC

Now E is 10 and Vc is 0 and RC is R*C=1, so we get:
v'=(10-0)/1=10

Inserting this result for v' into the circuit equation we get:
Vc=0+0.001*10=0.01

so the first value of Vc is 0.01 volts.

Now the time increment h is 0.001 and the time we want to solve for is 0.01, so we have to do the equation 10 times to get to the required time value of 10ms. We did it once already, and got 0.01 volts for Vc, so now we have to do the same two equations again for the next time increment. Starting again from
Vc=Vc+h*v'

but this time Vc on the right is equal to 0.01 volts, so we have:
Vc=0.01+0.001*v'

and the next v' is:
v'=(E-Vc)/RC=(10-0.01)/RC=9.99/1=9.99

so the next Vc is:
Vc=0.01+0.001*9.99=0.01999

so we see now that we have done this twice so t=0.001+0.001=0.002, so we have to do it 8 more times. Lets make a little table:

t=0, Vc=0
t=0.001, Vc=0.01
t=0.002, Vc=0.01999

and now we simply keep calculating a new v' and a new Vc over and over, until we have done this a total of 10 times. Proceeding in the same manner as above we get values for each time increment of:

t=0, Vc=0
t=0.001, Vc=0.01
t=0.002, Vc=0.01999
t=0.003, Vc=0.02997001
t=0.004, Vc=0.03994003999
t=0.005, Vc=0.04990009995001
t=0.006, Vc=0.05985019985006
t=0.007, Vc=0.06979034965021
t=0.008, Vc=0.0797205593005598
t=0.009, Vc=0.0896408387412593
t=0.010, Vc=0.099551197902518

and so our final answer for the capacitor voltage Vc after 10ms is: Vc=0.099551197902518 volts approximately.

Knowing beforehand that the exact solution is Vc=10*(1-e^(-t/RC)) we calculate that out:
Vc=10*(1-e^(-t/RC))=10*(1-e^(-0.010/1)=0.0995016625083189 volts.

Comparing this last result for Vc with the approximate one above, we see a small difference in the fifth decimal place, which isnt too bad really for a simple approximation. In fact, the error is only about 0.05 percent (five hundredths of one percent), which is quite good.

So we see that the numerical approximation only involves steps of repeatedly calculating the same thing over and over again and comes up with a result that is close to being exact, but not exact. If we wanted a smaller error we could try decreasing the time increment h to a smaller value like 0.0001 but then we would have to calculate the two equations over and over again 100 times instead of just 10 like we did above. This is often best done with a computer program you write yourself or a programmable calculator. You can then graph the results too to see the entire time response.

I do want to point out though that the results with other circuits may not be as good until you find a small enough time increment. It takes a little trial and error sometimes to find the right value but it is quite simple to begin with so it's not too much trouble.
In particular, circuits with inductors and capacitors get a little wild in their responses so sometimes we have to move on to more powerful numerical approximations where the wild responses are taken into account so we could use larger time steps (h).

Just in case you find this method interesting and would like to know more about this and more powerful methods, the method we used above is known as "Eulers" method. A more powerful method would be for example a "Runge Kutta" method of higher order which im sure details of which are available on the web.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top