News:

SMF for DIYStompboxes.com!

Main Menu

JFet switching with 3.3V logic

Started by AdamB, July 08, 2019, 12:56:48 PM

Previous topic - Next topic

AdamB

Hi,

I'm working on a switching circuit that selects between audio signals, driven by a dspic. The pic's digital pins provide 3.3V TTL, wondering how I might go about rigging it up to replace the footswitch in this circuit that relies on a +9V supply for the JFETs;



I want to avoid using relays (too big) and haven't been able to find a switch IC that seems to do this job well/cheap/small TH footprint.

The schematic is from a unit I'm designing based around a dspic - the switching works fine driven by a 3PDT switch (with one pole used to control the dspic and the other 2 poles used to control the audio switching). However I want the ability to control whether the effect is latching or non-latching switching. So I'd like to simply use a SPST momentary switch to drive the dspic logic and then have the dspic control the audio switching side of things itself.

Any ideas?
[indifferent::engine]
http://www.indifferentengine.com

Rob Strand

I'm not sure if you just want to interface the 3V microprocessor to the existing 9V circuit, or, remove 9V altogether.

For the first case you just need to drive the gates with an open collector or open drain circuit.   You probably won't be be able to drive the gates directly from the microprocessor with an open drain/collector configured pin.  You will need to add a transistor or MOSFET. 

Take this ckt
https://www.hobby-hour.com/electronics/s/schematics/od1-overdrive-schematic.gif

(Roughly) imagine stripping out:
LED drive ckt
R19, R18, C10, C13, C14
C11, C12,
then break R22 from R20 and R23 from R21
then drive the micro into the now floating resistor ends of R22 and R23.
You will need to reduce the 2x100ks to at least 56k so the transistors will switch at 3V3.

The whole idea is to provide a floating collector output which can go upto 9V when the switched (Q2, Q4) are off.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

AdamB

Thanks for the reply, I'll try and figure my way through your answer!
[indifferent::engine]
http://www.indifferentengine.com

Rob Strand

#3
This is a simpler version.



The extra resistors and caps on the Boss circuit help reduce ticks when switching over.
The simpler version doesn't have this but it will help you understand the main idea.

Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

AdamB

Ok I think I understand that now - time to breadboard! Once I got it I'll copy it over to my schematic and repost for others to use.

Massive thanks for the help!
[indifferent::engine]
http://www.indifferentengine.com

AdamB

Seems to work OK on the breadboard.

Here's my schematic for it;


[indifferent::engine]
http://www.indifferentengine.com

MetalGuy

Quote...and haven't been able to find a switch IC that seems to do this job well/cheap/small TH footprint.

How about Analog's ADG series CMOS switches?

Rob Strand

QuoteSeems to work OK on the breadboard.
It should work.  The only thing you might have to watch out for is 'ticks' when changing over.   The extra caps on the Boss ckt help reduce that to a minimum.

QuoteHow about Analog's ADG series CMOS switches?
Nothing wrong with that path either.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

ElectricDruid

Quote from: AdamB on July 16, 2019, 11:27:40 AM
Seems to work OK on the breadboard.

Here's my schematic for it;



I don't doubt that works, but is all that stuff *necessary*?

With the diode on the FET's gate, the pull-up to 9V doesn't do anything, does it? The diode is reverse-biased. I thought the original Boss idea was that the Gate floats high in this condition, but I might be wrong - never studied this stuff.
Also why drive the transistor bases from a voltage divider that reduces the voltage at the base? You can drop the resistor to ground, surely? If you're not getting enough current to switch them on, reduce the base resistor a bit.

I'm interested to see this succeed because this is something I've wanted to do too, so I hope my comments are useful and not just poorly-informed misunderstandings. Switching FETs on and off directly from a uP offers several interesting possibilities...;)

HTH,
Tom

Rob Strand

#9
QuoteWith the diode on the FET's gate, the pull-up to 9V doesn't do anything, does it? The diode is reverse-biased. I thought the original Boss idea was that the Gate floats high in this condition, but I might be wrong - never studied this stuff.
It might work floating.  It's better to force the issue from a noise perspective and to avoid any weird behaviour related to the gate capacitances charging up and causing fizzyness.
[BTW:  In the Boss Vibrato thread a few months back a 10M pull-up had problems.]

QuoteAlso why drive the transistor bases from a voltage divider that reduces the voltage at the base? You can drop the resistor to ground, surely? If you're not getting enough current to switch them on, reduce the base resistor a bit.
That will work for sure.   The resistors make the transistor switch at 1.2V or so roughly mid 3V3 rail.  There's cases where you should use base-emitter resistors but in this case you don't really need them.

QuoteSwitching FETs on and off directly from a uP offers several interesting possibilities
If you look at professional products they often use circuits like the Boss circuit with the pull-ups, diodes, and RC networks to provide soft change-overs.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

AdamB

Ordered a PCB prototype to test this revision so will confirm how well this solution works and then move onto the next revision. I've left out the extra caps from the boss design for now, will asses whether I need them once I hear this working as is and add them to the next revision if needed.

I'll let you know how I get on!
[indifferent::engine]
http://www.indifferentengine.com

AdamB

QuoteHow about Analog's ADG series CMOS switches?

Good suggestion, however my issue is that looking around mouser I couldn't see any that are through hole to make designing with it easier for a simpleton like me! But, maybe I'm not looking hard enough. Whilst I am intending to use SMD in my project (the PCBs I have on order are the first that switch to SMD pics and RAM chips to reduce size, now that I know from previous revisions that my pic and ram stuff is working fine). But when designing each stage of the circuit I need to start first with through hole stuff to make prototyping easier and reduce the number of iterations I have to go through to get stuff to work, being as I don't really know what I'm doing!

