I'm trying to derive the RC charging circuit equation for capacitor voltage \$V_C\$ and charging time \$t\$. Here's my solution,
We'll start by assuming the battery, resistor and capacitor are connected in series.
- KVL states that sum of all voltages in series is zero. This gives us \$V_B+V_R+V_C=0\$.
- KCL states that current is equal everywhere in a node. We only have a single node where everything is connected in series. This gives us \$I=I_C=I_R=I_B\$.
Substituting the values for \$I_C\$ and \$I_R\$ in KCL we get, \$C\frac{dV_C}{dt}=\frac{V_R}{R}\$ where \$V_C\$ is the voltage across the capacitor and \$V_R\$ is the voltage across the resistor. Although from KVL above, we know that \$V_R=-V_B-V_C\$ or \$V_R=-(V_B+V_C)\$ if we take minus common. Now, Substituting the value for \$V_R\$ in our previous equation we get, \$C\frac{dV_C}{dt}=\frac{-(V_B+V_C)}{R}\$. Rearranging this would yield, \$\frac{1}{V_B+V_C}dV_C=-\frac{1dt}{RC}\$. Taking integral on both sides now yields, \$log_e(V_B+V_C)=-\frac{t}{RC}\$.
Note this equation \$log_e(V_B+V_C)=-\frac{t}{RC}\$. I'll use this to derive time \$t\$.
Taking exponential on both sides yields, \$e^{log_e(V_B+V_C)}=e^{-\frac{t}{RC}}\$. This simplifies into, \$V_B+V_C=e^{-\frac{t}{RC}}\$ which upon rearranging yields, $$V_C=-V_B+e^{-\frac{t}{RC}}$$.
Solving for initial condition's where \$t=0\$ and \$V_C=V_{C0}\$ in our solution above gives us \$V_{C0}=-V_B+e^{-\frac{0}{RC}}\$. This simplifies to, \$V_{C0}=-V_B+e^0\$ and then \$V_{C0}=-V_B+1\$. Putting \$V_B\$ on the left hand side yields, \$V_B=-V_{C0}+1\$. Now If I substitute \$V_B\$ into the equation above \$V_C=-(-V_{C0}+1)+e^{-\frac{t}{RC}}\$. Rearranging this yields, $$V_C=V_{C0}+(e^{-\frac{t}{RC}}-1)$$
However the standard equation is \$V_C=V_B(1-e^{-\frac{t}{RC}})\$ and I'm not sure what I did wrong.
Now deriving time from \$log_e(V_B+V_C)=-\frac{t}{RC}\$. We can arrange this to have \$t\$ on the left hand side, this results in \$-t=RC*log_e(V_B+V_C)\$. Multiplying \$-1\$ on both sides yields \$t=-1*RC*log_e(V_B+V_C)\$. We know \$-1*log(x)=log(\frac{1}{x})\$. Therefore our solution for time \$t\$ becomes $$t=RC*log_e(\frac{1}{V_B+V_C})$$.
However the standard equation for time is \$t=RC*log_e(\frac{V_B}{V_B+V_C})\$ and I'm not sure where I went wrong.
update: clarifying integral
This is how I solved the integral \$C\frac{dV_C}{dt}=\frac{-(V_B+V_C)}{R}\$.
- We can divide by \$(V_B+V_C)\$ on both sides. This results in, \$C\frac{dV_C}{(V_B+V_C)dt}=\frac{-1}{R}\$.
- We can multiply by \$dt\$ on both sides. This results in, \$C\frac{dV_C}{(V_B+V_C)}=\frac{-1}{R}*dt\$.
- We can divide by \$C\$ on both sides. This results in, \$\frac{dV_C}{(V_B+V_C)}=\frac{-1}{RC}*dt\$.
- Now we can take the integral on both sides, \$\int\frac{dV_C}{(V_B+V_C)}=\int\frac{-1}{RC}*dt\$.
- On the left hand side we have \$\int\frac{1}{V_B+V_C}dV_C\$. We know \$\frac{1}{x}=log_e(x)\$, therefore our left hand solution becomes \$log_{e}(V_B+V_C)\$.
- On the right hand side we have \$\int\frac{-1}{RC}dt\$. \$\frac{-1}{RC}\$ is constant so we can pull it outside and thus our right hand integral becomes \$\frac{-1}{RC}\int1dt\$. This simply results in, \$\frac{-1}{RC}*t\$ and then \$\frac{-t}{RC}\$.
- Combining left hand side and right hand side solutions from step 5 and step 6, we end up with \$log_{e}(V_B+V_C)=\frac{-t}{RC}\$
Is this wrong?