Two state switch, multiple electronic switched states.

Started by Thecomedian, December 11, 2014, 02:35:12 AM

Previous topic - Next topic

Thecomedian

I want to be able to use the stomp switch to select between 3+ states and then reset to the first state before going up the count again. What kind of circuit should I be searching for?
If I can solve the problem for someone else, I've learned valuable skill and information that pays me back for helping someone else.

GibsonGM

  • SUPPORTER
MXR Dist +, TS9/808, Easyvibe, Big Muff Pi, Blues Breaker, Guv'nor.  MOSFace, MOS Boost,  BJT boosts - LPB-2, buffers, Phuncgnosis, FF, Orange Sunshine & others, Bazz Fuss, Tonemender, Little Gem, Orange Squeezer, Ruby Tuby, filters, octaves, trems...

samhay

You probably need to elaborate a little on what needs doing to switch between the 3 'states', but if you are happy writing a few lines of code, it is likely to straightforward to do this with a microcontroller. You get the bonus of being able to do switch debouncing in programming too.

If you don't want to use a uC, your next best is likely to involve CMOS logic. In that case, somebody will probably suggest you read Lancaster's 'The CMOS Cookbook'.
I'm a refugee of the great dropbox purge of '17.
Project details (schematics, layouts, etc) are slowly being added here: http://samdump.wordpress.com

R.G.

There is one specialized IC that could do what you are asking for - well, if we knew more about what you're asking for, anyway.

The CD4017 is a counter that counts from 0 to 9 then back to 0 every time it gets a clock pulse. It can be arranged to count from 0 to any smaller number, then reset to zero, making a 0,1,2,0,1,2,0... counter that seems to be what you want. You can also include a separate "go directly to zero" footswitch if that's what you mean.

R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

Transmogrifox

#4
Adding to RG's comment, a linear shift register is another IC that could be used here.

Like this:
https://www.fairchildsemi.com/datasheets/74/74VHC164.pdf  

The logic is
Pre load the pattern "001"
Rig the circuit with feedback from bit 2 to bit 0

Shift, shift, shift...and forever shift.  The bits 0 through 2 will keep shifting that 1 forever:
001
010
100

If you needed to have an "all-off" state, then you would use 4 bits with the feedback coming from bit 3, like this:
0001   #assert switch 1
0010   #assert switch 2
0100   #assert switch 3
1000   #all off/reset

The key would be a power-up state that pre-loads the shift register, otherwise you would have to do it manually.  Might require a D latch or something where the shift register is pre-loaded on power-up, then the pre-load logic is latched out with the first button-press.

The IC I referenced has an A and B input ANDed together, so maybe would be easier to implement the inverse of what I suggested --> All 1's mean de-assert switch, and 0 means assert switch.  Then the feedback is just to tie Q3 back to input B, and keep input A tied high.  The momentary switch connects to the CP input via pull-down resistor and probably RC filter for debouncing this.
trans·mog·ri·fy
tr.v. trans·mog·ri·fied, trans·mog·ri·fy·ing, trans·mog·ri·fies To change into a different shape or form, especially one that is fantastic or bizarre.

R.G.

Yep, that would work too. I always hated having to pre-load sequences in hard-logic designs, but it's usable.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

Transmogrifox

Quote from: R.G. on December 11, 2014, 11:34:13 AM
I always hated having to pre-load sequences in hard-logic designs, but it's usable.
Yes, that's the rub.

If you're only doing 3 states total
00
01
10

Then the counter is the easy solution.

If you need 3 states + all off, then you get from the counter:
00
01
10
11

Which means you need to  AND state 3 then XOR the output of state 3 with states 1 and 2, and then complexity of the shift register vs counter are roughly equal.  The shift register seems to show some advantage for total states > 4.
trans·mog·ri·fy
tr.v. trans·mog·ri·fied, trans·mog·ri·fy·ing, trans·mog·ri·fies To change into a different shape or form, especially one that is fantastic or bizarre.

R.G.

I tend to be lazy and use whatever is already inside one logic package if I can. The CD4017 counter is already decoded into one-of-ten outputs, and you can change it to any modulo less than that with one connection and there's no initial setup, as the decoded counter can't be in an invalid state when it comes up, so my automatic answer for one-of-N where N is less than ten is the CD4017.

That and I hate XORs and XNORs.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

Thecomedian

Thanks, this is what I need. Effect 1 on with a single push, effect 2 on and 1 off with another push, both off with a third push, repeat.

If I can solve the problem for someone else, I've learned valuable skill and information that pays me back for helping someone else.