3
\$\begingroup\$

I'm curious, when connecting my 2N2222 transistor's base to a PWM output pin on my Arduino, I know the Arduino can deliver a maximum of 40mA current. The 2N2222 only requires around 5 to 10 mA on it's base to switch the collector and emitter. Now, when calculating the base-resistor under "normal" conditions where I'm merely switching it directly from Vcc, the following applies: enter image description here

However, when putting in a 500 ohm or 1K resistor in (1K for 5mA) directly it works great. But putting it in between the Arduino and the transistor, the transistor doesn't switch.

I suspect thus, that the resistance is too high of the base-resistor. Therefore, we may very well not need a base-resistor.

But, according to spec, the Arduino can deliver 40mA. So, am I correct in assuming the folling: 1) I should calculate the perceived resistance that the Arduino is giving, if it goes high to 5Volt and only gives 40mA, and then 2) Subtract that from the 500ohm resistor needed to make the transistor operate optimally.

Example:

enter image description here

So, I'm theorising that I have to then put in a 375 ohm resistor in to make the total resistance between the Arduino and the base resistor 500 ohm.

Somehow this doesn't feel right. Keep in mind, I'm not an electronic engineer, so I might have the cat by the tail here :P

\$\endgroup\$
  • \$\begingroup\$ What's the load on the transistor? If you just look at the transistor collector with no load (such as a resistor) to +5 you won't see much going on. \$\endgroup\$ – Spehro Pefhany Aug 15 '14 at 10:56
  • \$\begingroup\$ The load resistance is 2.5 ohm. \$\endgroup\$ – Sarel Aug 15 '14 at 17:13
  • \$\begingroup\$ A 2.5 ohm resistor will cause 2A to be drawn from a 5V supply. That's way more than a 2N2222 can handle. \$\endgroup\$ – Spehro Pefhany Aug 15 '14 at 17:20
  • \$\begingroup\$ Understood, yes, but my supply that I'm using is limited to supplying 700mA. So I'll be drawing all the current I can through the 2N2222. \$\endgroup\$ – Sarel Aug 16 '14 at 6:40
8
\$\begingroup\$

You are missing one easy thing: voltage across the resistor won't be 5V.

Transistor side you have a \$V_{BE}=V_\gamma\approx0.7V\$, so the base of the resistor is about 0.7V lifted from ground.

Microcontroller side, when the output is high you don't have full \$V_{CC}\$ but a voltage that is somewhat lower. For a cmos chip that can be quite low, some 100mV, but to make the calculations easier let's say you have 0.3V from \$V_{CC}\$, meaning that the arduino output voltage is only 4.7V.

Let's do the math again:

$$R=\frac{(5-0.3-0.7)\text{V}}{10\text{mA}}=400\Omega$$

Since higher base current is better in this case, just stick with the lowest nearest standard value, i.e. \$390\Omega\$.

Note: that 0.3V that I wildly guessed is actually written down in the microcontroller datasheet and it's called \$\mathbf{V_{OH}}\$, as in Voltage Output High. You also can find the \$\mathbf{V_{OL}}\$ and... Yes, you guessed it, that's Voltage Output Low.
The first one is the minimum output voltage when the pin is set high, if you are within current specs of course, while the second value is the maximum output voltage when the pin is set low.

\$\endgroup\$
  • \$\begingroup\$ @Sarel yep you're welcome, that was just about a little education on how to get the proper value BUT I don't think this will solve your problem. A 20% difference in resistance is nearly within the precision of the resistor itself, you've got something else wrong around. If that does not cut it add a schematic to your question and we'll help you troubleshoot your problem. I need to know especially what you're trying to turn on with the transistor. \$\endgroup\$ – Vladimir Cravero Aug 15 '14 at 8:04
  • \$\begingroup\$ For example, might it be that the arduino works with 3.3V instead of 5V? \$\endgroup\$ – Vladimir Cravero Aug 15 '14 at 8:05

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.