Electronic – Using a toggle switch to act as push button

buttoncomputerspulsetoggle switch

Basically I want to use a toggle switch to turn on my computer. I need some sort of circuit so that the toggle switch will act like a push button. IE, I turn on the toggle switch but it only sends a pulse rather than keep the circuit open.

Thanks in advanced.

Best Answer

The simplest hardware-wise is:

Just one small chip with its bypass cap.

The internal pullup on GP0 is enabled, so GP0 will be low when the switch is closed and high when open. The rest is firmware. At its simplest, the firmware can just produce a fixed size pulse on GP1 whenever it sees a transition on GP0. However, unlike dedicated analog solutions, you can apply different policies that might be useful. For example, when a pulse turns off the system, this could enforce a minimum time to let the system fully shut down before attempting to start it up again.