I was reviewing this question on an RC circuit design from a Ben Eater video, and came across hacktastical's answer on how it was a bad design because it outputs 7 volts on release of the push button (which stresses the connected IC). They suggested adding a clamp diode, which mitigates the effect.

Here is the circuit in question (without the diode) -- simulate it here:

enter image description here

I went ahead and played with this circuit in Falstad, and it does indeed generate the 7V spike after button release. I also built the circuit on a breadboard and hooked it up to my scope to confirm, and observed the same phenomenon. Photos of my breadboard circuit and oscilloscope reading are below - note that I added 3 100nF capacitors in parallel to exaggerate the effect on the scope, and only had a 470 ohm resistor instead of 680.

My question is how is this 7 volt peak occurring? I do not understand how the output can be pushed to 2 volts ABOVE the 5 volt source voltage? I'm trying to wrap my head around it, but it's a bit beyond my hobbyist pay grade.

My educated guess would be that when the charged cap discharges itself through the series 1k and 680 resistors, the voltage drop across the second resistor (which is connected to output) would be about 2 volts (680/1680 * 5V = ~2V). Is this voltage simply just added to the 5V already coming from the supply? How is that possible?

This seems to make sense, since my scope is showing about a 6.7 volt peak in a circuit where I'm using a 470 ohm resistor instead (470/1470 * 5V = ~1.6V). 5V + 1.6V = 6.6v ... close enough to what I'm reading. But I would still prefer that someone could explain to me what's going on, as I'm not sure if my assumptions here are correct.

enter image description here

enter image description here

