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:
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.
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.