Pulse – How to Make a Positive Pulse with a Button

buttonedgepulsetrigger

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.

Best Answer

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.

schematic

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.