Sometimes you want a button press to be momentary, and sometimes you need it to be latching. This is true for, among other things, guitar effects pedals. And that is why I made a button that does exactly this.
For my bass guitar effects board I made a ABY splitter. It feeds the bass guitar signal to either effects chain A, effects chain B or both at the same time. It has two buttons (A and B), one for each output. But what type of switches do I use? Momentary or latching. I tried both types, but different songs have different needs, so I could not decide which switch was best. Then I made plans with both momentary and latching switches, but it made things more complex than I would like.
So I came up with the following requirements. If the button is pressed and immediately released the switch will be latching. In other words, when you tap the button like you're used to on any other effects pedal, the output will switch or and off like you're used to on any other effects pedal. The box will behave exactly like any other ABY splitter. However, when a button pressed and held down for a bit (longer than 1/4 second), the switch will be momentary. The output will switch back once you release the button. It behaves like a doorbell now. This would allow you to activate an output for a short period of time, say only a couple of notes, without having to repeatedly press the button.
As you might have guessed; there is a microcontroller in the box. The buttons connect to an Atmel tiny2313 AVR, which controls two relays. The processor times button press duration and decides whether to switch momentary or latching. The relays are Takamisawa AL5WN-K, 5V bistable type. This specific model was suggested in a freestompboxes.org thread. The coil is connected between two output pins of the avr, as suggested by another thread. There is apparently no need for a H-bridge driver, it all works just fine without one. Pulsing one output pin high, while keeping the other one low, will switch the relay on. Pulsing the other output pin will switch the relay off again. You need to keep the pulses to a couple of ms to avoid burning up the coils though, as described in the data sheet.
The momentary latching switch in this article is developed using free and open source software were possible.
The entire design and this article are released into the public domain. You can find all files in the downloads directory of this article.
For more details about licensing, see the license page.