Shop OBEX P1 Docs P2 Docs Learn Events
transistors and basic stamp — Parallax Forums

transistors and basic stamp

ObiwanObiwan Posts: 36
edited 2005-06-12 02:36 in Robotics
I want to connect the base of a PNP transistor to a pin of the BSII.· The positive pin of the transistor then goes to a positive port of a 9v battery and the negative pin to the negative 9v.· If I bring the i/o pin high, 5v, will current still flow from the 9v battery activating the transistor?

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-06-08 05:13
    Hello,

    ·· Your question is a little confusing.· A PNP transistor requires a LOW on the base to switch it on.· You should always use a resistor between the Stamp I/O pin and the base.· And finally, if you connected the other two ends of the transistor to the battery poles as you suggested, you would short circuit the battery/transistor and let out the magic smoke from the transistor.· The other pins on the transistor would be the Emitter and Collector.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-06-08 05:14
    First off, stop, do not build the circuit you described, You will fry the transistor, your stamp, or both. You absolutely need to add resistors to limit your current, both between the base and the stamp, and the ground and the transistor. It is too late for me to explain further, I will when I wake if someone hasn't already.
  • edited 2005-06-08 15:30
    Check out What's a Microcontroller, Chapter 9, Activity #1. For that particular transistor, the current into the transistor's base is what controls the current that passes through the LED, into the collector, out of the emitter, and into ground. It is possible to replace the LED with other circuits/devices. It is also possible to connect the circuit/device to Vin instead of Vdd - if that's the voltage the circuit needs.

    The most common use of controlling a transistor with a BASIC Stamp I/O pin is to make the transistor drive current loads that the BASIC Stamp cannot. Small motors, relays, and heating elements are common examples of circuits that you can drive with the BASIC Stamp through a transistor, but not directly with the BASIC Stamp. You can find other examples of BASIC Stamp - transistor - device control in these Stamps in Class texts:

    Industrial Control - Experiments #3 and #4
    Applied Sensors - Chapter 6

    All the texts in this post are available for download from www.parallax.com -> Downloads -> Stamps in Class Tutorials.

    Post Edited (Andy Lindsay (Parallax)) : 6/8/2005 3:40:06 PM GMT
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-06-08 15:49
    One small addendum to Andy's post, since you are trying to use a pnp transistor, using Vin on the emitter will produce unexpected results.

    A pnp conducts current when the base's voltage < (emitter's voltage - Vbeon), Vbeon is ussually between 0.6V and 1.0V depending on the exact trnsistor you are using. When the base voltage is high the transistor should be off, when it is low the transistor will conduct. If your Vin is 7.4V and you are operating the stamp @ 5V, the base will be at 5V and the emitter is at 7.4V, this 2.4V difference is enough to turn on the transistor, even though this is not what we want to happen.

    To nutshell, you cannot use a pnp transistor with the emitter voltage higher than the maximum voltage at the base. You can use an npn transistor with a higher Vin than 5V since the transistor turns off and on depending upon the voltage at the base in reference to ground. IOW a pnp conducts when Vbase < (Vemitter - Vbeon), and an npn conducts when Vbase > (Vemitter - Vbeon). With a bipolar transistor the emitter is on the supply side (Vdd for pnp, Gnd for npn) and the collector is on the load side.

    hmm, seems Andy discovered this point and edited his post. Ive left this post up since it has some useful information on bipolar transistor operation.
  • edited 2005-06-08 16:36
    Thanks Paul; I missed the PNP.

    At this point, the Stamps in Class examples use either NPN transistors or N-channel MOSFETS.
  • ObiwanObiwan Posts: 36
    edited 2005-06-12 02:36
    thanks for the help.· You cleared things up for me.
Sign In or Register to comment.