Looking to build a relay bypass where you can switch between momentary and latching on the fly

mzy12

Active member
My friend and I are looking to put some silly stuff into his guitar - one idea was a simple no knob analogue octave a la the green ringer. I threw out the idea that he could use a momentary push button to either toggle the effect or have it on only whilst holding the button, and it was a hit. PedalPCB's intelligent relay bypass system can indeed do this - however switching between the latching/momentary bypass mode requires a power cycle, which is obviously no go for an effect built into a guitar.

Is there any relay based bypass that I could build that would allow me to switch between those modes with a simple toggle switch while the effect is still powered on?

Thanks!
 
Using any type of microcontroller (Pic, AtTiny, etc) you can program it to do different things depending on how long the press is, if that's what you want. From the 8 pins of an Attiny 45 or 85, 2 are used for power, and one for reset. You have 5 pins available to you. For the relay you only need 2, and one for the momentary button. That leaves 2 pins available to control anything you want. So, you can control the relay with a short click, and control another circuit (on and off) with a long press.

But I guess you'll have to program that yourself. The Amplified Parts tutorial is really helpful for this: https://www.amplifiedparts.com/tech-articles/relay-true-bypass-switching-1

But even with basic Arduino code, I think it's doable.
 
Thanks for the quick response! Just to clarify, are you suggesting I use one relay to control another relay that's doing the bypassing of the circuit?
 
I think I didn't get right what you wanted first, but after re-reading what you wrote, and If I'm not getting what you want wrong now (control on/off and momentary on from one footswitch with short and long presses), what I'm telling is that with one footswitch, a single microcontroller and a relay you can do that.

Sorry, I first thought you wanted to switch effects in some way (that's why I said you could control a secondary circuit), but I see now that what you want is: with a short press, you turn the effect on or off (depending on the current state, a state flip). But, if it's off, if you keep the button pressed, it will stay on until you release it, and then it will turn off automatically (and immediately).

It is doable, since it's not difficult to program a microcontroller to do different things depending on the state of a button, or the duration of a press. You just check how long the button has been pressed. If it's a short amount, you flip the state (from on to off, or viceversa), but if the button is kept down for a defined amount of time, and its state was off, you turn it on until it's released, and then turn it off again.
 
I think I didn't get right what you wanted first, but after re-reading what you wrote, and If I'm not getting what you want wrong now (control on/off and momentary on from one footswitch with short and long presses), what I'm telling is that with one footswitch, a single microcontroller and a relay you can do that.

Sorry, I first thought you wanted to switch effects in some way (that's why I said you could control a secondary circuit), but I see now that what you want is: with a short press, you turn the effect on or off (depending on the current state, a state flip). But, if it's off, if you keep the button pressed, it will stay on until you release it, and then it will turn off automatically (and immediately).

It is doable, since it's not difficult to program a microcontroller to do different things depending on the state of a button, or the duration of a press. You just check how long the button has been pressed. If it's a short amount, you flip the state (from on to off, or viceversa), but if the button is kept down for a defined amount of time, and its state was off, you turn it on until it's released, and then turn it off again.
That's my fault for not being clear, no worries ;)

What I'm actually looking for is a bypass circuit that uses both a momentary push button and a toggle switch: The toggle should switch between two modes for the bypass of the octave effect, latching and momentary. In latching mode, with the toggle switch down, the push button should switch between the octave effect being on and being off, like a standard guitar pedal footswitch. In momentary mode, with the toggle switch up, the push button should now operate the effect only while the push button is being held. Does that make more sense?

Think of it like the bypass modes on the boss vb-2.
See the mode switch on the top right.

Should I still go down the same route of programming a microcontroller in order to achieve this?
 
That's my fault for not being clear, no worries ;)

What I'm actually looking for is a bypass circuit that uses both a momentary push button and a toggle switch: The toggle should switch between two modes for the bypass of the octave effect, latching and momentary. In latching mode, with the toggle switch down, the push button should switch between the octave effect being on and being off, like a standard guitar pedal footswitch. In momentary mode, with the toggle switch up, the push button should now operate the effect only while the push button is being held. Does that make more sense?

Think of it like the bypass modes on the boss vb-2.
See the mode switch on the top right.

Should I still go down the same route of programming a microcontroller in order to achieve this?
Oh! Ok, yes, I see no problem with that.

As I said, an 8 pin microcontroller, like the ATTiny85, for example, has 5 available pins for the user. You need 2 to control de relay, and 1 for the momentary push button. You still have 2 pins available. If you want to use a simple SPST toggle switch, you just set up the pull-up of the pin to make it high, and connect the toggle to the pin and ground (this is basically the same you do for the footswitch). When you turn the toggle ON, the pin will go to ground, and with that you can clearly know if the effect is in one state or the other (it will be high when the toggle is OFF, and low when the toggle is ON), and that will control the logic to be momentary or latching: if it's one way, behave momentary, of it's the other, behave latching.

Or, as I said, you can disregard the toggle, and do the same based on the state of the effect and how long the footswitch is pressed. If you press it quickly, you can turn it on/off. if you press it long, it will be on (or be turned on if it was off) until it's released, in which case it will be turned off. While it is a little less predictable, you can get used to this "smart" switching pretty quickly, and it's less parts, since you don't need a toggle.

In part 4 of the tutorial I linked above they talk about this smart switching feature.
 
No, it does it on the fly. Press to toggle, Hold for momentary.

Power cycling while holding the footswitch is for activating a couple other functions.
Ah I see, I completely misunderstood the documentation for it then. Thanks for clarifying. I still think for my needs, I'd need to build a relay that I can intentionally switch between momentary and toggle, with no timing ambiguity that could mess it up. Thanks!
 
I still think for my needs, I'd need to build a relay that I can intentionally switch between momentary and toggle, with no timing ambiguity that could mess it up.

Totally valid. But I'd still give it a try before you re-invent the wheel.
Robert's code timing is so well perfected, you'd be hard-pressed to introduce ambiguity.

I don't know how many milliseconds the press is, but any hold over 1/16th note, you're automatically in momentary mode. You'd have to be playing something unrecognizable as music at 300bpm for it to misconstrue your intention.

Or possibly bacon grease on the switch could cause your finger to slip off before your intended duration. That's probably more likely. 🥸

Even better than a momentary pushbutton, try a momentary toggle. FTW.
 
Last edited:
Back
Top