Why Output Jumps to 7.5 Volts When Switch is Closed and Opened Again

capacitoroscilloscopepulsevoltagewaveform

Sorry if the question might sound dumb. In this circuit, when the switch is closed the output voltage drops to zero and then rapidly charges back up to 5 volts. My question being, when the switch is opened up back again, the voltage spikes up to 7.5 bolts as shown in the oscilloscope figure attached. I am confused as the direction of the current would be the opposite of what it used to be when the switch is closed. Can anyone help me with understanding the behavior of this circuit? thanks!

The circuit I am talking about

Oscilloscope measurement at the output

Best Answer

The successive steps shown in the schematic below will aid in understanding the following discussion points:

schematic

simulate this circuit – Schematic created using CircuitLab

  1. Here, capacitor \$C_1\$ has long been discharged so the voltage difference across its leads is \$0\:\text{V}\$. So there is no current in \$R_1\$ or \$R_2\$ and therefore no voltage drop across either resistor. The output voltage will be \$5\:\text{V}\$.
  2. Now the switch is closed. \$R_2\$ has its own current but doesn't participate in charging \$C_1\$ so I removed it as "distracting" so that you can focus on the capacitor charging activity. \$V_\text{OUT}\$ will rise, exponentially, until it reaches \$V_\text{OUT}=+5\:\text{V}\$ and then the charging process stops.
  3. The switch is re-opened and the circuit returns to the configuration shown in step 1 above. However, there is a difference. Now, node \$N_2\$ is \$+5\:\text{V}\$ relative to node \$N_1\$. Because of this, current immediately starts flowing through \$R_1\$ and then through \$R_2\$ in order to start discharging \$C_1\$ via this path. The two resistors have the same value, so their mid-point (which is attached to a \$+5\:\text{V}\$ voltage source) will be half-way between or \$2.5\:\text{V}\$ lower than node \$N_2\$ and \$2.5\:\text{V}\$ higher than node \$N_1\$. So it must be the case, right after opening the switch, that \$V_{\text{N}_1}=+2.5\:\text{V}\$ and \$V_{\text{N}_2}=+7.5\:\text{V}\$. Note that there is still just the original \$5\:\text{V}\$ voltage difference across \$C_1\$. That didn't change (yet.) But now \$V_\text{OUT}\$ must initially start higher than \$+5\:\text{V}\$ (by the voltage drop across \$R_1\$.) Now, \$C_1\$ discharges via the two resistors and eventually returns to its discharged state. In the meantime, the current through the two resistors declines and therefore also the voltage at \$V_\text{OUT}\$ gradually returns to \$+5\:\text{V}\$.

You can adjust the ratio of \$R_1\$ and \$R_2\$ to get different peak voltages. For example, if you change \$R_1\$ to \$2\:\text{k}\Omega\$ then \$V_\text{OUT}\$ will rise above \$8.3\:\text{V}\$ for a short time -- more than the \$7.5\:\text{V}\$ you see in your trace.