Author Topic: Drive a 12V analog switch from logic level input  (Read 2293 times)

0 Members and 1 Guest are viewing this topic.

Offline hermitengineerTopic starter

  • Regular Contributor
  • *
  • Posts: 80
  • Country: us
Drive a 12V analog switch from logic level input
« on: November 22, 2019, 06:49:43 am »
I'm looking for a quick and dirty way to interface with a 4066 analog switch from a MCU.  The 4066 is supplied with 12V, and if I read the datasheet right, that means it needs close to 9V to turn it on.  So I need a logic to 12V level shifter (I picked 12V because there's a rail for that).  One quick and dirty solution is to drive a PNP transistor with an NPN transistor.  But I'd like to simplify that even more.

Would an optocoupler be a viable way to supply the 12V?  I'm thinking, MCU digital pin -> resistor -> LED side of optocoupler -> ground; 12V -> collector -> connector to switch.  Possible IC would be VOM617A-3.
 

Offline A Hellene

  • Frequent Contributor
  • **
  • Posts: 602
  • Country: gr
Re: Drive a 12V analog switch from logic level input
« Reply #1 on: November 22, 2019, 07:32:05 am »
How about just using a low power N-Channel MOSFET (e.g. the 2N7000 or its SMD version 2N7002) in common Gate topology, and a 1..22k pull-up resistor?

Input will be the Source pin, the Gate pin will be connected to the low voltage Vdd supply rail, and output will be the Drain pin with a 4k7..12k pull-up resistor to +12V.

-George
Hi! This is George; and I am three and a half years old!
(This was one of my latest realisations, now in my early fifties!...)
 

Offline jhpadjustable

  • Frequent Contributor
  • **
  • Posts: 295
  • Country: us
  • Salt 'n' pepper beard
Re: Drive a 12V analog switch from logic level input
« Reply #2 on: November 22, 2019, 08:26:53 am »
Invert the control input and use just one transistor? :)

Less dirty is to use complementary PNP/NPN transistors in 6-pin small packages.

How about just using a low power N-Channel MOSFET (e.g. the 2N7000 or its SMD version 2N7002) in common Gate topology, and a 1..22k pull-up resistor?

That level shifter design depends on the difference between the two rails being smaller than Vgs(th). 7V is way too much.
"There are more things in heaven and earth, Arduino, than are dreamt of in your philosophy."
 

Offline A Hellene

  • Frequent Contributor
  • **
  • Posts: 602
  • Country: gr
Re: Drive a 12V analog switch from logic level input
« Reply #3 on: November 22, 2019, 09:00:21 am »
Nah! The transistor doesn't care about Vdg being 7V, as long as its Source is tied to the Gate! It is a 60V device with a Vgs_th of  1.0 .. 2.5V, so a Vgs_th of 3.3V will open the channel all right in order to pass the 1..2mA pull-up Drain current.

Also, being in common Gate topology, it does not need any inversion at its input:
- When its input is logic-high Vgs == (Vdd-Vdd) = 0V, so the channel is closed and no Drain current flows; the output becomes +12V via the output pull-up resistor.
- When its input is logic-low Vgs == (Vdd-Vss) = (Vdd)V, so the channel opens and Drain current flows; the output becomes 0V via the logic output transistor of the level-shifter driver and the 5Ω transistor channel.

Actually, that circuit above, is a stripped-down version of the bi-direcrional level-shifter Philips proposed at their IIC protocol specification!

-George


EDIT: Clarifications and corrections.
« Last Edit: November 22, 2019, 09:09:30 am by A Hellene »
Hi! This is George; and I am three and a half years old!
(This was one of my latest realisations, now in my early fifties!...)
 

Offline magic

  • Super Contributor
  • ***
  • Posts: 7454
  • Country: pl
Re: Drive a 12V analog switch from logic level input
« Reply #4 on: November 22, 2019, 09:02:56 am »
You should probably use BSS138 instead of 2N7000, though. The latter is rather marginal at 3.3V.
Not sure what to use in THT.
 

