Recognize Tap and Tap-Hold With Discrete Components To Control A Relay - Page 1
Forum section: electronics / projects

author: avih7531
author_rank: Newbie
timestamp: May 20, 2022, 02:14:21 am
content: Hi all,I want to mod a guitar pedal to have both regular bypass but also momentary bypass by pressing and holding on the footswitchI'd like to haveSOMETHINGcontrol 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!

author: ledtester
author_rank: Super Contributor
timestamp: May 20, 2022, 03:07:01 am
content: I'm not familiar with how guitar pedals work or are used -- can you fill in some specifics?For instance, does the relay have state? I.e. short press -> relay is latched on; another short press -> relay is latched off.If the relay has state does the long press simply momentarily toggle the state while the pedal is pressed?I.e. long press when relay is latched on -> relay is turned off for the duration of the press and then resumes being latched on?

author: avih7531
author_rank: Newbie
timestamp: May 20, 2022, 03:55:19 am
content: Ah yes, good point.Essentially the footswitched is pressed the pedal will turn on which means the relay will turn on.Like I mentioned before, I want the pedal to have two modes - on/off and tap-hold.If there is a short tap, the relay will turn on until another short tap is performedIf there is a hold, the realy will turn on as long as the switch is depressed at which point the relay will turn off

author: Someone
author_rank: Super Contributor
timestamp: May 20, 2022, 04:45:30 am
content: People use tiny little micros for things like this for good reasons:easier/quicker/cheaper to designusually cheaper to build!So why not use a micro?Quote from: avih7531 on May 20, 2022, 02:14:21 amAnnoying compared to something you have no idea how to do, so can not actually compare to?

author: ledtester
author_rank: Super Contributor
timestamp: May 20, 2022, 05:17:12 am
content: Quote from: avih7531 on May 20, 2022, 03:55:19 amWhat if the relay is already on and there is a long press?

author: ejeffrey
author_rank: Super Contributor
timestamp: May 20, 2022, 03:53:23 pm
content: You can distinguish between short and long press by having a RC time constant and a comparator. Make sure to add hysteresis to the comparator for noise immunity. You probably want a diode to give fast discharge when the pedal is released. Then you can implement whatever you want with discrete logic using both the fast and slow inputs.A tiny micro will be easier and cheaper, but possibly less fun depending on your interests.

author: ledtester
author_rank: Super Contributor
timestamp: May 20, 2022, 07:11:34 pm
content: Here's something that will behave as follows:- a short press will toggle the output once- a long press will toggle the output for the duration of the pressNot shown in the debouncing circuitry for the switch signal SW.