News:

SMF for DIYStompboxes.com!

Main Menu

True Bypass relay board

Started by R.G., November 28, 2010, 12:31:27 PM

Previous topic - Next topic

R.G.

A lot of things I do get done as byproducts of other work.

I had come up with the idea of a small uC controlled relay bypass back in 2002 (http://geofex.com/Article_Folders/footswitch_pancake/footswitch_pancake.htm) and others have since come up with other variations on the idea. I recently had to work with some 8-pin PICs and realized I'd written all the code for the controlled relay. That piqued my interest enough to start thinking about the relay controller again, and that's how I got here.

Relays come in (at least) three varieties: non-latching (or single-side-stable ), single coil latching and double coil latching. The latching variety is useful for low continuous coil currents, and that's useful for battery powered stuff. At one time, I'd have said that gets us to effects, but I suspect that battery powered effects are now in the minority. Most pedalboards use an AC adapter these days, I suspect.

But latching is a good design goal in case you want to use a relay in a battery powered pedal. Both single coil and double coil latching relays require the coordinated use of two signals to make the latching work. On the single coil, you use them both at the same time, in opposite directions, and in the double coil version you use them one at a time, leaving the other off. There is no real difference to the uC implementation, only the software.

I had used transistors on the output of the uC in the original pancake, assuming that 5V (max uC voltage) relays were not available with coil currents less than the 20-25ma pin currents of available uCs. I find that's not so. Eight years later I find I was too conservative. You can get a number of single- and double-coil latching DPDT relays in either 4.5, 5, or 6V ratings that use less than 25ma. You can use 6V rated relays on a cautionary basis because most of these are specified to work at 75% of the rated coil voltage, or 4.5V for a 6V rated coil. So the transistor buffers are not strictly needed.

I specified a 78L05 regulator for power for the uC. That still looks like a good idea, especially if you use the regulator for the relay coil power.

With that as background, it's possible to draw a schematic. I originally used the 12F508. Today I'd pick the 12F609, based on some new insights on switch debouncing. The 12F5xx ans 6xx parts come in 8 pin dips with a variety of internal peripherals which will remain unused. Two of the pins are power and ground, and one pin is permanently used as an input. This leaves five pins which are full-spec output currents. I used the 12F609 instead of others in the family because it has one pin which has a Schmitt trigger input instead of a TTL input buffer. The TTL thresholds work with switch debouncing, but the ST inputs add an extra layer of reliability. So the ST input pin is the footswitch input.

That leaves four full-spec output pins available. Pretty much it doesn't matter which of these are used for the coils. They're all alike. I picked the pins to be used for coil flipping based on making the PCB layout work more easily. Two pins left.

I like the idea of making a bypass be selectably either alternate action like most stomp switches or momentary, depending on your playing style. So I used one of the two remaining pins as a "mode" pin. This pin selects whether the footswitch is momentary or alternate action. We'll take care of that in the software debouncing. And again, we can use whichever of the pins makes the PCB easy to lay out.

Finally we need an LED pin. It is possible to do the LED with the same pin that reads the footswitch - I came up with the code for this some years back, it works - but since we have a pin left, using it for the LED is fine. Again, pick a pin based on PCB layout.

The 78L05 powers this well from 9V. It'll do up to 100ma, which is plenty for the uC and relay. The 12F609 pulls about 1-2ma on 5V, so the relay will be 90% of the loading. 9V dropping to 7V at low battery still gives the headroom needed for the 78L05. We need a reservoir capacitor on the PCB to take care of the current changes. I used the biggest capacitance I could get in a 5mm diameter capacitance. We need ceramic decoupling, one on the input side of the 'L05 and one on the output side at the uC. Done with power.

The input switches need some circuitry. This can be as simple as a pullup resistor on each input. Certainly, that's enough for the mode switch, because switch bounce will always settle out on this one, even if you use a clumsy, stupid bouncing-maniac switch. It will settle in 100mS, and that's OK for a mode switch. It's NOT OK for a footswitch. If you even do switch debouncing in a uC, I suggest you read Ganssle's papers on debouncing. I did a pullup/capacitor on the footswitch, a series resistor to the uC input just for some current limiting in case the wire off-board gets transient spikes. This last is always a good idea.

With the schematic done, it's code time.

I like Scott Dattalo's vertical adder debouncer. It's fast and compact, even in something like BASIC, and gives you up to eight fully debounced switch inputs, all simultaneously, with no software delays, and the switches are all debounced both simultaneously and independently. Neat code. It's a waste in this application where I only have one input which really needs debouncing, but I already had tested code, so I just crammed both input pins into the vertical adder code. The nice thing about vertical adder debounce is that you can then do a parallel operation on the resulting switch states and previous state (if you use a memory location to keep previous state) to give you the ability to do a selectable operation on the switches. I did this; using the current state of the mode pin, I either made the footswitch bit follow the footswitch or toggle on 1-> 0 transitions.

With the switch state code in place, all you need is an output routine which is triggered on a footswitch change. The output routine manipulates the relay coils. It comes in three varieties. One of them is for a non-latching relay. I haven't written that one yet, but it amounts to holding the relay coil pin (only one for this variety of relay) down when the footswitch is 0. For single coil, you just have to initialize the uC with the coils and LED in reset, set them back to inputs (tristate, no continuous power) then when the footswitch changes make the two output pins be outputs and flip the coil to set or reset as needed for whatever time the relay needs, usually 10-30mS depending on relay, and re-tristate them. For double coil, you just activate the proper output pin low for the activate time and re-tristate.

The pinout of single coil latching and double coil latching relays is different. Picking a relay is perhaps the hardest part of all this. You want a relay that
1. has the required DPDT connections
2. is powered properly by a 5V supply
3. has a coil current under the 20-25ma limit of a uC pin
4. is small, and in particular low-profile
5. is cheap
6. is available

I found several candidates in stock at Mouser (my standard for 6) for about $2.50 to $4.00 each (5) that were less than 15mm long (4) and only about 9mm tall (4 again) that also met items 1-3.

Allowing $3.50 for the relay, the 12F609 is $0.85 in ones, a 78L05 is $0.30, an electro cap is $0.10, the resistors and ceramic caps are $0.02 to $0.05 each. The PCB for this can be done in 0.8 square inches :icon_biggrin: and that can be had for $0.50 per square inch in small quantities, about $0.10 or less in large quantities. Once the first layout was done for the single coil relays, I went ahead and did the double coil relays. And in for a penny, in for a pound, I went ahead with a single coil and double coil for the other "standard" pinout of the PCB relay pinout. First layout was about 30 minutes, next three about 10 minutes or less each.

Note that there are 4PDT relays with much the same coil specs, just about $1.00 more and physically longer.


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.

slotbot

Sounds neat. So what exactly is the function? each time you tap the button it cycles to the next pedal or?


Barcode80

No, the function as far as I can tell is to use relays for true bypass switching while only having to source momentary single pole switches, which are more common and cheaper than 3 pole switches.

R.G.

Patrick is right - you eliminate latching switches and their problems entirely, which offers the possibility of using a much more reliable momentary switch, possibly even a tactile switch rated for millions of operations, and a mechanical actuator that can be much more reliable than the complex mechanicals of an alternate action switch. Note that putting one of these in Boss or Ibanez pedals is a cinch, although you could just use the footswitch latching circuit that's already in the Boss and Ibanez pedals and just put in the relay and driver.

What you get is software control of either alternate action or momentary action on the footswitch plus true bypass - if you insist on true bypass.

Interestingly enough, you *could* use one of these per pedal and then feed it a signal from a separate controller to make it do radio button or programmed groups, if that's what you wanted to do.
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.

MetalGuy

Couple of years ago I was building a high gain pedal with submini tubes and found out that if you use a regular DPDT or 3PDT switch you can't get rid of the clicks no matter what. Tubes are microphonic to a different degree and will pick up any mechanical vibration especially in a high gain design. What I did is similar to R.G. I had several broken cheap chinese DPDT  I disassembled. The usable stuff left were the actuators. I added a tacticle switch which switches a 6 or 8 pin PIC. The uCU has also a delay line which introduces 20msec of delay and this way switching became completely silent. Later a even designed a small PCB for the tacticle switch and the PIC.

R.G.

Quote from: MetalGuy on November 28, 2010, 05:06:03 PM
Couple of years ago I was building a high gain pedal with submini tubes and found out that if you use a regular DPDT or 3PDT switch you can't get rid of the clicks no matter what. Tubes are microphonic to a different degree and will pick up any mechanical vibration especially in a high gain design. What I did is similar to R.G. I had several broken cheap chinese DPDT  I disassembled. The usable stuff left were the actuators. I added a tacticle switch which switches a 6 or 8 pin PIC. The uCU has also a delay line which introduces 20msec of delay and this way switching became completely silent. Later a even designed a small PCB for the tacticle switch and the PIC.
Yep, that's the thing. When you say "delay line" do you mean a delay on unmuting the signal path? I debated about whether to put one of those in - there's still one output pin left... 8-)

