1
\$\begingroup\$

In the followig circuit I am trying to replace a push button with a transistor:

schematic

simulate this circuit – Schematic created using CircuitLab

In the schematic SW1 is the push button that opens and closes the tray of a CDROM drive, V1 is the 5V power supply of the CDROM is the control board for the drive.

I want to control the tray operation with an arduino connected to the base of an NPN transistor with collector connected to V1 and emitter to P1. The transistor I'm going to use is a TIP120 (I know it's overkill for this operation but it's what I have lying around).

The problem I'm having is that I don't know how to calculate the value of the current limiting resistor that is needed between the arduino pin and the transistor base to prevent the transistor drawing too much current from the pin, damaging the pin.

According to all the documentation I read (one example http://www.zen22142.zen.co.uk/Design/bjtsw.htm) one needs to know the current that will flow across the transistor when it is on.

But in my case, I only know the voltage across the two terminals of the switch. I have no idea what's between P1 and P2 (i.e. inside the CDROM control board), and no idea of how much current is drawn when the switch is closed.

How do I calculate a safe resistor value for the base resistor in cases like this ?

\$\endgroup\$
  • \$\begingroup\$ I'm confused and it's probably cider realistically to blame but if you can show a circuit of what you mean it might help, warts n all. BTW it's nearly certain that an arduino cannot supply enough current to hurt a TIP120's base-emitter region. \$\endgroup\$ – Andy aka Aug 22 '13 at 22:29
  • \$\begingroup\$ @Andyaka Damage it, the pin, ie. the arduino. \$\endgroup\$ – Passerby Aug 22 '13 at 22:41
  • \$\begingroup\$ Using an NPN transistor as a high-side switch (between the power supply and the load) is a bad idea when the supply voltage is only 5V. If the transistor really drives the motor directly you should use a PNP or PMOS transistor. If P1 is a logic-level input to a microcontroller then the Arduino should be able to drive it directly. Try putting a 1k resistor in series with the switch...if it still works you don't need a transistor. \$\endgroup\$ – Joe Hass Aug 23 '13 at 1:03
2
\$\begingroup\$

One, that switch does not directly control the motor. It's most likely a few mA at best, as it signals a microcontroller inside the cdrom to open/close the tray.

Two, what you are looking for is simple ohms law. Resistor = (Source Voltage - The Transistor Base/Emitter Drop) / Current Required in Amps. Since the hFE or current multiplication ability of the TIP120 is 1000, so roughly it will allow 1000 times the base current at the collector, any amount of current should be good at the base. Let's just use 5mA. The Base/Emitter drop is 1.25V minimum, as there are two transistor diodes.

Resistor = (5v - 1.25V) / 0.005A or 3.75V / 0.005A = 750Ω or close.

Update To further answer the question, you calculate the base resistor within the safe range of your source (Arduino, 40mA per pin, 200mA total at any given time). The unknown collector current in this case would be minimal for a button. For actual loads like a motor, you could simply max out the transistor by saturating it, giving the base transistor as much current as possible. In this case, you would have to have multiple arduino pins in parallel since the TIP120 base limit is 120mA and the Arduino is 40mA per pin. This is not ideal because you don't know the current at C-E or the amount of voltage it will drop.

The best answer is that you DONT. A proper design will find out how much current will be at the collector. Use a ammeter or multimeter in current mode to find out.

\$\endgroup\$
  • \$\begingroup\$ My multimeter doesn't have a current mode, so I'm unable to measure. However I am accepting your answer because I now understand two facts: (1) it doesn't really matter in my application what amount of current will flow through the transistor (as it is likely very little, enough to provide a logic high level to the control board). (2) using just 5mA will still switch the transistor and be safe for the Arduino. \$\endgroup\$ – Ugo Riboni Aug 23 '13 at 7:37
1
\$\begingroup\$

Take a look at this: -

enter image description here

The arduino cannot supply this current from any of its IO pins. Maybe 40mA is maximum.

Please also note that using P channel MOSFET is probably a better idea because the TIP120 will have a volt drop of about 1.5volts across it as how I envisage you described using it.

If you had the TIP120 in the P2 leg of the drive then it would drop about 0.7V but then again I'd use an N channel MOSFET and keep this down to a few millivolts.

\$\endgroup\$
  • \$\begingroup\$ What the arduino can supply and what it should supply are TWO DIFFERENT THINGS. You can draw more than 40mA from an arduino pin/port/ic. You will break it if you do. Direct shorts do this all the time. \$\endgroup\$ – Passerby Aug 22 '13 at 22:42
  • \$\begingroup\$ @Passerby I read "the OP was worried about damaging the TIP 120". I've re-read and OK it's ambiguous in retrospect but it still certainly could mean "damage the transistor". Hope you haven't downvoted on this basis. If you have I shall speak to my lawyer and have my answer removed dear chap. \$\endgroup\$ – Andy aka Aug 22 '13 at 22:47
  • \$\begingroup\$ No, also because the TIP120 VBE drop is 1.25V (minimum) or higher depending the collector current, it's a darlington pair, two diode drops. \$\endgroup\$ – Passerby Aug 22 '13 at 22:51
  • \$\begingroup\$ @Passerby - that's why I said it "will have a volt drop of about 1.5volts across it as how I envisage you described using it" i.e. in an emitter follower config, volt-drop being the direct loss in volts to the load..... or 0.7V (collector to emitter) if it were interrupting the P2 connection. In other words I am trying to be helpful by subtly discrediting the use of the TIP120 for other reasons other than damaging it (or the arduino) \$\endgroup\$ – Andy aka Aug 22 '13 at 22:56
  • \$\begingroup\$ Just to clarify, the damage I mention is referred to the arduino pin, not the transistor. I updated the question for posterity. \$\endgroup\$ – Ugo Riboni Aug 23 '13 at 7:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.