# How to make a positive pulse with a button?

I want to make a circuit that sends a positive pulse that gets high for a few nano seconds when I push the button and then goes to low. I want this to happen even if I hold the button down without releasing it.

I tried some circuits like the one shot 555 and just using a capacitor, but the voltage didn't go down when I held the button.

Thanks.

• Welcome to EE.SE. Sounds like you need a capacitor of about 1nF in series with the 555 trigger pin. A 10K pull-up resistor on each side of the capacitor, with the switch grounding the capacitor first. The capacitor keeps the trigger pin from staying grounded. – Sparky256 Dec 26 '18 at 3:53
• Tie switch to Vcc and resistor of, say, 10k to ground. At the shared node, apply one end of a 10nF capacitor. The other end goes to a low-valued resistor -- 10 or 100 Ohms. The other end of that low-valued resistor to ground. Something like that. The pulse on the low-valued resistor (vs ground) will be very narrow. No fancy gates required. The problem will be what you are driving. But since you didn't specify that, I don't have to worry about it. – jonk Dec 26 '18 at 4:02
• Could you please give us more details of what you are driving, and why the pulse has to be so narrow. – Sparky256 Dec 26 '18 at 4:24
• google edge triggered oneshot – jsotola Dec 26 '18 at 8:00

You don't describe your requirements very well, particularly as it pertains to the interface switch. There are many different types of switches used, from dimple switches through toggle and on to the soft membrane switches that have a variable resistance.

However let's make an assumption that it's a some form of panel mount user interface and work from there.
There are two major considerations in you requirements:

1. The switch produces a single pulse of some ns (a highly unusual requirement to begin with) in length.
2. The pulse output is only on the push with no pulse for the release.

As mentioned in other answers, a major problem with interface switches is that they bounce or produce variable contact resistance when pressed. The problems associated with switches in general are widely documented and you could read this note by Ganssle which covers most of the problem space.

I'll take another approach and split the problem into two separate discussions:

1. Handling push button bounce
2. Producing edge detection on the correct edge

If you want reliable on/off indications for logic use, there is IMO no better approach than the RS Flip-flop. This requires a SPDT switch, but achieves excellent results completely free of bounce and with no complex RC calculations or edge detection.

simulate this circuit – Schematic created using CircuitLab

In the circuit above the first flip flop (likely be a 74xx74 (D-type) or 74xx109 (J-K type)) uses only the set/reset pins for input and debounces the switch. The predicate for operation here is that most SPDT switches are break before make on the contacts and that switches like this bounce on make and no on break. We don't actually care about the switch not bouncing on break here.

Since the initial contact of the switch will set or reset the latch, any bounce that occurs after this first contact is simply ignored. The is the best way to achieve the fastest indication of switch state change with the state changing on initial contact.

The second part of the circuit creates the output positive pulse only on the leading edge. Your requirements of a few ns signal is unusual, but one way to do this reliable is shown. The state change for the switch produces a 0-1 transition on the second flip-flop clock. When Q sets, *Q goes low and resets Q. The time delays in the chip result in a pulse output on Q of about 20-30ns. You can produce longer pulse widths by inserting pairs of invertors between *Q and *CLR.
No pulse is produced when the switch is released.

It's worth noting that a 74xx74 is about $0.50, and implementing any of the RC methods of pulse production or implementing an 555 solution is likely to be about the same price. Note: In todays MCU based world, you can get a very capable ATTiny10 for less money ($0.34). If you really want to advance your electronics knowledge, you would be far better trying to implement this type of interface with an MCU. It really is worth the effort. If you look at the datasheet for a MAX6816 you can see the logic they used to implement switch debounce.

## XOR Gate method

You would use an XOR Gate with a few nanosecond delay between one of two inputs connected to the same logic input using a logic family capable of much faster rise times such as Current Mode Logic, CML ( newer than the ECL family).

This delay could be a capacitor delay using dt= C*dV/Ic or microwave coaxial cable of a few m longer length using controlled impedance tracks to both inputs with proper impedance controls.

## RC method

RC delay = 3ns using R=50 Ohms with suitable impedance controlled path to target and some threshold voltage such as 2/3 Vcc for a Schmitt Trigger IC input, the RC delay is almost the same with T @ 64% = 3 ns = RC= 50 * 60 pF .

The cable to the switch must be low impedance , coax or twisted pair to switch and then connected V+ and series cap with 50 Ohms to ground.

simulate this circuit – Schematic created using CircuitLab

This circuit has a sub-ns time to 5V with a decay time of C1R2 = 5ns with a contact button debounce time of R2C2=10ms which is more than adequate.

• This (XOR) would produce a pulse on press and a pulse on release, so not the result required. – Jack Creasey Dec 26 '18 at 18:28
• good catch Jack. The switch also needs to be debounced – Sunnyskyguy EE75 Dec 26 '18 at 18:33

There is one basic problem with using a switch in this manner. Mechanical switches bounce, and it can take several milliseconds for the bouncing to die off. If you simply generate a pulse directly from the switch, you will have multiple pulses on every switch press.

So you first have to denounce the signal from the switch, and then generate the pulse from the denounced signal.

You can find denouncing ICs, or simply use a retriggerable monostable multivibrator to denounce the switch. It needs to have a period of a few dozen milliseconds.

Then, from the single pulse that the multivibrator generates, you can use a circuit to generate the pulse.

If you needed a longer pulse, you could do it with another monostable, but a few nanoseconds might be too short for that. So you might just use a few gates and perhaps a controlled delay, in what is commonly known as a “glitch circuit.” Which intentionally puts together a hazard path for the signal. (E.g, an and gate with the signal and an inverted and delayed version of the same signal in its other input.