3 channel momentary preset selection

Started by trixdropd, May 18, 2013, 09:46:00 PM

Previous topic - Next topic

trixdropd

Alright, so I want to have 3 momentary n.o. switches that each have a corresponding led.

I need the led to stay lit on the button last pressed. Press a different button and only THAT led will be lit.

What is the easiest way to achieve this?

FunkyGibbon

I don't know if this is the easiest way to do it, but it is certainly one way to do it:

http://www.geofex.com/Article_Folders/multivol/multivol.htm

See the logic diagram. Those control signals could then go to CMOS switches like 4053 or 4066.

Christopher


defaced

That method works very well and overall is easy to implement.  I have used it successfully.
-Mike

merlinb

#3
I could never get RG's circuit to work properly- dunno why. Anyway, I designed an alternative (four switches shown, but you don't have to use them all, obviously). All diodes 1N4148 or whatever. The transistors are just examples of circuits that could be controlled by it- they have nothing to do with the actual switching controller, so you could just connect a resistor+LED to each output. Also, the IC has both Q and /Q outputs (not shown), which can be handy.

trixdropd

#4
Thank you guys. I'm gonna breadboard both versions and see what happens.

Thanks again!!

trixdropd

Quote from: merlinb on May 19, 2013, 04:08:24 AM
I could never get RG's circuit to work properly- dunno why. Anyway, I designed an alternative (four switches shown, but you don't have to use them all, obviously). All diodes 1N4148 or whatever. The transistors are just examples of circuits that could be controlled by it- they have nothing to do with the actual switching controller, so you could just connect a resistor+LED to each output. Also, the IC has both Q and /Q outputs (not shown), which can be handy.

Merlin,

I tried your circuit 1st. It worked perfectly. Thanks!

trixdropd

Alright, I built the pedal. What I have found is that it does not always work right. It seems like the switches need to be de-bounced. I am using these: http://www.mammothelectronics.com/4SFS2PDT-MS-I-p/800-1017.htm

On the breadboard with a wire instead of a switch it works no problem.

Any ideas?


defaced

If it works on the breadboard with a wire, then try that instead of the switch.  Just run a wire across the switch contacts like you have on the breadboard and see what shakes out.  If that works, you may find adding parts for debouncing to help.  The caps in parallel with the switch contacts in RG's schematic are there for debouncing. 
-Mike

trixdropd

Quote from: defaced on June 17, 2013, 11:07:25 AM
If it works on the breadboard with a wire, then try that instead of the switch.  Just run a wire across the switch contacts like you have on the breadboard and see what shakes out.  If that works, you may find adding parts for debouncing to help.  The caps in parallel with the switch contacts in RG's schematic are there for debouncing. 
Cool, that's exactly what I was stumped on. I am new to de-bouncing.


R.G.

Just as commentary, the two chips, the '373 and '40175 are both doing the same thing. They're taking advantage of the fact that the timing on the "clock" input can be tinkered with so that the clock signal enables the input into the latch, then holds on a little longer than would be normal.

The '373 does this naturally, because the hold time on the clock is actually negative by a few fractions of a microsecond. In Merlin's circuit, the clock is held high by the capacitor on it. There is no particular switch debouncing, so it works mostly for most switches, most chips, most phases of the moon, etc.

The selector shown in the multivol has explicit debouncing with the RC-networks and Schmitt trigger inverters to make this into a works-every-time setup, but you pay for that with the extra parts and additional chip.

There are other versions. The timing of the clock versus the data pins is the critical element, so one can use MML (Mickey Mouse Logic  :)  ) to artificially jigger the relative timing of the data inputs and the clock with various RC networks. The whole point of the RC/diode hacking is to make the switch itself generate both the data to be latched AND the clock to do it, and to satisfy the fractional-microsecond overlap/underlap of the clocks and data to make the chip happy and latch in what you want.

The 74C373 is harder to find these days. The 74C373 was "mature" back in 2000 when I wrote that up.  I've used a variety of CMOS logic/latches in this application, and the trick is always to (1) use any of the inputs changing to make a clock pulse, too - that's what the diodes are for, they're an MML "OR" gate - and (2) tinker the timing so the clock change is just enough earlier or later than the data changing that you get the data latched correctly.