Offline hermitengineerTopic starter

  • Regular Contributor
  • *
  • Posts: 80
  • Country: us
Re: Drive a 12V analog switch from logic level input
« Reply #5 on: November 22, 2019, 09:05:55 am »
Invert the control input and use just one transistor? :)
Oh, duh.  You mean something like the upper part of this?

 

Offline Alex Nikitin

  • Super Contributor
  • ***
  • Posts: 1330
  • Country: gb
  • Femtoampnut and Tapehead.
    • A.N.T. Audio
Re: Drive a 12V analog switch from logic level input
« Reply #6 on: November 22, 2019, 09:12:56 am »
How about just using a low power N-Channel MOSFET (e.g. the 2N7000 or its SMD version 2N7002) in common Gate topology, and a 1..22k pull-up resistor?

That level shifter design depends on the difference between the two rails being smaller than Vgs(th). 7V is way too much.

No it doesn't.

Cheers

Alex
 

Offline hermitengineerTopic starter

  • Regular Contributor
  • *
  • Posts: 80
  • Country: us
Re: Drive a 12V analog switch from logic level input
« Reply #7 on: November 22, 2019, 09:13:33 am »
Oh yeah, the simple transistor circuit above won't work anyway because the existing circuit has a 10K pull-down to ground connected to its switch control.  So you pretty much need to drive it with the transistor instead of trying to let a pull-up handle it.
 

Offline A Hellene

  • Frequent Contributor
  • **
  • Posts: 602
  • Country: gr
Re: Drive a 12V analog switch from logic level input
« Reply #8 on: November 22, 2019, 02:06:40 pm »
Oh yeah, the simple transistor circuit above won't work anyway because the existing circuit has a 10K pull-down to ground connected to its switch control.  So you pretty much need to drive it with the transistor instead of trying to let a pull-up handle it.
Oh, yes, it will work!

Just remove the pull-down '4066 cntrol input resistor, or make the MOSFET Drain pull-up resistor steeper (of a lower resistance that recommended above); e.g. of the one fifth of the bilateral switch pull-down input resistor value, because both the recommended MOSFETs (the 2N... as well as the BSS...) can very easily handle a few decades of milliampers Drain load with a more than 3.0V Gate drive.


-George
Hi! This is George; and I am three and a half years old!
(This was one of my latest realisations, now in my early fifties!...)
 

Offline jhpadjustable

  • Frequent Contributor
  • **
  • Posts: 295
  • Country: us
  • Salt 'n' pepper beard
