Shop OBEX P1 Docs P2 Docs Learn Events
With a lower voltage out uC like the prop, are PNP's a better option? — Parallax Forums

With a lower voltage out uC like the prop, are PNP's a better option?

turbosupraturbosupra Posts: 1,088
edited 2010-10-02 14:02 in Propeller 1
Is there a consensus on this?

In using the prop pins to turn things on and off through a transistor, is a PNP a better option? I'm setting up my PCB and trying to determine which type I'd like to use and then which type of pull up/down transistor to use for the base.


Example, a FET that needs 4.5v at the gate to turn on fully, the best my npn BJT could provide was ~2.6 before the emitter voltage was too high and it would turn off.

Is there an inverse scenario to the above that I am not thinking of, but maybe is worth considering?
«13

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-09-21 12:32
    The problem with driving PNPs directly from a Prop (through a current-limiting resistor, of course) is that their positive supply can be no higher than 3.9V, i.e. Vdd + VBE (PNP). Otherwise, they'd be on all the time. With NPNs and nMOSFETs that limitation does not exist. They're limited only by their VCEmax (NPN) or VDSmax (nMOSFET).

    BTW, the IRF3708 (nMOSFET) is fully characterized for VGS values as low as 2.8V and can be driven directly from a Prop pin.

    -Phil
  • TappermanTapperman Posts: 319
    edited 2010-09-21 12:44
    turbosupra wrote: »
    Is there a consensus on this?

    In using the prop pins to turn things on and off through a transistor, is a PNP a better option? I'm setting up my PCB and trying to determine which type I'd like to use and then which type of pull up/down transistor to use for the base.


    Example, a FET that needs 4.5v at the gate to turn on fully, the best my npn BJT could provide was ~2.6 before the emitter voltage was too high and it would turn off.

    Is there an inverse scenario to the above that I am not thinking of, but maybe is worth considering?

    I'm no authority, but I like to use opto-couplers. Such as:

    http://www.datasheetcatalog.org/datasheet/vishay/83645.pdf

    Very handy in proto-typing (use as ouput buffer / or input buffer w/Pull up resistor). Mouser carry's them for around 0.86 each. Very handy chip! Much safer for CPU, and very handy for driving NPN or PNP BJT's.

    It's supposed to be fairly linear, but I just use it for on/off app's. There are speed limitations though, but I seldom exceed 10KHz in my app's ... so not an issue for me.

    ... Tim
  • MicrocontrolledMicrocontrolled Posts: 2,461
    edited 2010-09-21 12:58
    I use the PNP to control relays instead of NPNs. It works great with less current draw, although the pros on the forum say there are certain dangers to working with them.
  • turbosupraturbosupra Posts: 1,088
    edited 2010-09-21 13:34
    So then combining them would be a better option?


    transistorswithprop1.png



    The problem with driving PNPs directly from a Prop (through a current-limiting resistor, of course) is that their positive supply can be no higher than 3.9V, i.e. Vdd + VBE (PNP). Otherwise, they'd be on all the time. With NPNs and nMOSFETs that limitation does not exist. They're limited only by their VCEmax (NPN) or VDSmax (nMOSFET).

    BTW, the IRF3708 (nMOSFET) is fully characterized for VGS values as low as 2.8V and can be driven directly from a Prop pin.

    -Phil
  • turbosupraturbosupra Posts: 1,088
    edited 2010-09-21 13:34
    Care to mention these dangers?

    I use the PNP to control relays instead of NPNs. It works great with less current draw, although the pros on the forum say there are certain dangers to working with them.
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2010-09-21 13:51
    Here is the circuits I use, depending on the need.

    On all of them:
    "IN" is just power voltage, any voltage as long as gates allow for it (usually 20V)
    "1/0" turns off and on the power output (non-inverting)
    "OUT" is the output power

    The first one is for low power (about 2A), low frequency (up to 1KHz) applications.

    The second one is for higher power (about 5A), medium frequency (up to 10KHz).

    The last one is for high power (about 13A), high frequency (up to 75KHz).
    416 x 188 - 15K
    546 x 227 - 19K
    773 x 402 - 37K
  • turbosupraturbosupra Posts: 1,088
    edited 2010-09-21 14:29
    Thanks Bobb!

    I love schematics over words :) !

    Bobb Fwed wrote: »
    Here is the circuits I use, depending on the need.

    On all of them:
    "IN" is just power voltage, any voltage as long as gates allow for it (usually 20V)
    "1/0" turns off and on the power output (non-inverting)
    "OUT" is the output power

    The first one is for low power (about 2A), low frequency (up to 1KHz) applications.

    The second one is for higher power (about 5A), medium frequency (up to 10KHz).

    The last one is for high power (about 13A), high frequency (up to 75KHz).
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2010-09-21 14:36
    With changes to resistors and the right transistors, all of those frequencies can go up maybe 3 or 4 times (the last one could probably go up 10 times).

    I tested them with the transistors I was already using, and chose the resistor values to be a compromise between wasted power and frequency.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-09-21 14:56
    turbosupra wrote:
    So then combining them would be a better option?
    Yes, you can do it that way. Both transistors require current-limiting series resistors in their base circuits. The PNP should also have a pull-up on its base.

    BTW, you can save yourself a whole bunch of effort and produce better-looking schematics by using LogicWorks 5, the succesor to DesignWorks Lite.

    -Phil
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2010-09-21 15:51
    Yes, you can do it that way. Both transistors require current-limiting series resistors in their base circuits. The PNP should also have a pull-up on its base.

    BTW, you can save yourself a whole bunch of effort and produce better-looking schematics by using LogicWorks 5, the succesor to DesignWorks Lite.

    -Phil
    Couldn't you do it with just two resistors? Current limit resistor from micro controller causes NPN to limit current from PNP's base.

    For example, this circuit would output about 510mA (regardless of input voltage) assuming 100 gain transistors, 3.3V from µController, and about 900mV drop from base to emitter (on NPN).
    attachment.php?attachmentid=73359&stc=1&d=1285108716

    And really, R2 is a good idea, but ultimately not essential if you don't care about a wee bit of leakage.

    I still suggest my MOSFET solutions above. They will be lower frequency, but produce way less wasted power and thus allow for much higher power control, more easily.
    485 x 340 - 15K
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-09-21 16:02
    Bobb,

    You need a current-limiting resistor in the base circuit of Q2. You can put it between Q1C and the junction between Q2B and R2.

    -Phil
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2010-09-21 16:10
    That's what I am asking, why can't use use that schematic?

    The current limiting resistor from micro controller causes NPN to limit current from the PNP's base.

    Explain why that doesn't work?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-09-21 16:16
    Bobb Fwed wrote:
    The current limiting resistor from micro controller causes NPN to limit current from the PNP's base.
    No, it doesn't. It only limits the NPN's base current. When the Prop pin goes high, the NPN is fully "on" sinking as much current as it can, within the limits of its gain. As a consequence, the current through the B-E junction of the PNP will be way too high, possibly destroying that transistor. It would be as if you had two diodes in series between your 12V rail and ground -- IOW a dead short.

    -Phil
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2010-09-21 16:25
    As you said: "within the limits of its gain"

    So here is the math:
    on NPN: Vbe is 900mV, so the 47K resistor has a 2.4V drop (3.3V - 0.9V), allowing 51µA of current into NPN base. 100 gain means 5.1mA current is sinked to Q1-C from R2 and Q2-B. So with 100 gain, the PNP allows [about] 510mA through.

    That's why I had all those caveats above, it would work, right? If they were MOSFETs we were dealing with, no, but these are BJTs, so they have a fairly linear current control we can utilize to make things simpler.

    BJT transistors are never "fully on" they are always a product of their gain.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-09-21 17:30
    Bobb,

    You'd be right, except for one thing: it's usually not a good idea to design a circuit with a specific transistor gain in mind since, in reality, the actual gains can vary all over the place. If you wanted to sink a known current, it would be better to put a resistor in the NPN's emitter circuit, and drive the base through a much smaller resistor. The collector current would be approximately equal to the emitter current, or (VB - 0.6) / RE and would be much less sensitive to the transistor's gain.

    But that's mostly beside the point, when all you want to do is turn on the PNP to full saturation. It's simpler, IMO, just to limit the PNP's base current to some ponderable number below iBmax with a base resistor and drive the NPN to full saturation, pulling that base resistor to near 0V. With both transistors in saturation, they will also dissipate less power.

    -Phil
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2010-09-21 18:29
    I'm not trying to get in a heated debate, I'm just trying to understand (so I can learn).

    How wildly can the gain vary? The gain error is only [approximately] added together (in my method). So even if both gains were off by 10% in the same direction, power would only increase by 21%. It's common for cheap resistors have a 5% tolerance, so you could have a 15% difference with the method you propose, and a 27% difference with my method.

    It seems the same current limiting on the PNP can be done with either method within some margin of error. Sure, the gain may off by a bit, so you just err on the side of caution, the same as you would with the PNP base resistor. It seems like a safe bet either way in my mind, and my system would use at least one less resistor (I still think R2 is optional as well -- but it would be optional in both cases). It's not like we are using the BJTs as regulators, just turning on some power. I liken it to some type of inverted darlington pair.

    I am usually in the school of economy of parts as long as reliability is not lost.

    ...Anyway, I go back to saying, USE MOSFETs! The only reason I use BJTs is to increase speed of a circuit, and to more easily interface with TTL devices.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-09-21 18:37
    Bobb Fwed wrote:
    How wildly can the gain vary?
    Using a 2N3904, as an example, the gain can vary between 30 and 300, depending on the collector current, temperature, and manufacturing variations. To me, the "extra" resistor is worth the investment of another penny if it makes a circuit's performance more predictable. Having said that, though, I almost always use "logic transistors", which include the necessary biasing resistors, in SMT designs -- especially when space is at a premium.

    -Phil
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2010-09-21 18:48
    Using a 2N3904, as an example, the gain can vary between 30 and 300, depending on the collector current, temperature, and manufacturing variations.

    Gotcha. I now understand why my design is bad, and am more better learnt.
  • turbosupraturbosupra Posts: 1,088
    edited 2010-09-21 21:37
    So is this what the consensus is? I believe this would give me 3.6mA ? or would it give me 1mA? I'm a little confused after reading all of the posts, but trying to learn/understand.


    transistornpnwithpnp1.png



    Phil, I will download that software tomorrow, it has to be better than paint :)



    Bobb,

    You need a current-limiting resistor in the base circuit of Q2. You can put it between Q1C and the junction between Q2B and R2.

    -Phil
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2010-09-21 21:46
    Change the 47K resistor to 10K or 5K or 1K. Then you will get a limit of 335mA (at 100 gain and 14V). Less than 3.9K resistance may be good, depending on what exactly your purposes are.
  • turbosupraturbosupra Posts: 1,088
    edited 2010-09-21 21:47
    Thanks for this transistor link Phil.

    How does it compare to this one? I take it is is superior with the propeller to the one I have linked below?

    http://www.infineon.com/dgdl/IPP_B_I70N10SL-16.pdf?folderId=db3a304412b407950112b42a6a0a4339&fileId=db3a304412b407950112b42a72ce4342


    The problem with driving PNPs directly from a Prop (through a current-limiting resistor, of course) is that their positive supply can be no higher than 3.9V, i.e. Vdd + VBE (PNP). Otherwise, they'd be on all the time. With NPNs and nMOSFETs that limitation does not exist. They're limited only by their VCEmax (NPN) or VDSmax (nMOSFET).

    BTW, the IRF3708 (nMOSFET) is fully characterized for VGS values as low as 2.8V and can be driven directly from a Prop pin.

    -Phil
  • turbosupraturbosupra Posts: 1,088
    edited 2010-09-21 21:52
    Hi Bobb,

    Almost all of my applications right now are automotive and involve me using the transistor as a switch like a relay almost. I have not progressed to cycling them many times a second yet.

    Thanks, I will try and set up a bread board like this tomorrow.


    Bobb Fwed wrote: »
    Change the 47K resistor to 10K or 5K or 1K. Then you will get a limit of 300mA (at 100 gain). Less than 3.9K resistance may be good, depending on what exactly your purposes are.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-09-21 23:01
    turbosupra wrote:
    How does it compare to this one? I take it is is superior with the propeller to the one I have linked below?
    They look to be pretty comparable. The IRF3708 has a slightly lower "on" resistance at those points where both gate voltages are characterized. Unfortunately, it's hard to tell from the specs for the Infineon unit what its RDS value is at VGS < 4.5V. At least it's not spelled out explicitly, as it is for the IRF unit.

    -Phil
  • AribaAriba Posts: 2,690
    edited 2010-09-22 02:27
    There is a solution with only 2 resistors:
    attachment.php?attachmentid=73373&stc=1&d=1285147557
    The NPN acts as switchable current source in this case. If the Prop pin is high, the current is:
    (3.3V - 0.6V) / R1, if it is low the current is 0. The current must be high enough to switch the PNP on. The exact gain of the NPN does not matter, its mainly R1 which defines the current.

    Andy
    485 x 390 - 2K
  • turbosupraturbosupra Posts: 1,088
    edited 2010-09-22 05:15
    Ok, well I will use IRF3708's then, as I'd rather be sure then guessing.

    Thank you


    They look to be pretty comparable. The IRF3708 has a slightly lower "on" resistance at those points where both gate voltages are characterized. Unfortunately, it's hard to tell from the specs for the Infineon unit what its RDS value is at VGS < 4.5V. At least it's not spelled out explicitly, as it is for the IRF unit.

    -Phil
  • Andrey DemenevAndrey Demenev Posts: 377
    edited 2010-09-22 05:34
    Could anyone please explain what problem you are trying to solve here?
  • bozobozo Posts: 70
    edited 2010-09-22 06:38
    isn't there a solution with just one PNP and one resistor:

    tie the base high via say a 10k resistor, so when the i/o pin is configured as an input, the transistor will be turned off

    connect the base to the controlling pin on the propeller

    use dira to convert the controlling pin to an output (and use outa[pin] := 0) to pull the base low, and the transistor can supply whatever current it is rated for (Ic) to your load

    i.e. the PNP is controlled by using dira rather than outa

    no?
  • ErNaErNa Posts: 1,791
    edited 2010-09-22 06:45
    Hi bozo, that can not work, as even the tristate output is connected to 3.3 via a diode so you should never try to apply more that 3.3 plus some margin to an high impedance output.
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2010-09-22 08:24
    ErNa wrote: »
    Hi bozo, that can not work, as even the tristate output is connected to 3.3 via a diode so you should never try to apply more that 3.3 plus some margin to an high impedance output.
    That was addressed in the second post.

    @Ariba: I will have to keep that one in mind. Thanks.
  • turbosupraturbosupra Posts: 1,088
    edited 2010-09-22 08:28
    Ariba,

    Would Q1 ever conduct in this?

    The emitter resistor would create ~6v at the emitter of the NPN and it wouldn't ever turn on with the base only seeing 3.3v.

    Did you mean to put an emitter resistor on Q2?



    Ariba wrote: »
    There is a solution with only 2 resistors:
    attachment.php?attachmentid=73373&stc=1&d=1285147557
    The NPN acts as switchable current source in this case. If the Prop pin is high, the current is:
    (3.3V - 0.6V) / R1, if it is low the current is 0. The current must be high enough to switch the PNP on. The exact gain of the NPN does not matter, its mainly R1 which defines the current.

    Andy
Sign In or Register to comment.