Connect with us

Transistor as switch (newbie question)

Discussion in 'General Electronics Discussion' started by KX36, Sep 14, 2011.

Scroll to continue with content
  1. KX36

    KX36

    14
    0
    Aug 26, 2011
    Hi guys, This is a total newbie question, hope someone can help me out

    I want to use a transistor (MOSFET) as a switch in a circuit that runs between a positive voltage (changes with load) and -12V, but the transistor should be powered by a microcontroller which outputs between 0V and +5V.

    What's the simplest way to do this?

    I'm getting stuck because the common voltage at the input and output are not the same (don't know if that's the right terminology, but what I mean is the voltage common to the input and output of each transistor i.e. 0V on the microcontroller isn't the same as the -12V on the output.)

    I am thinking that if an N-channel MOSFET has source tied to -12V, then it should be in cut off at gate=-12V and fully saturated at gate=0V, and I'm sure there must be a way to use another transistor to get from this input to this output, but all the basic info I can find assumes 0V is the common voltage throughout.

    Hope that's vaguely understandable.

    PS. I'd rather avoid having to use a relay if I can because of the slow switching time, although if it's impossible to do with transistors, I could use a solid state relay, best not to if I don't have to though.

    Cheers guys,
    Matt
     
  2. Laplace

    Laplace

    1,252
    184
    Apr 4, 2010
    An opto-isolator seems made to order for this type of level shifting.
     
  3. KX36

    KX36

    14
    0
    Aug 26, 2011
    Cheers, I've used FET-output SSRs before, which are basically the same as optoisolators but more expensive and with a lower on resistance and higher off resistance.

    I thought of something last night, If I tie the gate to source (which is at -12V) with a relatively big resistor and then the gate to the microcontroller pin, I can use the tri-state of the pin to my advantage. If the pin is set to output low, the gate will be pulled to 0V, and the transistor should be well into saturation as Vgs=12V, if the pin is set to an input it has very high impedance and so should effectively be out of the circuit, so the gate will be pulled down to Vs through the resistor and Vgs=0V should put it into cut-off.

    Does this sound about right?
     
  4. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,448
    2,809
    Jan 21, 2010
    The problem with that is that the output can be pulled below 0V

    This may not be a huge issue if the resistor value is very large though.

    It might be best if you can draw up a circuit diagram to illustrate for us. I wasn't quite sure where the common rail was, and I tended to agree with Laplace based on this and other factors.
     
  5. KX36

    KX36

    14
    0
    Aug 26, 2011
    Yeah, I am a bit concerned with putting -12V on the microcontroller pin, if it would be damaged or even if its internal circuitry would allow it. Don't know if this could be overcome with some series gate resistor, and diode combination. Will have to look at the datasheet.

    Most likely will end up using an SSR. It just seemed like a problem that probably had a very simple solution and SSR seemed a bit overengineered for the job.

    I use the word common as in common emitter amplifier. in that case, the input is between between base and ground, the output is between collector and ground, and the grounded emitter is common to both input and output.

    Will try to draw up a schematic tonight.
     
  6. duke37

    duke37

    5,364
    769
    Jan 9, 2011
    Would something like this do?
    Micro high would be off and micro low would be on. If this is not convenient, another transistor could be added.
     

    Attached Files:

  7. KX36

    KX36

    14
    0
    Aug 26, 2011
    Cheers, duke37, that's probably exactly what I'm after. Thanks for taking the time to draw it out.

    I tried a couple of very similar things in SPICE before, but I couldn't get them to work, in various simulations, I either had the collector and emitter of the PNP at the wrong polarity relative to each other, or I needed a negative voltage on the base of the PNP.

    Is that ground connected to anything? I assume you can just tie the base to the microcontroller pin without any additional components? And that when the PNP is "off", the gate of the FET goes to around the same voltage as the source and it goes into cut-off, but when the PNP is "on", it will be close to the 5V (depending on resistor values). I will SPICE it anyway just to check it does what it needs to.

    I think the closest I got to that was the same, but with 0V where you have 5V, leaving me with the situation of needing a -ve voltage on the base to turn it on. It should have been obvious to me, now I feel kinda dumb(er). I blame the standard of our modern British education system (I did GCSE systems and control; i.e. electronics and pneumatics, and basically came out of it with a B grade, knowing only 555 timers and opamp comparitors)

    Thanks again,
    Matt

    PS. For the record and anyone else reading this in the future, the microcontroller won't tolerate voltages on its pins outside the range of its Vdd to Vss, but if the transistor had been operating in that range, I think the idea I wrote about above using the tri-state of the microcontroller pin should have worked pretty well with only a single transistor.
     
    Last edited: Sep 14, 2011
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-