Re: Drive a 12V analog switch from logic level input
« Reply #9 on: November 22, 2019, 03:17:13 pm »
No it doesn't.
Oh, I see I got the source and drain backwards while looking into it. :-[ Disregard...

Oh, duh.  You mean something like the upper part of this?
Yeah, like that. But either of these solutions is troublesome if there's a big pulldown on the higher-voltage side to contend with, unless you can get rid of it. Or move the pulldown to the lower-voltage side and get rid of the pullup on the lower-voltage side.
"There are more things in heaven and earth, Arduino, than are dreamt of in your philosophy."
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 6420
  • Country: de
Re: Drive a 12V analog switch from logic level input
« Reply #10 on: November 22, 2019, 05:33:51 pm »
Almost all analog switches have separate digital and analog supply pins with internal level shifting. The 4066 is an exception. Check out the DG6xx or the DG4xx series from Vishay, for instance.
 
The following users thanked this post: Bassman59, thm_w

Offline hermitengineerTopic starter

  • Regular Contributor
  • *
  • Posts: 80
  • Country: us
Re: Drive a 12V analog switch from logic level input
« Reply #11 on: November 22, 2019, 06:35:59 pm »
For more background, this is a vintage game console, the Colecovision.  It has an expansion port that I'm connecting to.  The pin in question switches video output from its internal chip to the expansion port's video input.  Commercial expansion modules just shorted +12V to the video enable, but I'd like to be selective.

Anyway, I'd like to treat the CV itself as a black box, though I at least know its internal circuitry.  So that means no mods to the 4066 or removal of its 10K pull-down.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 20363
  • Country: gb
  • 0999
Re: Drive a 12V analog switch from logic level input
« Reply #12 on: November 22, 2019, 11:42:02 pm »
Why not simply use a logic level translator IC such as the CD4504 or CD40109? It's non-inverting and doesn't require any other components.
http://www.ti.com/lit/ds/symlink/cd4504b.pdf
http://www.ti.com/lit/ds/symlink/cd40109b.pdf

Oh and if you do want to go discrete, a BJT can be used in non-inverting configuration by connecting the input to the emitter, rather than the base.
 

Online vk6zgo

  • Super Contributor
  • ***
  • Posts: 7858
  • Country: au
Re: Drive a 12V analog switch from logic level input
« Reply #13 on: November 23, 2019, 03:31:00 am »
Of course, you do realise that +12v is a legitimate logic level in its own right?
 

Offline hermitengineerTopic starter

  • Regular Contributor
  • *
  • Posts: 80
  • Country: us
Re: Drive a 12V analog switch from logic level input
« Reply #14 on: November 23, 2019, 07:40:01 am »
Why not simply use a logic level translator IC such as the CD4504 or CD40109? It's non-inverting and doesn't require any other components.
http://www.ti.com/lit/ds/symlink/cd4504b.pdf
http://www.ti.com/lit/ds/symlink/cd40109b.pdf

Oh and if you do want to go discrete, a BJT can be used in non-inverting configuration by connecting the input to the emitter, rather than the base.

A 4504 may indeed be the most robust and simple solution.  I just turn up my nose at the number of unused gates  >:D  Why don't they make a single-gate version that can take 12V+?

As mentioned above, the existing circuit within the "black box" that I'm interfacing to uses a 10K pull-down, so a resistive supply would not be a good match.  So unfortunately, that level shifter circuit has the same problem as the MOSFET ones.
 

Online vk6zgo

  • Super Contributor
  • ***
  • Posts: 7858
  • Country: au
Re: Drive a 12V analog switch from logic level input
« Reply #15 on: November 23, 2019, 04:05:14 pm »
Invert the control input and use just one transistor? :)
Oh, duh.  You mean something like the upper part of this?

(Attachment Link)


If it doesn't have to be very fast, the bottom part would be better.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 20363
  • Country: gb
  • 0999
Re: Drive a 12V analog switch from logic level input
« Reply #16 on: November 23, 2019, 08:43:38 pm »
Why not simply use a logic level translator IC such as the CD4504 or CD40109? It's non-inverting and doesn't require any other components.
http://www.ti.com/lit/ds/symlink/cd4504b.pdf
http://www.ti.com/lit/ds/symlink/cd40109b.pdf

Oh and if you do want to go discrete, a BJT can be used in non-inverting configuration by connecting the input to the emitter, rather than the base.

A 4504 may indeed be the most robust and simple solution.  I just turn up my nose at the number of unused gates  >:D  Why don't they make a single-gate version that can take 12V+?

As mentioned above, the existing circuit within the "black box" that I'm interfacing to uses a 10K pull-down, so a resistive supply would not be a good match.  So unfortunately, that level shifter circuit has the same problem as the MOSFET ones.

I don't know why they don't make a single gate version, but they're not expensive, so not using all of the gates shouldn't matter. It will certainly use less power than a discrete solution and probably work out cheaper too.

In the discrete solutions, an additional transistor can be added to pull the output hard up to the positive rail or use the opto-coupler, as you posted before, but both options will be more expensive and power hungry than a logic level translation IC.

The pull-down resistor is also no problem for a logic level shifter IC.
« Last Edit: November 23, 2019, 09:29:28 pm by Zero999 »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf