Momentary latching switch
Project | Article by Maarten Tromp | Published , updated | 1007 words.
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 came up with this small electronics project that lets you do both with only a single button.
This article featured on Hackaday.
In this article:
You can make your bass sound like like a guitar (more or less) with an octave-up pedal. When you add more pedals to do 5ths, distortion and reverb, it sounds like your guitar is playing chords too. There are many songs where guitar and bass play the same riff, that you can now play all by yourself on bass. But you need to be able to easily switch between guitar sound, bass sound, and both at the same time. Here is a good video of this by Adam Flanagane.
So I started building my own ABY splitter. It feeds the bass guitar signal to either effects chain A, effects chain B, or both at the same time. The box has two buttons (A and B), one for each output. But what type of switches do I want? Momentary or latching types? I tried both, but different songs have different needs, so I could not decide which switch type was best. So I made plans for a bigger box with both momentary and latching switches side by side. This was getting more complex than I prefer.
Then I came across the Digitech Whammy Ricochet, which has the option to set the main floor button to either momentary or latching mode. This made me wonder if I could have both modes with just the single floor button, while still being intuitive to use.
So I came up with the following idea; 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. However, when a button pressed and held down, 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 switch for a short period of time, say only a couple of notes, without having to press the button a second time to switch it off again.
This idea could solve the switch issue I was having with the ABY splitter. The resulting splitter box would have two of the combined momentary / latching switch circuits, one for output A and one for output B.
As you might have guessed; there is a microcontroller involved. It's an Atmel tiny2313 AVR, the same processor I have used in many other projects. The buttons connect to the AVR, which in turn controls the relays and leds.
Relays are Takamisawa AL5WN-K, a 5 V 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 in another thread. There is apparently no need for a H-bridge driver, and indeed it all works 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.
The incoming voltage is lowered from 9 V from the Boss-style adapter to 5 V for the AVR and relays by a 7805 voltage regulator. A series diode protects against power supplies with the wrong polarity.
The microcontroller reads the buttons, debounces them and times button press duration. Some experimenting showed that short presses are always under 250 ms, at least for me, and long presses are always longer. So the threshold for momentary switching is set to that value. Interesting enough it also showed me that using your feet to press the button results in slightly longer presses than when you're using your fingers.
The AVR pulses the relay to switch one way or the other. Beware to keep pulse duration down to a couple of ms though, to avoid burning up the coil, as described in the data sheet.
The firmware is writing in assembler, since it's a simple project and I enjoy writing assembler.
Everything on a guitar effects pedal should be reasonably rugged, since it might be kicked around the floor a bit.
The enclosure is a normal stompbox-sized aluminium box. For ease of cable management, all jacks are located on the back of the pedal, instead of on the sides. The 6.3 mm (1/4 in) jack sockets are Neutrik M-series isolated stereo jacks. Power comes in via a standard Boss-style barrel jack.
The buttons are stompbox momentary switches, spaced far enough apart to be able to press them individually, but close enough together to be pressed at the same time as well.
The electronics are built on a strip of prototype board and squeezed in the remaining space. Luckily it's fairly compact since there is not much continuous space left with all the jacks, buttons and leds.
Since the circuitry is minimal, you can also build it into existing effect pedals.
The momentary latching switch in this article is developed using free and open source software were possible. Firmware is written using Vim, assembled with AVRA and programmed with AVRDUDE and USBasp.
In turn this design and article are released into the public domain. You can find all relevant files in the downloads directory of this article.
This switch trick could probably have been done with capacitor timing and some transistors, or with a 555. But this way is more flexible (and fun).
Searching the internet, once the pedal was finished, revealed that there are more guitar effects pedals using this trick. And also predating my design. So I might not be that original after all, but at least it shows it's a good idea. Maybe we'll see even more applications using it in the future.
The switchbox, however, is working fine. It's still exactly what I need to get the job done.