Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: Using a transistor as a switch

  1. #1
    Junior Member
    Join Date
    Sep 2014
    Posts
    8

    Using a transistor as a switch

    Im looking to use a transistor as a switch controlled by a digital pin of a teensy 4.1 board. I think I need to use a bjt npn transistor because it is faster than a mosfet and the signal is low current. The collector is +5v source and the emitter is connected to ground. Do I need to a resistor Ib from the GPIO to the base if there is no load on Ic from the collector?

  2. #2
    Senior Member
    Join Date
    Mar 2016
    Posts
    334
    Some details to be worked through. Assuming you have a high side load, this is a decent tutorial. You definitely want Rb to limit your current through the teensy pin. I'd use 5 mA as the goal. The diode is not needed for a resistive load.

  3. #3
    Senior Member
    Join Date
    Jul 2020
    Posts
    976
    BJTs are typically slower than MOSFETs if the MOSFET is driven with enough current - however a
    large MOSFET can have a lot of capacitance and need quite high currents to switch fast - so it
    very much depends on the ratings of the MOSFET and the current available to drive it.
    A small MOSFET for low current will typically be faster than a switching BJT in fact.

    With a BJT don't expect to be able to switch more than 20 times the base current. So if your
    teensy pin is rated at only 4mA, you'll not be able to switch more than 80mA with a single BJT.
    You didn't actually say what "the signal is low current" actually means - "low current" means
    _very_ different things in different contexts - use numbers and units, not adjectives. After all
    every motor ever sold is "high torque" in the sales literature!

    Yes a base-resistor is mandatory and needs to limit the current to protect both the Teensy and
    the BJT itself - a Teensy 4.1 is much more delicate than most single BJTs in fact, and will
    determine the minimum value of base resistor its safe to use.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •