Author Topic: Switching a 9V line in a 3.3V circuit  (Read 5907 times)

0 Members and 1 Guest are viewing this topic.

Offline MaxlorTopic starter

  • Frequent Contributor
  • **
  • Posts: 565
  • Country: ch
Switching a 9V line in a 3.3V circuit
« on: January 05, 2014, 05:07:50 am »
I'm experimenting with switches and toggles today, and encountered one problem for which I need a hint. How can I electronically switch connect or disconnect a signal line that occasionally goes much higher than Vdd, i.e. between 9 and 14V?

I've come up with a circuit that allows me to connect and disconnect a PICkit3 from the target board using a single momentary switch. Yes, not the most useful thing, and I could use a slide switch, but it's really just an exercise to figure out how to do something like that, and disconnecting the PICkit3 is the first practical example that came to mind.

I can disconnect and reconnect the data lines of the PICkit3 easily using a 74HC4066 analog switch. However, the reset line goes into the range 9-14V when entering programming mode, and the 4066 as well as a couple of other types of switches I looked at only handle Vdd+0.5V or something like that. I could use a relay, but I was hoping there was a more elegant, solid state, solution?

My first thought was using a transistor, but: the reset line has 3 states, low (0V), high (3.3V) and programming (9V), and I couldn't figure out how to make that work. So, how do you do it?
 

Offline jeremy

  • Super Contributor
  • ***
  • Posts: 1079
  • Country: au
Re: Switching a 9V line in a 3.3V circuit
« Reply #1 on: January 05, 2014, 06:17:17 am »
How about a good old mechanical relay? http://en.wikipedia.org/wiki/Relay

edit: whoops, just read that you thought of relays :)

How about using a MOSFET? In a switching configuration, mosfets basically only care about whether the gate is higher than the threshold voltage, you can switch much higher voltages and currents within the rating of the device on the drain and source? See solid state relays (aka MOSFETs + support circuitry inside a big blob of epoxy)

edit2: Also, look for level shifting circuits based on MOSFETs a la https://www.sparkfun.com/products/8745
« Last Edit: January 05, 2014, 06:24:05 am by jeremy »
 

Offline MaxlorTopic starter

  • Frequent Contributor
  • **
  • Posts: 565
  • Country: ch
Re: Switching a 9V line in a 3.3V circuit
« Reply #2 on: January 05, 2014, 07:35:09 am »
Oh that sounds good. I haven't familiarized myself with the differences between the different types of transistors yet; I guess I should get started on that :) Thanks!
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17814
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Switching a 9V line in a 3.3V circuit
« Reply #3 on: January 05, 2014, 08:20:26 am »
your going to need an analogue switch really to pass highs or lows a relay does sound like the best option.
 

Offline jeremy

  • Super Contributor
  • ***
  • Posts: 1079
  • Country: au
Re: Switching a 9V line in a 3.3V circuit
« Reply #4 on: January 05, 2014, 08:33:10 am »
Ah, if you're just pulling the reset line high to burn the flash in the micro, I can't imagine it would make a huge difference whether you use a FET or a traditional relay.

Gotta avoid mechanical parts when you can ;)
 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4694
  • Country: au
  • Question Everything... Except This Statement
Re: Switching a 9V line in a 3.3V circuit
« Reply #5 on: January 05, 2014, 08:37:07 am »
for $1.50 you can buy an optical analog switch, a large number of them only take 1mA to switch, and can handle a considerable current. (essentially 2 photo-fets back to back to prevent the body diode causing problems)
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17814
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Switching a 9V line in a 3.3V circuit
« Reply #6 on: January 05, 2014, 08:37:28 am »
well analogue switch of some sort then
 

Offline MaxlorTopic starter

  • Frequent Contributor
  • **
  • Posts: 565
  • Country: ch
Re: Switching a 9V line in a 3.3V circuit
« Reply #7 on: January 06, 2014, 12:46:59 am »
I can't figure out how to do it with just mosfets :/ If it's possible, please show me how. What I'm thinking is, if I have a signal at 9V, I can switch my gate between 0V and 3.3V all I want, it won't matter.

Would an optocoupler work? Or will the PICkit3 be able to pull low the !MCLR input on the PIC even if the optocoupler is off?

I'm pretty sure an SSR would work... but it's an order of magnitude more expensive, and they seem to be rather slow. I measured the PICkit3's reset pulse with at 0.7ms, that would be skewed significantly by an SSR (but it would probably still work.) In any case it feels like overkill, after all it's just a signal line, not a current carrying one, there has to be a simpler way.
 

Offline jeremy

  • Super Contributor
  • ***
  • Posts: 1079
  • Country: au
Re: Switching a 9V line in a 3.3V circuit
« Reply #8 on: January 06, 2014, 01:29:58 am »
Hi Maxlor,

I did a quick ltspice of one solution. It uses a n channel mosfet to do the switching, and then a BJT to protect the 3.3V line from the high voltages of the 9V line. The gap between V(9v_line) and V(load) will depend on the mosfet you choose.

I did it pretty hastily, so sorry for any mistakes. I'm at work! I can give you the .asc file if you like, but the forum won't let me upload it...

 

Offline Dave

  • Super Contributor
  • ***
  • Posts: 1352
  • Country: si
  • I like to measure things.
Re: Switching a 9V line in a 3.3V circuit
« Reply #9 on: January 06, 2014, 01:52:46 am »
A P-channel MOSFET would work better in the circuit above - less voltage drop between drain and source (just I*RDS(on) instead of VGS(threshold)).
<fellbuendel> it's arduino, you're not supposed to know anything about what you're doing
<fellbuendel> if you knew, you wouldn't be using it
 

Offline MaxlorTopic starter

  • Frequent Contributor
  • **
  • Posts: 565
  • Country: ch
Re: Switching a 9V line in a 3.3V circuit
« Reply #10 on: January 06, 2014, 02:30:00 am »
Thanks jeremy, I can duplicate that. I'll try that and play with it. At first glance, the results aren't exactly what I need, because the load in this instance has a weak pullup to Vdd (and shouldn't be pulled low unless the control input allows it,) but maybe the suggested circuit does that. But... it's 03:30 in the morning now, and I have to show up for work for the first time this year in a couple of hours. I'll fire up LTSpice later :)
 

Offline MaxlorTopic starter

  • Frequent Contributor
  • **
  • Posts: 565
  • Country: ch
Re: Switching a 9V line in a 3.3V circuit
« Reply #11 on: January 07, 2014, 06:16:12 am »
Nope, no dice. Even with CONTROL switched off, the programmer would still be able to pull the reset pin low (see image.) But maybe if I add another mosfet in series...

Actually, I think you've provided me with the crucial clue I needed. Combining the NPN and MOSFET like that is clever! The other part I think I know how to do.
« Last Edit: January 07, 2014, 06:44:14 am by Maxlor »
 

Offline MaxlorTopic starter

  • Frequent Contributor
  • **
  • Posts: 565
  • Country: ch
Re: Switching a 9V line in a 3.3V circuit
« Reply #12 on: January 07, 2014, 08:10:22 am »
It works now  ;D Made with EveryCircuit on the train to work:
« Last Edit: January 07, 2014, 08:14:24 am by Maxlor »
 

Offline jeremy

  • Super Contributor
  • ***
  • Posts: 1079
  • Country: au
Re: Switching a 9V line in a 3.3V circuit
« Reply #13 on: January 07, 2014, 08:20:13 am »
sorry mate, must have misunderstood what you needed. glad you got it in the end  :)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf