Shop OBEX P1 Docs P2 Docs Learn Events
Stupid transistor question! — Parallax Forums

Stupid transistor question!

firestorm.v1firestorm.v1 Posts: 94
edited 2007-05-23 03:13 in General Discussion
I'm hoping that someone can verify that I actually know what I'm talking about.

I went to Radioshack and thinking I had the right ones, bought 15 PNP transistors. When I got home and checked the What's A Microcontroller handbook, I was dismayed to find that the ones used were NPN. I have read through the datasheets of the NPN transistor used in the WAM book (a 2N3904) and the ones I bought (2N3906) and I think I understand the difference but I'm hoping that someone here that understands electrical engineer can translate to english and confirm or deny my thinkings. (FYI: Computer Geek and EE geek are very different! :P )

An NPN transistor is typically used to control ground, like this:

A Load is connected between Vcc and the collector
the Emitter is connected to GND
the load will activate only when the Base goes high, providing the load with a path for the electrons heading to GND.
A voltmeter will register Vcc when connected between Vcc and the collector while the base is high. When the base is low, the voltmeter registers no voltage.

A PNP transistor works opposite, being used to control Vcc.
The load is connected between GND and the Emitter
The Collector is connected to Vcc
The load will activate only when the base goes low (ground maybe?) providing the load with an emitter that is now positive.
A voltmeter will register Vcc when connected between the load and the emitter. When the base is high, the voltmeter registers no voltage.

Is this correct or should I really take the transistors back and swap for some NPN ones? The idea for these is to use the BS2 to control relays that typically use 20mA. The transistors I have says that it will dissipate 300mW. (Does this mean that the load for the transistor can not exceed 300mW or that the transistor uses 300mW?)

Thanks for your help translating engineer to english!!



Added:
A lot of additional datasheets taht I have looked at mention bias. I tried Googling Bias but I get things about speakers and amps, not transistors. Either that or google hates me. What is bias and what do I need to know about it to work with transistors?


Thank you all again!

Post Edited (firestorm.v1) : 5/20/2007 4:50:36 AM GMT

Comments

  • phil kennyphil kenny Posts: 233
    edited 2007-05-20 05:22
    If the relays you want to control via a Basic Stamp will operate
    on 5 volts, then either NPN or PNP transistors will work.

    However, if the relays require 12 volts, then you are better off
    using NPN transistors. This is because you can connect the Stamp
    output pin to the base of and NPN (using a series resistor to limit
    the Stamp output current). Then tie the emitter of the NPN to
    ground. Connect one end of the relay to the collector of the NPN
    and the other end to whatever supply voltage the relay needs.

    Current flow in NPN devices is from collector to emitter. That's
    why you connect the emitter to ground.

    In PNP devices the current flow is just the opposite, from emitter
    to collector.

    Your description of an NPN is okay, but the PNP description is
    backwards. It should read:

    "The load is connected between GND and the Collector.
    The Emitter is connected to Vcc."

    When operating transistors as switches, you can ignore bias issues.
    They only come into play if the transistor is used as an amplifier.

    For more info on biasing, try googling "transistor bias"

    With regard to the power dissipation part of your question, the
    300 mw rating applies only to the transistor itself and not the load.

    Hope this begins to answer your question.

    phil

    Post Edited (phil kenny) : 5/20/2007 5:27:16 AM GMT
  • tommytommy Posts: 84
    edited 2007-05-21 07:05
    I agree.· For most "upright-thinking" circuits (plus is up, ground is down) - the NPN is the one to use.· I like pictures, and have supplied a picture on the lower left.· The transistor conducts when a positive voltage is provided by the stamp, at the base.

    attachment.php?attachmentid=47249

    Then, later on - I wanted to use a comparator so that my thermostat might control a relay.· It took me a while to discover that the LM339's output's strongest force was when it was at ground potential, as its positive potential was weakened by any pull-up resistor that must be supplied there...· .· Here was a perfect use for the "upsidedown" PNP transistors that I had never used before.

    · (oops! - I used "open collector" in the drawing...· perhaps I meant "open drain" --- what actually happens is that when the LM339's output is not being pulled to ground... it floats to wherever the output circuitry takes it to...)

    >>> Firestorm:· if what you are controling uses the same five volts as the stamp you are using to control it with --- you may certainly use those PNP transistors.· They would·conduct when current flows - when the stamp provides a·zero (0 volts) at the base, and would·not conduct when the stamp provides a one (5 volts).· what the transistor does (in the case of a relay) is allows you to control a large current with a very small one.

    attachment.php?attachmentid=47250

    Post Edited (tommy) : 5/21/2007 8:17:40 AM GMT
    650 x 360 - 6K
    650 x 200 - 3K
  • firestorm.v1firestorm.v1 Posts: 94
    edited 2007-05-23 02:51
    Thank you both very much for the information and diagrams. They helped clarifty the mystery of transistors in depth. [noparse]:)[/noparse]

    After reading about the PNP transistors, I didn't want to be locked into a single Vcc so I went ahead and went to Radioshack and swapped them out with some NPN transistors. As I figure, it's easier to switch GND then it is Vcc, especially if Vcc is a different voltage than the BS2.

    So now for more questions:

    1: I am thinking of controlling a relay with the 2n3904 transistor. This is more of a question of datasheet interpretation than connecting the device. The datasheet says the transistor has the following characteristics:

    VCEO Collector-Emitter Voltage 40 V
    VCBO Collector-Base Voltage 60 V
    VEBO Emitter-Base Voltage 6.0 V
    IC Collector Current - Continuous 200 mA

    If I am reading this correctly, the load from Vcc to collector is the Ic and that is the total amount of current (amps) that can go through the transistor. I have a 20mA relay so I am well within spec (by a factor of 10.)
    The VEBO means that the voltage should be a positive voltage (Vcc) but no more than 6V (the BS2's regulator will work fine).
    The VCEO is the voltage going through the transistor to GND and it can not exceed 40V. (I'm only working with a 5VDC relay, so this isn't an issue).

    2: On page 264 of the WAM book, the schematic and next circuits show two 100K resistors between the IO pin and the transistor. What is the purpose of these resistors?

    Again, thank you very much for your time and help. This is ensuring I don't blow up my BS2 experimenting with it.. [noparse]:)[/noparse]
  • Mike GreenMike Green Posts: 23,101
    edited 2007-05-23 03:13
    Transistors are current amplifiers. The current into or out of the base (to the emitter) affects the current between emitter and collector. The relationship between the two currents is the current gain (hFE). The series resistor (100K here) limits the current into the base. With a Stamp, the I/O voltage is about +5V. The base-emitter voltage is typically 0.6V leaving roughly 4.0-4.2V to drop across the resistor giving a current of roughly 40ua. If you had a gain of 100, that would give a collector current of 4ma ... enough to light an LED.
Sign In or Register to comment.