electronic switching to ground - bi-directional MOSFET switch perhaps?

Started by samhay, August 12, 2013, 12:26:37 PM

Previous topic - Next topic

samhay

Apologies if this has come up before. I have been thinking about switching audio to ground electronically e.g. with a 0/5V or 0/9V control voltage.
If I don't fancy the size, expense and power consumption of a relay, the next obvious approach is probably to use CMOS (CD4066). However, am I correct in assuming that I can not ground CMOS inputs or outputs without using a bipolar supply? If I'm wrong, then great - the rest is academic.
Note - While in some cases, I guess I could bias the signal up to half supply (and then ground to Vref), there are scenarios when this is not going to be trivial.

I suspect there are other options that I haven't considered, but these are the alternatives that emerged from the latest brain fart - 
JFETS might work, but the audio may be >1V +/- at times, so I am not sure how well a leaky JFET will cope. Similarly,  a simple MOSFET switch (signal to drain, source to ground) is out due to the body diode clipping the signal when 'off'. However, the super low 'on' resistance of MOSFETs is attactive, so is there any harm in using a pair of MOSFETs with source (or drain) connected as below? I can't find a lot of info on this configuration, but I may be struggling as it is either a bad idea, or I don't know what to call it. 
Our favortite 2N700 or BS170 aught to work with a 5V control/ G/S voltage, and I am guessing that a pull-down resistor (and slow-down cap maybe) from gate to ground might be a good idea, as would  a resistor from control to gate to prevent ringing. How about a resistor from source to gate to prevent them floating too?
It starts getting a bit messy at this stage, but it should work in theory. Any thoughts?

Thanks.

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

duck_arse

in my experience, you can ground or supply the 4016/4066 gate I/O's to your hearts content.
" I will say no more "

samhay

OK thanks - that sounds promising. I guess I will have to put one on the breadboard.
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

merlinb

Quote from: duck_arse on August 12, 2013, 12:53:13 PM
in my experience, you can ground or supply the 4016/4066 gate I/O's to your hearts content.

I'm not sure this is correct. As Samhay summised, I believe you need a bipolar control voltage, unless you bias the CMOS switch to half the rail voltage somehow.

samhay

OK - I haven't had a chance to play with a 4066 yet, so we have 1 for and 1 against it working. I found an old thread where Andrew (Tone_God) warns against such practice though - http://www.diystompboxes.com/smfforum/index.php?topic=16277.0;wap2.

Any thoughts on the dual MOSFET switch? I played with one last night and it seemed to work. Haven't scoped it with audio yet, so not sure if there is any distortion when 'off'.
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

slacker

I simulated your mosfet idea and it appears to work, got some funny DC offset when open but with an AC coupled signal that's probably not an issue.
I don't see why you can't ground one side of 4066 switch. I don't know what it will do to the signal when open though.

duck_arse

my experience of 4066's is with single supply, and cmos 4000 series to do the switching logics. I found they worked w/ less bypass popp when in and out were biased to half supply.
" I will say no more "

samhay

Quote from: duck_arse on August 13, 2013, 10:22:17 AM
my experience of 4066's is with single supply, and cmos 4000 series to do the switching logics. I found they worked w/ less bypass popp when in and out were biased to half supply.

That would make sense if you are getting a DC offset when you pull the signal above/below the power rails.

I will have play tonight and see how much I can abuse one of them.
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

samhay

Quote from: slacker on August 13, 2013, 08:26:16 AM
I simulated your mosfet idea and it appears to work, got some funny DC offset when open but with an AC coupled signal that's probably not an issue.
I don't see why you can't ground one side of 4066 switch. I don't know what it will do to the signal when open though.

Yeah - I started with a simulation. Will have to see how it fairs in the real world though. The DC offset worries me a little bit - I can clamp the source to gate to stop this floating and the input drain to ground, but it starts to feel like a more complicated solution that it perhaps needs to be.
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

merlinb

