Electronic – Latching switch to single pulse circuit? (monostable multivibrator with 555?)

555latchinglogic-gatesraspberry piswitches

I am looking at using a latching switch (SPDT) to momentarily connect two pins. This is for a power button for a raspberry pi, so to power the machine from a hold state you have to momentarily short pins 5 and 6. Then to power the machine down I will switch it back to the other switch state and send a signal to a GPIO executing a shutdown script. I have done some research and found that the monostable multivibrator with 555 (one shot switch) might do the trick but a lot of the literature shows the trigger as a negative pulse? I will be latching the switch to 5v but only require a momentary switch, I was considering using an xor and flip flop but it seems like a lot of hassle.

Can anyone recommend another way or help me to understand if the monostable multivibrator will work for the application?

Best Answer

Since the power-down signal comes through a GPIO pin, your code can interpret either a high or low as the power down command. With the right code, a GPIO low means power down. Now the center (pole) of the switch can be tied to GND, both throws are pulled high with resistors, waiting to be pulled low, and you now have the correct signal polarity to trigger a 555.