Taking comments above on board, here's a suggested improved debounced circuit. Switching pulse rise and fall times are both < 2uS. In simulation a 10mS train of 0.5 mS pulses at 1kHz rate represents switch bounce and gives rise to a single switching pulse.
The bjt is replaced by a FET.
Taking comments above on board, here's a suggested improved debounced circuit. Switching pulse rise and fall times are both < 2uS. In simulation a 10mS train of 0.5 mS pulses at 1kHz rate represents switch bounce and gives rise to a single switching pulse.
The bjt is replaced by a FET.
The pulse is differentiated by the 10nF*150Ω. When the switch is released, the output voltage will go below ground by less than a millivolt (12V*150Ω/2Meg=900uV).
The pulse is differentiated by the 10nF*150Ω. When the switch is released, the output voltage will go below ground by less than a millivolt (12V*150Ω/2Meg=900uV).
The slow fall time is on the left side of the capacitor. The 150Ω resistor differentiates this slow exponential.
Another way of looking at it: The time constant is 10nF*(2Meg+150Ω). The output is 150/(2Meg+150) of the 12V exponential ramp.
Run a simulation if you can't envision it.
When the switch closes, the time constant is 10nF*150Ω.
When the switch opens, the time constant is ≈20mS. The 150Ω resistor is part of that time constant. The resistive divider, 150/(2Meg+150), means that less than 1mV appears across the 150Ω resistor.
When the switch closes, the time constant is 10nF*150Ω.
When the switch opens, the time constant is ≈20mS. The 150Ω resistor is part of that time constant. The resistive divider, 150/(2Meg+150), means that less than 1mV appears across the 150Ω resistor.
The pulse is differentiated by the 10nF*150Ω. When the switch is released, the output voltage will go below ground by less than a millivolt (12V*150Ω/2Meg=900uV).
The circuit that alec_t initially posted works well with the decoupling cap added to it. It turns off and on with every push of the switch. I saw the second diagram is supposedly a better debounce circuit and uses a MOSFET transistor ( i think). Even though the one I have now works, would you guys suggest that one? I couldn't quite follow all of the posts to tell if it is good or not..
The circuit that alec_t initially posted works well with the decoupling cap added to it. It turns off and on with every push of the switch. I saw the second diagram is supposedly a better debounce circuit and uses a MOSFET transistor ( i think). Even though the one I have now works, would you guys suggest that one? I couldn't quite follow all of the posts to tell if it is good or not..
I would use the MOSFET. Most BJTs don't have enough current gain to predictably sink 240mA when being driven from CD4000 logic, unless you use a Darlington, and then you suffer at least a volt Vce(sat).
But remember that MOSFETs are static sensitive so you need to take some modest precautions when handling them.
I suggest you do a search for ESD (Electrostatic discharge) if you don't know about this issue.
Also note that, just because something works does not necessarily mean that it is satisfactory.
While working as a design engineer in a large company, I was occasionally called upon to fix design issues in circuits that had been designed by someone else.
On one occasion, I discussed it with the original designer, & his comment was "Oh, but it worked in the lab".