Quote from: samhay on August 13, 2013, 11:04:47 AM
Yeah - I started with a simulation. Will have to see how it fairs in the real world though. The DC offset worries me a little bit - I can clamp the source to gate to stop this floating and the input drain to ground, but it starts to feel like a more complicated solution that it perhaps needs to be.

Is the signal souce already biased to 4.5V? If so, you could just put a cap between the CMOS switch and ground, to block DC but allow the AC to be shunted to ground when the switch is closed. Possibly add a resistor in parallel with the switch to keep the cap charged. Ovbiously, the muting will degrade at very low frequencies, depending on the source resistance, but maybe you can afford to use a big cap.

samhay

Quote from: merlinb on August 13, 2013, 11:42:01 AM
Quote from: samhay on August 13, 2013, 11:04:47 AM
Yeah - I started with a simulation. Will have to see how it fairs in the real world though. The DC offset worries me a little bit - I can clamp the source to gate to stop this floating and the input drain to ground, but it starts to feel like a more complicated solution that it perhaps needs to be.

Is the signal souce already biased to 4.5V? If so, you could just put a cap between the CMOS switch and ground, to block DC but allow the AC to be shunted to ground when the switch is closed. Possibly add a resistor in parallel with the switch to keep the cap charged. Ovbiously, the muting will degrade at very low frequencies, depending on the source resistance, but maybe you can afford to use a big cap.

I'm sure I could re-think and re-jig things so that we are not directly switching to ground. That would ruin the academic exercise though, and CMOS is possibly a better option then anyway. One worry about working at half supply is that you have to pull the gate well above source and you then run the risk of running out of room to make your threashold voltage before you hit V+. I guess we can tie the sources to ground with a large resistor, but then you have a big pop waiting to happen.
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

duck_arse

there is a page over at geofex (obviously!) on using the 4053 (is it?) multiplexer just like a transmission gate thingy.
" I will say no more "

samhay

Quote from: duck_arse on August 13, 2013, 12:01:44 PM
there is a page over at geofex (obviously!) on using the 4053 (is it?) multiplexer just like a transmission gate thingy.

I've seen it, and half the battle there is keeping everything at half supply too. It's a good option if you want SPDTs though.
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

samhay

I have had a play with both a 4066 and the 2-MOSFET switch on the breadboard.

I fried a few 2N7000s trying the bi-directional switch. With various pull-up/down resistors, it worked to a point, but it is a bit fiddly and probably too fragile to bother with. I guess the MOSFETs aren't happy with the gate floating above/below D and S?

The 4066 seemed to work fine when pulling the output to ground. I need to spend some more time with the scope to make sure I am not getting distortion, but it looks promising. I also managed to pull the switch on with 5V when using a 9V supply. This is a lot lower than recomended, but again seemed to work pretty well and suggests that the 4066 might play nice directly with a 5V uC.

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.

Quote from: samhay on August 12, 2013, 12:26:37 PM
Apologies if this has come up before. I have been thinking about switching audio to ground electronically e.g. with a 0/5V or 0/9V control voltage.
If I don't fancy the size, expense and power consumption of a relay, the next obvious approach is probably to use CMOS (CD4066). 
Actually, the next obvious approach is to use an NPN with a great big capacitor in series with its collector. This has its own set of issues, but was the method used for most audio routing in much of the Japanese stereo equipment of the 70s and 80s.

The issues with all switches in audio work are on-ness to off-ness ratio, offset voltages, and control feedthrough, along with the issues of cost and size that are always with us. Relays win on all of these except the last two.  Switching speed from control signal to finished switching matters in some applications, but can be a disadvantage with audio.

QuoteHowever, am I correct in assuming that I can not ground CMOS inputs or outputs without using a bipolar supply? If I'm wrong, then great - the rest is academic.
You are wrong on both counts. Yes, you can switch inputs to/from ground with CMOS switches, but you're also wrong, because this causes poor on-ness and also greater feedthrough of the control signals. I found this out by sad experience. It's harder to get rid of the control signal click this way. That's really why I and later Andrew went for biasing signals in the middle of the power supply. It helps cancel the click.