That being said, assuming this switching stuff works as planned and I can move onto the next part of the project, I am faced with the daunting task of replacing the onboard ADC/DAC of the dspic with a codec chip of some sort, which are seemingly all SMD, too. So I'm gonna have to go through some pain there, building PCBs that might not work. Chip wise I'm looking at whatever is cheap/simple and supports SPI. SPI might not be ideal? But I have a good idea of how to wire up, so hopefully won't take too many revisions of rookie errors to get that working! The pic I'm using has 2 SPI modules, so I'm also kinda hoping it's speedy enough to do 16bit 48Khz audio as well as talking to the ram chips.
[indifferent::engine]
http://www.indifferentengine.com

ElectricDruid

For talking to a codec, you might be better with I2S rather than SPI. I2S ("Inter-IC Sound") is the standard for that type of job. While there are plenty of SPI DACs and ADCs out there, the ones aimed at audio tend to go with I2S.

Some of the dsPICs have an I2S interface built-in to make life easier for connecting up a codec. Coupled with the DMA, you can get cool stuff going on where your data miraculously arrives in RAM without your code having to do anything at all and without holding up the processor with interrupts.

AdamB

Ok good to know! I just found this prototyping board;

https://www.mikroe.com/audio-codec-proto-board

that looks like it supports both spi and i2s so I can try both ways, and means I can breadboard and get data going in and out of the pic before committing it to PCB.

Then I suppose I just have to figure out the input/output conditioning for guitar signals for it.

[indifferent::engine]
http://www.indifferentengine.com

AdamB

Right, an update on this switching thing.

So breadboard tests went fine though I only tested 1 JFET switch attached to 1 pin on the dspic, but felt confident enough with it that I moved ahead and built a PCB version.

The PCB version is a fail, here's my problem; What I didn't test on the breadboard was two JFET gates operating together (one on the dry signal and one on the wet, controlled by separate logic pins) and it seems that somehow the 2 JFETs are interfering with one-another's operation;

I have 2 pins of 3.3V logic controlling the switching, one is the 'DRY_SWITCH' and the other is the 'WET_SWITCH'. Bringing this pin low should open the associated JFET gate. The idea with this setup is that the user can select whether the effect is latching/momentary, and whether the dry is muted while the wet is playing.

If you only have dry or wet, but not both, you get a useable signal. I can't be sure but I *think* it's slightly quieter than what it should be, which leads me to suspect the JFETs aren't opening up fully. However it "works".

But, if you try to un-mute both the dry and the wet together (pull both switch pins low) you get lots of buzzy heavy distortion of both signals. However, if you switch to bridge pickup and pick as hard as you can, then it seems to pop both the JFETs open (even the wet signal JFET, which is not playing any of the dry signal) and the distortion disappears completly (it also seems to go louder than the wet on its own or dry on its own, which is what leads me to believe the JFETs aren't opening properly when used independently).

Anyone have an idea what's going on here? Attached is the schematic, it's the same as what I posted earlier;


[indifferent::engine]
http://www.indifferentengine.com

gena_p1

Quote from: MetalGuy on July 16, 2019, 03:00:14 PM
Quote...and haven't been able to find a switch IC that seems to do this job well/cheap/small TH footprint.

How about Analog's ADG series CMOS switches?

FET switching is fine with capacitor on gate , but CMOS switching is edgy , and without zerocross or kind of that at the input of reverb it's harsh

Rob Strand

#16
QuoteIf you only have dry or wet, but not both, you get a useable signal. I can't be sure but I *think* it's slightly quieter than what it should be, which leads me to suspect the JFETs aren't opening up fully. However it "works".
To cut to the chase I think you might be better-off moving the JFET switches to the input of the opamp.  Increasing the resistors on the opamp from 10k to 47k might also help. 

In your current set-up the input voltages modulate the JFET drain and source voltages relative to VR.  The JFETs voltage are "flapping about".  This in turn modulates the Vgs voltage and hence the JFET resistance.   The 10k resistances on the opamp are quite low and that makes the problem worse as the JFETs resistance needs to be low relative to the 10k value.

By moving the switches to the opamp of the 10k resistors the voltages on the JFETs are pinned at VR on one side and only modulate a small amount on the other (basically the divider formed by the 10k input resistor and the JFET resistance on the other).   Now you can see by making those resistors 47k the voltage across the JFET is kept 5 times lower than 10k (and probably 100 times less than what you have now).

Look at some Boss circuits.  This type of thing,


Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

AdamB

Ok I think I understand it, cheers for the help - will roll that into the next version and see how goes!
[indifferent::engine]
http://www.indifferentengine.com

AdamB

Just mocking this up, this is what I got from your post, Rob. Blue squares are where I've moved the 10K resistors to so that the switch is between the resistor and the op-amp input, and bumped them to 47K. I've also added in the capacitors (orange squares) to remove the clicks on switching (as you suggested earlier - can confirm this thing pops like crazy when you switch :P). I *think* I've put the capacitors in the right place, but I find that old boss schematic hard to read for some reason, something about the way it's laid out doesn't agree with me.



I'll hook up the wet side in the same way and then when I roll the next revision I'll let you know how it went!
[indifferent::engine]
http://www.indifferentengine.com

Rob Strand

The series caps won't work.   The Bass-Emitter cap might work but it's often not a good place to put timing caps.
I've mark up the schematic to be more Boss-like.
Notice you don't need to 1M at the terminal going to the opamp.



Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.