Or did you mean an actual audio time delay of the audio signal in the uC?
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.

PRR

> Ganssle's papers on debouncing
http://www.ganssle.com/debouncing.htm

> Scott Dattalo's vertical adder debouncer
http://www.dattalo.com/technical/software/software.php
http://www.dattalo.com/technical/software/pic/debounce.html

Thanks!


> latching relays require the coordinated use of two signals

One pin and a cap:



> in for a penny, in for a pound

The 50uFd 5V bi-polar cap costs $0.30 to $0.53 each. When, as in this case, you have two pins, it does not make sense.
  • SUPPORTER

R.G.

Quote from: PRR on November 28, 2010, 07:50:25 PM
> latching relays require the coordinated use of two signals
One pin and a cap:
Yep, you can make that work. It's not what the relay manufacturers recommend, but it does work. It requires some special-case work.
The capacitor energy storage has to be sized right for the relay, and there are timing constraints because you have to ensure that the cap is always charged up for the opposite-going activation. Too little cap charge will not activate the flip. 'Course that's not too big a deal in effects use.

Strictly speaking, it is the coordinated use of two pins - just one of them is a power supply pin that's being used as an active pin.  :icon_biggrin:
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.

MetalGuy

QuoteWhen you say "delay line" do you mean a delay on unmuting the signal path?

