### Author Topic: Two footswitches, 3 functions, help!  (Read 6541 times)

#### earthtonesaudio

##### Two footswitches, 3 functions, help!
« on: January 11, 2010, 05:13:09 PM »
What's the best way to do this:

Pressing switch 1 toggles effect A,
Pressing switch 2 toggles effect B,
Pressing both switches simultaneously switches the order of the two effects.

I plan on using CMOS switching and the GEOFEX Juggler for the order reversing part.  I'd like to do all this without having to program anything, but otherwise with as few parts as possible.  One of the effects going in this box (1590B) is going to use a 12A*7 tube, so space is limited.

Thanks!

#### Processaurus

##### Re: Two footswitches, 3 functions, help!
« Reply #1 on: January 11, 2010, 06:06:14 PM »
AND gate clocking a 4013?  It wouldn't ignore toggling the A and B when you do the double stomp, though, for that, you'd need to go twice as deep.

Also the octal latch switching logic in the Geofex Multi-Vol might interest you.

Neat idea, by the way!

#### Processaurus

##### Re: Two footswitches, 3 functions, help!
« Reply #2 on: January 16, 2010, 08:49:21 AM »
Check out this persons logic gate simulator, it has D type flip flops,  great for testing these kind of switching schemes:

http://www.tetzl.de/logicsim_applet.html

#### JKowalski

##### Re: Two footswitches, 3 functions, help!
« Reply #3 on: January 16, 2010, 06:51:54 PM »
3 NOR gates

Gate 1 is connected to both switches, gates 2 and 3 are connected to one of the switches and the output of gate one.

The inputs should be normally high, the switches ground it.

Outputs = outputs of all three gates, gate 1 is both switches on, gate 2 and 3 are the switches.

NOW, the problem with all of this is one of the switches will trigger before the other one and you will get two outputs, one for the first switch and then the double output. You can't really get around this...

I think you would need a microcontroller for this to not become overly complex.

#### earthtonesaudio

##### Re: Two footswitches, 3 functions, help!
« Reply #4 on: January 16, 2010, 07:43:00 PM »
The only part that's giving me trouble is the "push both almost-but-not-quite simultaneously" part.  I've done it with MUXes and NANDs and discrete logic, and every time I end up needing at least one additional time constant.  I guess that's what it comes down to.  Passives or microcontroller.  Ah well, another customer leaves the free lunch counter hungry.

#### slacker

##### Re: Two footswitches, 3 functions, help!
« Reply #5 on: January 17, 2010, 08:39:59 AM »
Assuming you're using momentary switches, you can get round the "push both almost-but-not-quite simultaneously" by synchronising the signals from the switches, or you can in a logic simulator anyway.
You just need a CD4013 and a clock signal to do this, if you use a C40106 to debounce the switches then you can make the clock out of one of the spare gates.
Hook the output of the debouncers up to the D inputs of the CD4013 and the Q outputs to Chris's circuit. Connect the clock to the clock input of the CD4013. Then you just need to make the clock period longer than what you want to consider to be a "push both..." event.
This seems to work, the only downside is you need to hold the switches down for at least 1 clock cycle.

The circuit is straight out of the CMOS Cookbook by the way

EDIT: Actually after messing a bit more it doesn't work properly, it's still possible to false trigger it if the two stomps fall either side of a clock pulse. To get it to do what you want you'd need to synchronise the clock to the first stomp.
« Last Edit: January 17, 2010, 08:49:33 AM by slacker »

#### JKowalski

##### Re: Two footswitches, 3 functions, help!
« Reply #6 on: January 17, 2010, 02:50:32 PM »
Assuming you're using momentary switches, you can get round the "push both almost-but-not-quite simultaneously" by synchronising the signals from the switches, or you can in a logic simulator anyway.
You just need a CD4013 and a clock signal to do this, if you use a C40106 to debounce the switches then you can make the clock out of one of the spare gates.
Hook the output of the debouncers up to the D inputs of the CD4013 and the Q outputs to Chris's circuit. Connect the clock to the clock input of the CD4013. Then you just need to make the clock period longer than what you want to consider to be a "push both..." event.
This seems to work, the only downside is you need to hold the switches down for at least 1 clock cycle.

The circuit is straight out of the CMOS Cookbook by the way

EDIT: Actually after messing a bit more it doesn't work properly, it's still possible to false trigger it if the two stomps fall either side of a clock pulse. To get it to do what you want you'd need to synchronise the clock to the first stomp.

That was a good idea, shame it didn't turn out right...

But regardless you can see how this is becoming very complicated.... That idea would include two flip flop chips, inverter chip, and a NOR chip. Considering these are all 14 pin IC's, thats ALOT of room!