The CD405x trio let you switch ground-referenced signals with 0-5V control logic by providing a "VEE" pin so you can feed the switches from a bipolar Vdd-Vee and switch from ground. Of course, making a Vee is complicated, too.

QuoteNote - While in some cases, I guess I could bias the signal up to half supply (and then ground to Vref), there are scenarios when this is not going to be trivial.
You can always "ground" to Vref through a large capacitance as long as Vref is low enough impedance.

QuoteJFETS might work, but the audio may be >1V +/- at times, so I am not sure how well a leaky JFET will cope.
The issue with JFETs and the signal to be switched is generally how far you pull Vgs off. If you are switching big signals, you want the biggest "off" voltage between gate and source that you can get. For N-channels, this is usually to bias them up at about 9Vdc and ground the gate. For P-channels, you'd hold the drain and source at DC ground and pull the gate as high as you can; 9V for a 9V pedals. JFETs do not have a problem with holding off signals, except that they only remain off for signals smaller than Vgate-source minus Vgsoff. JFETs in general are not leaky, they're just not driven properly (or easy to drive properly) in 9V powered pedals.
Quote
Similarly,  a simple MOSFET switch (signal to drain, source to ground) is out due to the body diode clipping the signal when 'off'. However, the super low 'on' resistance of MOSFETs is attactive, so is there any harm in using a pair of MOSFETs with source (or drain) connected as below? I can't find a lot of info on this configuration, but I may be struggling as it is either a bad idea, or I don't know what to call it. 
It's a good idea, and it's the standard idea for MOSFETs to switch AC. It's used in most MOSFET-output "relays". It's been around for some years. It's complicated to drive well, so it doesn't get much use in 9V pedals.
Quote
Our favortite 2N700 or BS170 aught to work with a 5V control/ G/S voltage, and I am guessing that a pull-down resistor (and slow-down cap maybe) from gate to ground might be a good idea, as would  a resistor from control to gate to prevent ringing. How about a resistor from source to gate to prevent them floating too?
It starts getting a bit messy at this stage, but it should work in theory. Any thoughts?
You're right, it starts getting messy.

I've used MOSFETs for switching AC and DC in isolated setups by using LED-to-photovoltaic drivers. These are LEDs driving a stack of small "solar cells" to generate a voltage from light. The MOSFET gate doesn't need much current to switch, so this works well. Panasonic, IR, and others make LED->PV drivers, including an LED to dual PV that can switch two MOSFETs simultaneously.

But you can do it with careful design of the gate-source drive, too. But it does get messy.


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.

samhay

Thanks R.G. Having done some more reading, I have come, more or less, to those same conclusions.

I was thinking about using BJT switches this morning, so will give that a try to round out the set of experiments.  Although I have got things to work, I feel like I haven't quite found a working solution that I like yet and/or works as well as it could - especially one that works nicely with 3.3V and 5V control signals.

I guess I will ultimately decide I need to start thinking about relays again too. Anybody have a favourite 9V or 5V relay?
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

defaced

QuoteAnybody have a favourite 9V or 5V relay?
Omron G5V, but those are non-latching.  I'm sure Omron makes a latching equivalent. 
-Mike

samhay

Quote from: defaced on August 16, 2013, 12:20:47 PM
QuoteAnybody have a favourite 9V or 5V relay?
Omron G5V, but those are non-latching.  I'm sure Omron makes a latching equivalent. 

Thanks. I don't use batteries, so non-latching is potentially a good thing.
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

samhay

Had a play using NPN BJTs for the switching. While they are not really up to the task of doing bypass switching, they work at least as well as anything else (bar relays), don't self-destruct when you look at them funny, can do a hard mute by level shifting, and can be directly controlled with a uC.
I guess if they were good enough for my first stereo, then they are probably good enough for my nth stompbox too.
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.

Quote from: samhay on August 16, 2013, 05:42:36 PM
While they are not really up to the task of doing bypass switching
Yep, NPNs are not really up to the task of bypass switching.
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.