# Optional Practical: Iterative capacitor charging (Excel)

Introduction

It is obvious that if we plot V = V_{o}(1 - e^{-t/RC}) in Excel we will get an exponentially increasing voltage, what would be more interesting would be to take the equation for the circuit and use it to calculate how much charge flows onto the capacitor plates for successive steps in time to see how this gives an exponential increase. This is called an iterative process. Maybe you used the same technique in previous examples; Kettle simulation or Iterative SHM (Excel).

### Theory

The circuit we will consider is a capacitor and resistor connected to a battery.

Here we can see that ε = V_{C} + V_{R}

But V_{C} = Q/C and V_{R} = IR

So ε = Q/C + IR

⇒ I = 1/R (ε - Q/C)

But I = ΔQ/Δt

So ΔQ/Δt = 1/R (ε - Q/C)

⇒ ΔQ = Δt/R (ε - Q/C)

So for example, when the battery is first connected the charge on the capacitor is zero (Q = 0) so in time interval of 5s the amount of charge added to the capacitor will be 5ε/R. As the charge builds up on the capacitor Q/C will get larger so (ε - Q/C) gets smaller. The amount of charge added per unit of time will therefore get less resulting in an exponential increase.

### Modeling in Excel

Before any calculations can be made you need to define the variables, ε, R and C. Do this in 3 cells to the left of the worksheet. Here the M column is used.

Next add some column headers for t, ΔQ, Q and V_{C} . All of these values are initially 0.

The time will be increased in steps of 5s so add a formula to =A2+5 to cell A3 and copy down to 150s.

To calculate ΔQ you are going to use the formula ΔQ = Δt/R (ε - Q/C)

Write the formula in cell B3 but:

- instead of writing ε, R and C use the cells M3, M4 and M5. Note that you must include a $ in the cell address to stop the cell changing when you copy it down. (e.g. M$3)
- Use Δt = 5
- Q is C2 (Don't put a $ in this one as you want it to change when copied down)

To calculate the charge on the capacitor you simply add ΔQ to the previous charge.

- In cell C2 write the formula =C2+B3

The PD across the capacitor V_{C} = Q/C

- Write the appropriate formula in cell D3

Copy all formulas down to match the time.

##### Plotting the graph

To plot the graph highlight the columns and choose xy scatter from the insert chart menu. Then right click the graph and select V_{C}.

Here is how

- Try varying ε, C and R to see what happens.
- If you know how to, (it was explained in a previous worksheet Projectiles in excel) add sliders to the ε, C and R. (make the maximum 6)
- The value CR gives the time taken for the potential to reach 2/3 of the final value. Use your model to verify this.
- Try plotting the current against time (I = ΔQ/Δt). Why doesn't this quite work?
- Try modeling the discharge of a capacitor.