Yes. When you press the button a FET mutes the signal then relay switches then unmute signal. Since you have a free pin it's betterto have one such delay/mute line.

jasperoosthoek

Subscribing :).

Hmm, optocouplers to remotely swich them and avoid loops :). Maybe use pulse widths to switch the effects on and off or even some daisy chain connecting to each box. Maybe optical connectors.

It's a very elegant idea. Effects working normally on their own and have the ability to use presets. Who needs an expensive switch box? Just a controller that you can go without. ;)
[DIYStompbox user name]@hotmail.com

R.G.

Quote from: MetalGuy on November 29, 2010, 02:07:20 PM
QuoteWhen you say "delay line" do you mean a delay on unmuting the signal path?
Yes. When you press the button a FET mutes the signal then relay switches then unmute signal. Since you have a free pin it's betterto have one such delay/mute line.
Yeah, I've done that process before, it's why I asked. I was just confused by the term "delay line".  I used a P-channel JFET for the muter. Works well with logic and sits at a DC voltage of ground.
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.

MetalGuy

QuoteI used a P-channel JFET for the muter.

+1. I used J174 and J175 which are widely used for this purpose.

R.G.

I went ahead and put a mute transistor in. It's optional, of course. Bumped the board size to just over a square inch. It's 1.4 x 0.75 inches.

Instead of a prepackaged "FX In", "FX Out", "Input Jack"... etc. I went ahead and brought out all the relay contacts, just as though this was a DPDT switch, so it can be wired up into any of the true bypass setups. I also brought out the muting contact separately from the relay so it can be wired to an output line or to other places as desired. It's a tinkerer's bypass board.

Of course, the work in making the layout is so trivial that I may as well make a beginner's board too, with just in, out, FXin, FXout, etc.
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.