Author Topic: Understanding the RC circuit equation  (Read 1876 times)

0 Members and 1 Guest are viewing this topic.

Offline AzmarithTopic starter

  • Newbie
  • Posts: 8
Understanding the RC circuit equation
« on: November 16, 2019, 06:05:47 pm »
Hey everyone,

I've been having some trouble understanding something, and was hoping that people here might be able to help figure it out.

I've been trying to derive the output of a basic RC as shown below:



I'm trying to derrive how the capacitor charges and discharges. Though, I'm only going to go over how the capacitor charges in this post, as I'm assuming that I'm making the same mistake for both charge and discharge.

I know that the equation to describe the charing of the capacitor is:



However, It doesn't take into account the initial voltage accorss the capacitor, plus I would like to derrive it from Ohm's, Faraday's, and Kirkoff's laws in order to get a better mathematical understanding of the circuit.

I've tried two approaches: one where I (wrongly) assume that the current flowing into the capacitor is a constant, and another where I subsitiure the current as derived from Ohm's and Kirkoff's laws into faraday's law. I find that both methods have elements that look correct, but are totally different, and are both wrong.

Method 1

First I start off with Faraday's law, to describe the capacitor:


Faraday's law only give the rate of change of the voltage accross the capacitor, not the actual voltage. Therefore, I rearrange Faraday's law, integrating the current over the capacitance. Then once integrated define the constant as the initial voltage accross the capacitor.


If I use Ohm's law to specify the current, as it's limited by the resistor, I get:

n.b. VI is denoted VS in the diagram
I think this is the way forward. However, my skill in maths isn't good enough to solve this, as the voltage accross the capacitor is on both sides.

Going back a step, I (wrongly) assume that the current is a constant. I then integrate to give:


I can then just derive the current from the resistor, and substitute it into the equation to give:


Rearrange to get the voltage accross the capacitor:


After plotting this equation, I thought that I'd worked out the answer. It's the correct shape, and behaves as you would expect when the starting voltage is adjusted. However, the rise time is slower than you would expect it to be.


Method 2

Here, I start by substituting the current from the start:


Rearrange:


Then integrate:


Then rearrange to get the voltage accross the capacitor:


This appears to be close to the actual answer, in appearance. However, when it's plotted it's totally wrong.



Can anyone here give some insight? I feel that I'm close, but I'm making a dumb mistake somewhere.


« Last Edit: November 16, 2019, 06:38:08 pm by Azmarith »
 

Online iMo

  • Super Contributor
  • ***
  • Posts: 5570
  • Country: va
Re: Understanding the RC circuit equation
« Reply #1 on: November 16, 2019, 06:14:19 pm »
The capacitor charges to Vs immediately. It discharges via RC.
Readers discretion is advised..
 

Offline AzmarithTopic starter

  • Newbie
  • Posts: 8
Re: Understanding the RC circuit equation
« Reply #2 on: November 16, 2019, 06:16:28 pm »
Appologies Imo, the circuit diagram is just something I quickly grabbed off google, and didn't realise that it's wrong. I've updated it to the correct diagram.
 

Online iMo

  • Super Contributor
  • ***
  • Posts: 5570
  • Country: va
Re: Understanding the RC circuit equation
« Reply #3 on: November 16, 2019, 06:18:21 pm »
That is a fully different situation, however..
It charges via RC eq to Vs and it never discharges..
« Last Edit: November 16, 2019, 06:21:28 pm by imo »
Readers discretion is advised..
 

Offline AzmarithTopic starter

  • Newbie
  • Posts: 8
Re: Understanding the RC circuit equation
« Reply #4 on: November 16, 2019, 06:22:03 pm »
That is a fully different situation, however..
It charges via RC eq to Vs and it never discharges..

Yes, I'm only looking at how it charges at the moment.
 

Online iMo

  • Super Contributor
  • ***
  • Posts: 5570
  • Country: va
Re: Understanding the RC circuit equation
« Reply #5 on: November 16, 2019, 06:32:19 pm »
1. consolidate the variable names, what is Vi, Vo?
2. always index the equations otherwise we have to reference them like

"when Vi is your Vs then the 4th equation from top is not correct.."
« Last Edit: November 16, 2019, 06:38:15 pm by imo »
Readers discretion is advised..
 

Offline AzmarithTopic starter

  • Newbie
  • Posts: 8
Re: Understanding the RC circuit equation
« Reply #6 on: November 16, 2019, 06:39:18 pm »
1. consolidate the variable names, what is Vi, Vo?
2. always index the equations otherwise we have to reference them like