A microcontroller could do it all (debouncing, syncronizing, latching, etc) in a 8-pin format. The only passives you would need would be a bypass capacitor, and a pullup for the tap input (actually PICs have built in pullups you can activate, so you don't even need that). Use the internal clock, too. And since it is just a logic circuit, it wouldn't be too hard to code.

I think it is worth it to take the time to learn basic ASM and buy a programmer! It's really not that hard, or expensive (programmers are like \$15, chips are \$0.75 to \$2.50...).

Whenever you come across this kind of problem you will be well equipped to handle it.

I finally figured out what I like so much about coding in ASM rather then C - It's a logic problem. ASM only gives you a couple very basic functions to work with and requires you to think about it more, work around those limitations, and develop new ways to use them. Its more of a problem solving exercise then a textbook learning exercise (though c can provide similar challenges it is not nearly as common).

#### David

##### Re: Two footswitches, 3 functions, help!
« Reply #7 on: January 17, 2010, 04:34:22 PM »
What's the best way to do this:

Pressing switch 1 toggles effect A,
Pressing switch 2 toggles effect B,
Pressing both switches simultaneously switches the order of the two effects.

Instead of pressing two buttons simultaneously, why don't you simplify your life and just use a third pushbutton?

#### slacker

##### Re: Two footswitches, 3 functions, help!
« Reply #8 on: January 17, 2010, 05:42:05 PM »
That was a good idea, shame it didn't turn out right...

Thanks, I'm pretty sure it can be done using 3 non retriggerable monostables plus the flipsflops and NORS. Basically the same as what I posted before except instead of a clock the third monostable is connected to both switches and then clocks the flipflops, that makes sure everything happens in the right order.
That's at least one more IC and more passives though, like you said these days it's much simpler to use a microcontroller.

#### earthtonesaudio

##### Re: Two footswitches, 3 functions, help!
« Reply #9 on: January 17, 2010, 08:46:41 PM »
This was one of the better ones I came up with:

I think this does all the necessary functions, but it's clunky.  The main drawback is that even though toggling Flip Flop C is fast, if you want to toggle either A or B, there is a noticeable time delay.

I think it is worth it to take the time to learn basic ASM and buy a programmer! It's really not that hard, or expensive (programmers are like \$15, chips are \$0.75 to \$2.50...).

I had no idea they were so inexpensive.  That is very appealing.

Instead of pressing two buttons simultaneously, why don't you simplify your life and just use a third pushbutton?

Not enough room on the pedal.  And I before you suggest it, no, don't want to use a bigger pedal.

#### JKowalski

##### Re: Two footswitches, 3 functions, help!
« Reply #10 on: January 17, 2010, 09:10:54 PM »
I had no idea they were so inexpensive.  That is very appealing.

It really depends on what you are wanting to get from it. I got mine on eBay for around \$15 bucks - its a serial port programmer with a USB cable for the power source.  (I had to DIY a serial port onto my computer, wasnt too hard since all you have to do is add a socket and connect it to the serial port on the motherboard)

If you have a serial port already then it's even easier.

You can get USB only (power, and data) programmers but they are usually a little more expensive. USB isn't really any better then a good serial port programmer, the only benefit is the use of a current cable and the ease of only having one wire. My serial programmer is very fast, mid sized programs load up in 5 seconds or so.

EDIT: Ah, this one is the one I have. I don't really know how other ones compare, there may be cheaper and better ones out there now, but I am happy with the performance of this one so far. I couldn't ask for anything more.

« Last Edit: January 17, 2010, 09:16:01 PM by JKowalski »

#### potul

##### Re: Two footswitches, 3 functions, help!
« Reply #11 on: January 18, 2010, 04:46:12 AM »
You can even build your own programmer (if it's compatible with your PIC). That's what I did, I use this one:

http://www.semis.demon.co.uk/uJDM/uJDMmain.htm

very simple, and works fine for me. It is though, a very simple design, reported not to work in some PCs (specially laptops).

#### JKowalski

##### Re: Two footswitches, 3 functions, help!
« Reply #12 on: January 18, 2010, 05:20:26 AM »
You can even build your own programmer (if it's compatible with your PIC). That's what I did, I use this one:

http://www.semis.demon.co.uk/uJDM/uJDMmain.htm

very simple, and works fine for me. It is though, a very simple design, reported not to work in some PCs (specially laptops).

It does have a fairly limited programming capability though in terms of PIC families... Personally I would just spend the money, for the speed and the huge versatility. Well, personally, I suppose I did just spend the money. I considered that project, though.

#### potul

##### Re: Two footswitches, 3 functions, help!
« Reply #13 on: January 18, 2010, 09:05:41 AM »
You're right. that's why I mentioned "If it's compatible with your PIC". It also has the limitation that you are forced to use the MLCR pin, so you "lose" one potential i/o pin.

But so far for my projects it has worked fine.

Regards,

Potul

#### earthtonesaudio

##### Re: Two footswitches, 3 functions, help!
« Reply #14 on: January 18, 2010, 01:32:08 PM »
Would I have to look for a special version if I want to use it with a Mac, or does that matter?