Switch debouncing is another issue. All switches bounce, or at least have to be assumed to bounce. Some CMOS is level sensitive, however slowly the input voltage changes, and some is edge-sensitive. In logic chips, it is **always** better to generate a clean, clear, unambigous clock to latch stuff up correctly. With bouncing switches, a circuit with no debounce will generate a burp of transitions as the metal contacts bounce, and what this does to the clock is hard to predict, especially if the clock itself is slowed down by an R-C network. It may generate multiple random clocks, one per switch blip, or it may generate random clocks because it's going into the linear region as the clock's analog voltage wanders around on its way to somewhere.

So all of these generic data latches are time-dependent hacks. Pick your poison.

If I were doing the 40175 version, I'd use a hex schmitt trigger gate on each switch in front of it to make clean, clear data and clock transitions.

But I would not do that any more. It is cheaper to buy a $0.50 PIC microcontroller and have it do the job reliably and right. I know that's a disappointing answer to those of you who are looking for a "... and just hook it up with some diodes and caps, and it works" answer, but it's accurate. It's actually cheaper and simpler once you're over the programming hump.
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.

R.G.

This is coming up in various guises so often that I probably ought to do a few versions of the program and let Small Bear sell them. It'll save a lot of time, I think.
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.

trixdropd

Quote from: R.G. on June 17, 2013, 11:52:04 AM
Just as commentary, the two chips, the '373 and '40175 are both doing the same thing. They're taking advantage of the fact that the timing on the "clock" input can be tinkered with so that the clock signal enables the input into the latch, then holds on a little longer than would be normal.

The '373 does this naturally, because the hold time on the clock is actually negative by a few fractions of a microsecond. In Merlin's circuit, the clock is held high by the capacitor on it. There is no particular switch debouncing, so it works mostly for most switches, most chips, most phases of the moon, etc.

The selector shown in the multivol has explicit debouncing with the RC-networks and Schmitt trigger inverters to make this into a works-every-time setup, but you pay for that with the extra parts and additional chip.

There are other versions. The timing of the clock versus the data pins is the critical element, so one can use MML (Mickey Mouse Logic  :)  ) to artificially jigger the relative timing of the data inputs and the clock with various RC networks. The whole point of the RC/diode hacking is to make the switch itself generate both the data to be latched AND the clock to do it, and to satisfy the fractional-microsecond overlap/underlap of the clocks and data to make the chip happy and latch in what you want.

The 74C373 is harder to find these days. The 74C373 was "mature" back in 2000 when I wrote that up.  I've used a variety of CMOS logic/latches in this application, and the trick is always to (1) use any of the inputs changing to make a clock pulse, too - that's what the diodes are for, they're an MML "OR" gate - and (2) tinker the timing so the clock change is just enough earlier or later than the data changing that you get the data latched correctly.

Switch debouncing is another issue. All switches bounce, or at least have to be assumed to bounce. Some CMOS is level sensitive, however slowly the input voltage changes, and some is edge-sensitive. In logic chips, it is **always** better to generate a clean, clear, unambigous clock to latch stuff up correctly. With bouncing switches, a circuit with no debounce will generate a burp of transitions as the metal contacts bounce, and what this does to the clock is hard to predict, especially if the clock itself is slowed down by an R-C network. It may generate multiple random clocks, one per switch blip, or it may generate random clocks because it's going into the linear region as the clock's analog voltage wanders around on its way to somewhere.

So all of these generic data latches are time-dependent hacks. Pick your poison.

If I were doing the 40175 version, I'd use a hex schmitt trigger gate on each switch in front of it to make clean, clear data and clock transitions.

But I would not do that any more. It is cheaper to buy a $0.50 PIC microcontroller and have it do the job reliably and right. I know that's a disappointing answer to those of you who are looking for a "... and just hook it up with some diodes and caps, and it works" answer, but it's accurate. It's actually cheaper and simpler once you're over the programming hump.

Thanks R.G., I always enjoy the insight your posts provide. It makes sense to me much better now than before. I will continue to mess with this.