"when Vi is your Vs then the 4th equation from top is not correct.."

Well spotted. Yes, Vi is Vs. Why isn't it correct?
 

Offline duak

  • Super Contributor
  • ***
  • Posts: 1048
  • Country: ca
Re: Understanding the RC circuit equation
« Reply #7 on: November 16, 2019, 06:42:10 pm »
I don't have an equation editor handy so I hope this comes out OK. 

Vc = (Vi - Vci)(1 - e^(-t/RC)) + Vci     where Vci is the initial voltage across the capacitor

I'll have to leave the nuts n' bolts of the math to someone else.
« Last Edit: November 17, 2019, 03:41:02 am by duak »
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15797
  • Country: fr
Re: Understanding the RC circuit equation
« Reply #8 on: November 16, 2019, 06:47:48 pm »
Let's call i(t) the current flowing through the circuit, and Uc(t) the voltage across the capacitor.
As you already figured, you have the following basic equations: Vs = R.i(t) + Uc(t), and i(t) = C.dUc(t)/dt
Simple substitution: R.C.dUc(t)/dt + Uc(t) = Vs

Now it's just a matter of solving the above differential equation. It's a simple one. If you're willing to save time, or are not confident in your math skills (although I'd suggest brushing up on them in that case), you can use tools to help with this. For instance, in Maxima (/wxMaxima), you can solve it with the following line:
Code: [Select]
desolve(R*C*'diff(Uc(t), t)+Uc(t)=Vs, Uc(t));

Spoiler:
After arranging it a bit, you get:
Uc(t) = Vs + (Uc(0) - Vs).exp(-t/(RC))

There is your initial condition (initial capacitor charge), Uc(0).
 

Offline IanB

  • Super Contributor
  • ***
  • Posts: 12537
  • Country: us
Re: Understanding the RC circuit equation
« Reply #9 on: November 16, 2019, 06:54:36 pm »
However, It doesn't take into account the initial voltage accorss the capacitor

That's an initial condition for the problem. The capacitor could have any arbitrary initial voltage. For the standard case it is normal to assume the initial voltage is zero.

As for how to derive the equation, you proceed as indicated above, you write down a differential equation for the capacitor voltage and then solve it for the solution as a function of time.
 

Offline AndrewHodgson

  • Contributor
  • Posts: 18
  • Country: gb
Re: Understanding the RC circuit equation
« Reply #10 on: November 16, 2019, 07:03:07 pm »
This is a pretty good explanation:


If you want take into account the initial voltage across the capacitor:

rearrange that equation so t is the subject
t=RC*ln( 1-Vc/Vs)

then say you want to know how long it takes you to get from 1V to 4V with a supply voltage of 5V. you say
t= RC(1-4/5)-RC*ln(1-1/5)

so you're subtracting the time it takes to get to 1V.

Make sense?
 

Offline AndrewHodgson

  • Contributor
  • Posts: 18
  • Country: gb
Re: Understanding the RC circuit equation
« Reply #11 on: November 16, 2019, 07:44:23 pm »
Also, if you want to take account of the initial capacitor voltage in your derivation you just integrate between t1 and t2, and q1 and q2
 

Offline AzmarithTopic starter

  • Newbie
  • Posts: 8
Re: Understanding the RC circuit equation
« Reply #12 on: November 16, 2019, 08:09:25 pm »
This is a pretty good explanation:


If you want take into account the initial voltage across the capacitor:

rearrange that equation so t is the subject
t=RC*ln( 1-Vc/Vs)

then say you want to know how long it takes you to get from 1V to 4V with a supply voltage of 5V. you say
t= RC(1-4/5)-RC*ln(1-1/5)

so you're subtracting the time it takes to get to 1V.

Make sense?

Also, if you want to take account of the initial capacitor voltage in your derivation you just integrate between t1 and t2, and q1 and q2

Thank you so much guys! I see where I was going wrong now. I wasn't integrating between t1 and t2, and q1 and q2. I was integrating and just adding on a constant which I assumed was the starting voltage/charge.

Thank you all so much for you help  ;D
 

Offline bson

  • Supporter
  • ****
  • Posts: 2497
  • Country: us
Re: Understanding the RC circuit equation
« Reply #13 on: November 17, 2019, 07:19:50 pm »
As has been pointed out, just subtract the initial voltage from the supply voltage.  Charging a capacitor from 2 to 5V with a 5V supply is exactly the same as charging it from 0 to 3V with a 3V supply.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf