# How can I convert the output from a momentary switch to a pulse on push and a pulse on release?

The title pretty much says it all.

I have an idea to try out involving a op-amp differentiator circuit and a diode bridge, but I am flying blind.

Also I am trying to accomplish this without a micro-controller.

-
Between chiphacker and my @tcmaker buds I've got a bunch of potential solutions. I've simmed a couple in SPICE and there's certainly some potential, I just need to see if they will mesh with my bend. Thanks for the answers everyone! I'll try to post up any updates on my progress. –  noise Nov 18 '09 at 22:44
Here's one solution written up by a friend of mine, very detailed explanation and includes an LTSpice schematic. uptownmaker.blogspot.com/2009/11/pulses-on-pushbutton.html –  noise Nov 18 '09 at 23:00

If you'd like a nice analog solution, there's this circuit that's used by flight simmers:

The schematic shows the arrangement for a toggle switch, but it could be easily substituted for a momentary.

Each time the switch changes positions, the capacitor has to charge and discharge. During this time, a voltage is developed across the relay contacts, closing the switch. Once the capacitor has charged, the relay turns off again.

-
This one is clever for using the minimum number of components, just a single capacitor and a relay. Downside is the relay is quite large, but the original asker might be able to find smaller or solid state ones that work the same way (may require addition of an extra resistor to slow the capacitor charge/discharge time) –  davr Nov 18 '09 at 1:43

XOR gate:

I've used the NC7SZ58 for this, which is cheap ($0.04) and tiny and has Schmitt trigger inputs so the pulses are roughly the same length. - Perhaps an RC low-pass on both inputs, but different time constants, for debouncing? – DarenW Oct 25 '11 at 18:11 add comment Depending on how much you want to invest in learning, the debouncing, xor, flip-flop solution would be the most "basic". The 555 is a great circuit to learn about though. Here is a page that walks through about a large number of applications for it: http://www.kpsec.freeuk.com/555timer.htm If you look for "Edge-triggering" under the monostable section you will find what seems to be the solution you are looking for. - Don't tell the "everything should be done on a uC" crowd, but I love the 555 and I just happen to have a pile of them, thanks! – noise Nov 17 '09 at 12:48 add comment You may use a simple xor gate, and one of the inputs connected to the switch directly, while the other input through a R-C circuit which provides the delay. This works OK as an "edge detector", but it doesn't do any debouncing - you didn't ask for this :-). It's probably the cheapest way if you already have an unused xor gate in your design. - add comment Allowing a 555 but rejecting a microcontroller is silly, you can get a microcontroler in the same or smaller package than a 555, and as a bonus you can do debouncing in software, saving some extra components which would be required to debounce the signal for the 555. Same thing goes for D flip-flop and XOR gate...that's 2 ICs you need, in addition to the debouncing components. What is your reason for wanting to avoid a microcontroller? The simplest ones are$1, probably much less in high quantities. If it's space, there is an 8-pin TSSOP AVR which is like 3x5 mm, pretty tiny.

-
I'm assuming Mr. Noise is asking us to help with his homework assignment and he is not allowed to use the obvious solution. –  SiliconFarmer Nov 17 '09 at 0:57
Biggest reason is because I am trying to learn something about electronics. I've already done it in code which I can fall back on if need be...and no it's not a homework assignment, just a modest circuit bend for my own entertainment and edification. Thanks for the answer, it gives me a direction to work towards. –  noise Nov 17 '09 at 2:38
That's reasonable, if you specify that in your questions in the future, people will understand better. –  davr Nov 17 '09 at 19:12
It's also not unreasonable to avoid a microcontroller because of the code creation/maintenance/testing costs. That's something that went over my head as a junior engineer, but which I have come to understand very well as I have gained experience. The "oh, we can just do it in software" mentality can get you into trouble sometimes when you have to prove something is going to work. –  Jason S Dec 5 '09 at 0:19
I'm a little confused as to how using a miniature computer and software to implement a simple logic function is "the obvious solution". –  endolith Sep 25 '10 at 4:06