As for the pic controller, Can I just get an ardruino and learn some code and then program a $.50 microcontroller?

R.G.

Quote from: trixdropd on June 17, 2013, 11:57:35 AM
As for the pic controller, Can I just get an ardruino and learn some code and then program a $.50 microcontroller?
Probably.

The reason I don't know is that the Arduino is a general purpose uC setup with lots of generality and customization that's fairly expensive on anything other than a one-off gadget basis - well, at least compared to how I use uCs. I tend to want uCs like a special purpose IC to do *exactly* what I want, and as cheaply as possible.

So I have not looked into Arduinos much other than to know generally about what they do. I'll probably want one some day to do some USB- or ethernet-enabled something or other, but so far, no. I would guess that an Arduino can program a $0.50 microcontroller, of either the PIC, Atmel, or other stripes when suitably shield-ed. You can definitely use and Arduino to learn some code.

I think there's a path there, but it's an exploration, and I can't guide you very well, because although I know the lay of the land, I've never been down that exact path.

I suspect that people are getting tired of me saying "just get a PIC and do it", which makes me think I ought to establish a path for people to cheaply and easily get hold of the function without having to go to the trouble to learn. I very much think people ought to learn, but I realize that this is MY objective, not theirs, and that they may want to play their guitar instead of studying all the time.
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.

trixdropd

Quote from: R.G. on June 17, 2013, 12:39:24 PM
Quote from: trixdropd on June 17, 2013, 11:57:35 AM
As for the pic controller, Can I just get an ardruino and learn some code and then program a $.50 microcontroller?
Probably.

The reason I don't know is that the Arduino is a general purpose uC setup with lots of generality and customization that's fairly expensive on anything other than a one-off gadget basis - well, at least compared to how I use uCs. I tend to want uCs like a special purpose IC to do *exactly* what I want, and as cheaply as possible.

So I have not looked into Arduinos much other than to know generally about what they do. I'll probably want one some day to do some USB- or ethernet-enabled something or other, but so far, no. I would guess that an Arduino can program a $0.50 microcontroller, of either the PIC, Atmel, or other stripes when suitably shield-ed. You can definitely use and Arduino to learn some code.

I think there's a path there, but it's an exploration, and I can't guide you very well, because although I know the lay of the land, I've never been down that exact path.

I suspect that people are getting tired of me saying "just get a PIC and do it", which makes me think I ought to establish a path for people to cheaply and easily get hold of the function without having to go to the trouble to learn. I very much think people ought to learn, but I realize that this is MY objective, not theirs, and that they may want to play their guitar instead of studying all the time.

Thanks again. I really appreciate your time and insight. You're one of the best teachers I've ever had.

Andre

Quote from: R.G. on June 17, 2013, 11:52:04 AM
But I would not do that any more. It is cheaper to buy a $0.50 PIC microcontroller and have it do the job reliably and right. I know that's a disappointing answer to those of you who are looking for a "... and just hook it up with some diodes and caps, and it works" answer, but it's accurate. It's actually cheaper and simpler once you're over the programming hump.

It sure is.
Check my 3 channel PIC loop switcher:
http://www.youtube.com/watch?v=YShWoNalfw4

Schematic, PCB layout and PIC firmware is available.

R.G.

Yep, simpler, cheaper, and dead simple to do - once you get over the programming hump.
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.

trixdropd

Quote from: Andre on June 17, 2013, 01:07:45 PM
Quote from: R.G. on June 17, 2013, 11:52:04 AM
But I would not do that any more. It is cheaper to buy a $0.50 PIC microcontroller and have it do the job reliably and right. I know that's a disappointing answer to those of you who are looking for a "... and just hook it up with some diodes and caps, and it works" answer, but it's accurate. It's actually cheaper and simpler once you're over the programming hump.

It sure is.
Check my 3 channel PIC loop switcher:
http://www.youtube.com/watch?v=YShWoNalfw4

Schematic, PCB layout and PIC firmware is available.
I'd love to take a look at your work if you don't mind. Thanks!

mth5044

It would be incredibly easy with PICAXE. I've found it much easier to work with than arduino. I've actually done the same thing but with 8 momentary switches.