Recognize Tap and Tap-Hold With Discrete Components (Momentary/Normal Flanger)

Started by aviherman5, May 19, 2022, 09:35:28 PM

Previous topic - Next topic

aviherman5

Hi all,

I want to mod my flanger to have both regular bypass but also momentary bypass by pressing and holding on the footswitch

I'd like to have SOMETHING control a relay and recognize the two types of input - tap and tap-hold.

I know how to do this on an ATTINY, but that's annoying. Any ideas on how to do this with discrete components? I have a hunch it'll involve charging a capacitor etc. but I don't know how to do all of that! I think a tap can be under 300ms and a tap/hold would be anything longer than that, and while it's help, the effect would stay on. I think it's also important to keep debouncing in mind...maybe?  :icon_neutral:

At the end of the day, I don't need help with the realy implementation, just a 9v source that can be controlled by these two methods of input.

Thanks!

ElectricDruid

I think your idea of using a cap charging to measure the elapsed time is perfect. The question is how to do the logic.

When I've done this in software, what happens when you press the footswitch is always the same. What changes is what happens when you release it. So:

1) If the footswitch is pressed, toggle the state of the relay (On to Off / Off to On)

2) If the footswitch is released and it was a short press, do nothing

3) If the footswitch is released and it was a long press, switch the relay off.

(This logic allows a long press / Tap-and-hold to apply the effect momentarily. It's also possible to allow a tap-and-hold to momentarily *disengage* the effect, but I've ignored that here.

I'd probably be looking for a CMOS flip-flop chip with inputs that toggle the state but which also offers Set and Reset inputs. Something like the 4013. Then a "footswitch pressed down" toggles the flip-flop, and a "long press footswitch released" pulses the Reset pin.

Quite how you neatly detect footswitch-pressed-down and footswitch-released and deal with the debouncing and the cap charging neatly and without adding more parts needs more thinking about.

Ultimately, there's a reason people do stuff like this with a €0.50 uP - it's the simplest way with the least parts.

r080

Just quickly drawing out the states, I noticed you would need to decide how to handle a long second press, i.e. you have turned it on with a short first press, but you hold the switch too long for the second press.

To handle that neatly, it seems you would also need to detect the state of the flip flop and decide whether you always turn off at the beginning of a press when it is on, or at the end.

Rob

ElectricDruid

The logic I posted deals with that as follows:

Say you do a brief press and toggle it on. Then you press and toggle it off, and continue to hold it down. Then when you release it, it's detected as a "long press" and the relay is reset to an off state. But since it's in an off state anyway, nothing happens, so no big deal.

Ultimately it doesn't matter whether you do a brief press to turn off or a long one, it amounts to the same thing. The same is *not* true for the turn-on press.

Of course, there are probably at least as many ways to approach this as Paul Simon can find to leave his lovers. Since I'm not as experienced as he is, he can explain the other ways ;)

iainpunk

two edge detectors, one a positive edge and one a negative edge.

if the positive edge is detected, it sends a 1 pulse to the SET pin on an RS Latch,
this positive and the output of the ''inverting'' output of the latch are fed through an AND gate, which in turn caries the edge pulse to charge a capacitor quickly, and discharge it slowly. this capacitor is to be monitored by a inverting comparator.

the negative edge detector (creating a 1 pulse at a negative edge) and the capacitor's comparator (only creating a 1 when the cap is empty enough) are put through another AND gate which in turn feeds the RESET pin. only reseting on a negative edge if the 300ms capacitor is empty

hope this makes sense
friendly reminder: all holes are positive and have negative weight, despite not being there.

cheers