Adding a parallell clamp diode after the RC circuit and before the output, as seen below, mostly mitigates the effect (simulate it here. Why is this the case, and how come it doesn't COMPLETELY mitigate it? You still get about 5.5 volts on button release.

enter image description here

  • 1
    \$\begingroup\$ You've seen a stack of 1.5 V AA batteries connected in series. Each AA is 1.5 V but a stack of four produces 6 V. That idea's what you're seeing here. The capacitor acts like a short-lived rechargeable battery. It's charged with the switch closed. With the switch open, the C-R-R circuit has a connection to 5 V, just like the AA cell has a connection to the one underneath it. Like them, that circuit is offset from GND by that voltage. This isn't an answer, just a guide. Once you get the pov, you'll understand the existing answers better. \$\endgroup\$
    – TonyM
    Jan 30 at 18:06
  • 1
    \$\begingroup\$ Charged capacitor behaves just like a "small" voltage source. So, in your example just replace the capacitor with a 5V voltage source. And you will see why you see 7V. \$\endgroup\$
    – G36
    Jan 30 at 18:19
  • \$\begingroup\$ Otherwise known as a charge pump. The diode would be referred to as a clamp as there is no inductive flyback present. Examples of a charge pump would be the ubiquitous MAX232 chip which uses it to generate the positive and negative 7volts or so for RS232. \$\endgroup\$
    – Kartman
    Jan 30 at 22:37
  • \$\begingroup\$ @Kartman corrected the diode terminology to clamp \$\endgroup\$
    – riptusk331
    Feb 1 at 3:12

3 Answers 3


Initially, the capacitor has 5V across its plates. enter image description here

When the switch closes the capacitor works like a voltage source over a voltage divider made up by the two resistors. Vout = +5V * 680R/(680R+1K) = 2.0238

That is where your 2 volts is coming from. Adding the 5 volts of the V1 source (by closing the switch) you get your 7 volts.

The diode (in parallel with the 680R resistor), with a forward voltage of 0.7V or less, will reduce that 2V to 0.7 (or less).

Maybe this plot will help further understand what is happening (it is the charging/discharging of the capacitor above the 5V power supply).

enter image description here

When the switch closes (at 2us) both of the plates go to ground, but the top plate (Vout in blue) starts charging from the 5V power supply through R1, which is dropping 2V between its terminals.

When the switch is open (at 4.5us), the plates of the capacitor stop charging (top plate is 5V and the bottom plate is 0V).

The capacitor then starts to discharge through R1 and R3, but because the 5V power supply is still there between R1 and R2, the voltage drop on R1 raises both plates of the capacitor by 2V, as the capacitor discharges.

See what happens if we were to remove the 5V power supply before the capacitor was completely charged. The voltage would never be raised by 2V.

enter image description here

See what happens when you exchange the resistors (it follows the voltage divider formula):

enter image description here

Adding the diode.

enter image description here

Answering your question “how do BOTH plates of the cap go to ground, if only 1 of them is connected directly to ground when switch is closed?”

You know how a capacitor works. There has to be a differential of potential between its plates for the capacitor to charge and, if charged, a path between the plates to discharge it.

As I have said “Initially, the capacitor has 5V across its plates.” But the capacitor is initially discharged. It is just reflecting the voltage from the power supply. There is no current flowing.

As there is no resistance between the ground and the capacitor bottom plate, when the switch is closed the bottom plate is directly connected to ground even though it was +5V before. The capacitor was not charged, so there is no current flowing in it at this time. The bottom plate is just reflecting the potential of the wire coming from ground.

Because the capacitor is discharged, and before the capacitor has time to charge from the current coming from the 5V power supply through resistor R1, its top plate is at the same potential as the bottom plate, that is, ground.

Remember that when a capacitor is discharged and a voltage is connected to it, for a very brief period of time, the plates of the capacitor acted as a short-circuit. That is what you see in the plot at the 2us time (check the two plots in the picture below). Both capacitor plates are draw to ground first and then the capacitor starts to charge from ground to +5V.

enter image description here

PS: You will understand better, when you see what happens when the capacitor is initially charged. It shows a 5V potential between the plates when the switch is closed, and before the capacitor starts to charge. (Remember that the 2 volts are coming from the potential drop of the R1 resistor.):

enter image description here

  • \$\begingroup\$ Nice. Now, try it with a 1N4148 and a BAT54 to Vcc and see what happens. \$\endgroup\$ Jan 31 at 5:33
  • \$\begingroup\$ I did. It dropped below 7V but still shows the drop on the diode. \$\endgroup\$
    – VictorTito
    Jan 31 at 5:36
  • \$\begingroup\$ Yes, that’s the point. LTspice will be more accurate than Falstad, so it’d be interesting to see what it shows. \$\endgroup\$ Jan 31 at 5:40
  • \$\begingroup\$ Added the plot with the 1N4148 diode. \$\endgroup\$
    – VictorTito
    Jan 31 at 5:43
  • \$\begingroup\$ this totally clears it up for me - thank you for providing your detailed answer and LTspice diagrams/plots. seeing the difference follow the voltage divider formula when you swapped resistors was the "a-ha" moment \$\endgroup\$
    – riptusk331
    Feb 1 at 3:02

Another answer addresses most of your question. This answer only addresses the following.

Adding a parallell flyback diode after the RC circuit and before the output, as seen below, mostly mitigates the effect (simulate it here. Why is this the case, and how come it doesn't COMPLETELY mitigate it? You still get about 5.5 volts on button release.

If the diode were an ideal rectifier, then the voltage at the output would indeed be clamped to the supply voltage.

However real diodes have a voltage drop across them when they are conducting. We often take 0.6 volts as a nominal voltage across a conducting diode. In fact, the voltage depends on the model of diode and the amount of current.

The limiting voltage of the output is the 5 volts from the supply used to charge the capacitor plus the voltage drop across the diode, or something approximating 5.6 V.


The diode doesn’t catch all of the spike for several reasons:

  • forward voltage - 0.7V for ordinary silicon and 0.3V for Schottky types
  • switching time - Schottky is faster, but it’s still not zero
  • internal resistance - adds IR drop across the diode (which varies as predicted by the Shockley model)
  • lead inductance

So with a 1N4148 you’ll get about 700mV; with a BAT54 about 300mV. Nevertheless, the bigger the cap, the bigger the spike due to the diode limitations.

By the way, your sim doesn’t use a known model, try it with the 4148 or one of the Schottky types.

  • \$\begingroup\$ didn't notice that falstad was just using a "generic" diode...thanks for the tip...swapped out to a 1n4148 in the sim (and did it on my breadboard as well) and observed the effect. learning all this at a deeper level started with digging into your answer on the other thread...thanks again \$\endgroup\$
    – riptusk331
    Feb 1 at 3:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.