Shop OBEX P1 Docs P2 Docs Learn Events
Source or Sink current — Parallax Forums

Source or Sink current

Vincenzo1309Vincenzo1309 Posts: 76
edited 2009-06-08 13:59 in Learn with BlocklyProp
Dear all, I am currently working on a project. I am connecting a transistor BD679 to a I/O pin of Basic Stamp 2. This NPN transistor is used to drive a solenoid actuator. I know that the source/sink current of BS2 = 20/25mA

But I am confused, so actually how much max. current actually flow out of the pin? is it 20 or 25mA?
Do I use source or sink current?
Kindly advise

Thanks and Regards,

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-06-06 05:18
    The Microchip PIC that Parallax uses for the BS2 can source 20mA or sink 25mA from any single I/O pin. There's also a limit of 50mA for each group of 8 I/O pins and a total current limit of 150mA for the entire chip. You should always leave some safety margin, so plan on 10mA to 15mA for the base current of your transistor. Since it's an NPN transistor, the BS2 will be sourcing current for the base (from +5V). Sinking current refers to 0V.
  • Vincenzo1309Vincenzo1309 Posts: 76
    edited 2009-06-06 05:34
    So, it means that in my case, I should be concerned about SOURCE current. Since 20mA will flow out of the pin, therefore I need to limit this 20mA to the range (10-15mA).
    I can use a resistor to do that.
    But how do I calculate the value of the resistor?

    Kindly advise..

    Thanks and Regards,
  • Mike GreenMike Green Posts: 23,101
    edited 2009-06-06 11:58
    Ohm's Law: Voltage = Current x Resistance

    A Stamp I/O pin provides roughly 5V when HIGH (actually about 4.7V, but this depends somewhat on the current drain). A transistor's base-emitter junction requires roughly 0.6V, that's 4.7V - 0.6V = 4.1V left for the resistor to drop. Pick 15mA for the current, so you have: 4.1V = 15mA x Resistance or R = 4.1V / 0.015A = 273 Ohms. The closest standard value is 270 Ohms.
  • Vincenzo1309Vincenzo1309 Posts: 76
    edited 2009-06-06 14:34
    Dear Mike,

    Will it be logically wrong if I did it this way, my supply voltage for the actuator is 9V, measured resistance of the actuator is 8 Ohms.
    Direct Current Gain of BD679 = 750 (from datasheet)

    Rb = (IC supply voltage * Direct Current Gain) / (5 * load current)

    load current = 9V / 8 Ohms = 1.125A

    Rb = (5V * 750) / ( 5 * 1.125) = 667 Ohms, in this case, I use the 1K resistor. It works though.

    So am I right for the above calculations? Can it be done this way?

    Kindly advise.

    Thanks and Regards.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-06-06 23:52
    I'm not sure where you got the 5 in the denominator. I get:

    Minimum base current = 1.125A / 750 = 1.5 mA.

    The gain of the transistor may be lower than 750. You would use the minimum hFE (DC gain) from the datasheet. I would probably just use 10mA. This would guarantee that the transistor is saturated (fully conducting) and the extra few milliAmps won't normally make a difference. If you were using several I/O pins at the same time and the total BS2 I/O pin current was an issue, I might decrease this to 2-3mA. In your case, I'd still use something like 470 Ohms which would give a base current of around 8mA.
  • Vincenzo1309Vincenzo1309 Posts: 76
    edited 2009-06-07 03:24
    Hi Mike, I got the formula from this website, http://www.kpsec.freeuk.com/trancirc.htm#darlington

    So in my case, if I use the 1K resistor, my base current is only 4.1A / 1000 ohms = 1.4 mA
    therefore when this 1.4mA is amplified, the resulting Ic is enough to drive the actuator.
    Ic = Current Gain * Ib
    = 750 * 0.0014
    = 1.05A

    So do you think my method might be wrong, even though it works?
  • Mike GreenMike Green Posts: 23,101
    edited 2009-06-07 15:09
    The 1.4mA base current is just enough when amplified to provide current to the actuator. There's no room for error. If the gain of the transistor is too low or if the actuator current is a little bit higher as will happen with temperature changes, it won't work as well. In addition, the transistor is not saturated, so there's more power dissipated in the switching transistor itself.

    For power switching, you really want to drive the transistor into saturation to minimize the collector to emitter resistance and the power dissipation of the transistor.

    By the way, don't forget the protective diode across the actuator coil!
  • Vincenzo1309Vincenzo1309 Posts: 76
    edited 2009-06-08 13:59
    Hi Mike,

    Thanks alot! Sure remember about the diode!
Sign In or Register to comment.