Transistor Question

Discussion in 'General Electronics Chat' started by eschatt, Jan 30, 2009.

  1. eschatt

    Thread Starter Member

    Dec 12, 2008
    17
    0
    Hi,
    I have worked with transistors in the past, but only with one circuit. I am looking to set up this schematic but with different voltages:
    [​IMG]
    I have unsuccessfully played around with setting it up in a new configuration. The power source is 18 VDC and the voltage to the base is 5VD. How do I calculate the values for the different voltages, for now and in the future? I am using a 2N3904 transistor, do I have to worry about the 18VDC with that transistor? Thanks in advance for any help!
    -Eschatt
     
  2. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    If the power supply voltage is 18V and the base voltage varies between 0V and 5V the transistor will never turn off.
     
  3. eschatt

    Thread Starter Member

    Dec 12, 2008
    17
    0
    Could I fix that by lower the supply voltage for the transistor to 5 volts? At which point I know which resistor I need. Thanks!
     
  4. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    What is the operating voltage of the relay?

    What will control the transistor?
     
  5. Skeebopstop

    Active Member

    Jan 9, 2009
    358
    3
    Does it need to be PNP? Can't you use a similar biasing but with NPN?

    I am surprised you are able to let 10V+ across the base to emitter, i.e. when 0V applied to base, normally BJTs don't allow Vbe junctions to go much above 7V.

    What are you trying to do, just switch the coil on and off? If so NPN seems like it would make more sense to me, and then you can simply bias the base and ignore the emitter base resistor, assuming you are just trying to let some amount of current through.
     
  6. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    To reliably turn the transistor off you need to be able to approach the emitter voltage, otherwise you are going to stay in the linear region. You're approach doesn't allow any way to do that from what I can tell. Given this is meant for a digital circuit (the relay should be on or off, not between) this is a bad thing. The previous posts comment on using a NPN does make a lot more sense in that light.

    I think the question is a fair one, why not use NPN instead?
     
  7. eschatt

    Thread Starter Member

    Dec 12, 2008
    17
    0
    Hi,
    I am new with transistors and I am not sure if I should use a PNP or NPN transistor. Here is the full picture. I am using a comparator, I am trying to use the transistor to trip the relay using the output from the comparator. I cannot just hook the comparator to the relay because there isn't enough power from the comparator. I have used a PNP transistor, the one in the schematic, in the past to use the limited power from a Basic Stamp to trip a relay successfully. Is it a similar concept, or am I looking at some thing different? Are there any pages and/or websites that describe this well? Thanks for all of the help!
    -Eschatt
     
  8. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    We can give you some alternate circuits. Just to be sure we're on the same wavelength, you want to turn the relay off when the signal is +5, correct?
     
  9. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    In your first post, you show a schematic with a 2N3906 transistor, which is PNP.
    However, you say that you are using a 2N3904 transistor, which is NPN.

    You cannot substitute an NPN transistor for a PNP transistor in that circuit and expect it to work.

    2N3904/2N3906 transistors have a useful maximum collector current of about 100mA. They are actually rated for twice that, but it's not very useful above 100mA.

    You probably would be better off using a 2N2222 transistor (NPN) to sink current from the relay rather than attempting to source current as your schematic shows.

    If you require the same logic as your schematic, a couple of NPN transistors (one as an inverter) could provide it. See the attached.

    However, if your relay isn't rated for 18V, you'll need a current limiter on top of that circuit.

    Also, you'll need to let us know if the relay's coil is rated for AC or DC, as they are not the same.
     
  10. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    Dang Wookie, stole that idea right out from under me! :D Next time.
     
  11. eschatt

    Thread Starter Member

    Dec 12, 2008
    17
    0
    Hi,
    That clarifies a lot! It is always amazing how much I learn when I come on these forums!
    I understood how most of SgtWookie´s circuit works but, I just have a few, what I think, are quick questions about it:
    In order to work with that circuit at a higher voltage, 18v, and with a 18v DC relay, what changes would I have to make and why (so that I understand for future projects)?
    And for the base of Q1, should that be connected to the ground along with the output from the comparator (It was not clear me when I looked at the schematic)?
    I can´t wait till I know enough to start giving back to the community. Thanks always!
    -Eschatt
     
    Last edited: Feb 2, 2009
  12. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Glad that helped - sometimes it's hard to "get ahold" of an idea.
    You need to ensure that the voltage, current and power ratings for each component are conservative (double the ratings is a good rule of thumb). Simulations can help a great deal, but you need to understand what you are looking at.
    OK, I did not know that piece of information.
    The box labeled "V3" is a simulated signal generator, that outputs a 0v/5v square wave at a 10Hz rate. It is completely artificial. It has two outputs; I grounded the inverted output. This established a reference point for the non-inverting output.

    If you are planning to drive this circuit from a comparator, like an LM339, LM393, LM2903 or the like, the circuit will need a slight modification.

    Most true comparators have what is called an "open collector" output; they can sink some current, but they cannot source it. They require what is known as "pull-up" resistors in order to source current.

    Without a source of current, Q1 will never turn on. So, this needs to be rectified.

    However, if you are talking about a comparator that is in a microcontroller such as a PIC, you can use the circuit as-is.

    Thoughtful helpers are always welcome. :) Many of us make mistakes; we do our best to minimize them. :rolleyes: ;)
     
  13. Skeebopstop

    Active Member

    Jan 9, 2009
    358
    3
    While on the topic, does anyone know of any real reason to use a comparator? Given they are just op-amps with one less component at the output stage at a larger cost, I often times see no reason for them.

    Shouldn't a rail to rail input with rail to rail output op-amp always do the trick just as well?
     
  14. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    It could, but they don't come cheap. Op amps are designed for analog fidelity, a comparitor is digital. They are two different worlds.

    Hey! I've been known to resemble that remark!
     
  15. John P

    AAC Fanatic!

    Oct 14, 2008
    1,634
    224
    If you're using some common types of comparator, like the LM339, the output is an open collector, essentially a transistor sinking curent to ground exactly as shown in the two-transistor circuit above. So you only need one external transistor, and your original circuit should work fine. Note that the voltage that the comparator output can withstand in its "off" state can be higher than your power supply.

    But if your comparator has an active-high output, forget it. You need two transistors for a high-side drive to the relay, though only one if you switch the low side.

    Also note that depending on the number of transistors, the sense of your final output will change; if you have a comparator you can deal with this by switching the + and - inputs around.
     
    Last edited: Feb 2, 2009
  16. eschatt

    Thread Starter Member

    Dec 12, 2008
    17
    0
    Hi,
    So I am using an LM339N comparator to drive the circuit. Now in order for it to work with SgtWookie's circuit, I would need to connect a pull up resistor to the base of Q1 (because the comparator's output current isn't powerful enough on its own to trip the transistor). From what I have read, the pull up resistor is weak enough that when the comparator is "off", the negative "pulling" power is greater than the resistors positive current (so no current gets to the transistor). But when the comparator is "on", with the negative "pulling power" gone, the current from the resistor is able to trip the transistor. I know it probably isn't worded correctly, but is the general idea/reasoning correct? Thanks.

    I just remembered that I have been using a zener diode, when I first started playing around with using a transistor, I did this because there is a minimal voltage even when the comparator is "off" (0.083VDC). How does that effect the circuit?
    -Eschatt
     
    Last edited: Feb 2, 2009
  17. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Remove R1, and connect the output of the comparator to the base of Q1.
    As you say, you will need a pullup resistor. See below.

    The LM339 has open-collector outputs. It is not capable of sourcing current, only sinking it. That's what the pull-up resistor does.

    You're sort of in the ballpark. :)
    As I mentioned above, the comparator output is an open-collector, and thus it cannot source current (output current), only sink it (connect it to ground).

    If you look at a datasheet for the LM339, you'll see that when sinking a current of 4mA, the output voltage will be around 400mV maximum under normal temperature ranges. The transistor Q1 will start conducting when the base voltage reaches around 600mV.
    So, you want a maximum sink current of around 3.5mA.
    Since your Vcc=12v, and R=E/I, 12v/3.5mA = 3429 Ohms (rounded off) for the pull-up resistor.
    Looking at a table of standard resistor values: http://www.logwell.com/tech/components/resistor_values.html
    we'll see that the closest E24 value is 3.6k (3600 Ohms)
    This will result in a maximum of I=E/R = 12/3600 = 3.33...mA current.

    OK, I don't know how you had the Zener diode connected.
    When the comparator output is sinking current from the pull-up resistor, the voltage will not be zero; it will be somewhat higher than zero - typically somewhere around 90mV to 150mV, depending on the value of the pull-up resistor.
     
  18. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Yes.
    If you run an operational amplifier with no feedback, the output stage will be in constant saturation. This wastes power, generates heat, and causes the opamp to be slow to respond. It can also cause premature failure of the opamp.

    If you're running a circuit closed-loop, use an opamp. If running open-loop or with hysteresis, use a comparator. Comparators are designed to be operated in open-loop mode, opamps are not.
    No.
     
  19. Audioguru

    New Member

    Dec 20, 2007
    9,411
    896
    An opamp is used with negative feedback so it is slowed down so it does not oscillate.
    A comparator is almost never used with negative feedback so it is fast.
     
  20. eschatt

    Thread Starter Member

    Dec 12, 2008
    17
    0
    Hi,
    I am not sure if anyone is still watching this thread... though after a little playing around I have another question. I haven´t gotten the relay yet but, when I set it up, the voltage to the relay only changes about .5-1v when the comparator is on vs off. How will it control the relay when the voltage doesn´t change significantly? Or did I just setup the circuit incorrectly? Does the currant/amperage change? Thanks.
    -eschatt
     
    Last edited: Feb 14, 2009
Loading...