2

I am well aware that similar questions has been asked and I have read a lot of them. I still need to ask this before I loose my mind :)

I want to, and have also managed to use a 2n3904 as a switch/button, where I use a digital pin connected to the base of the 2n3904 to "push" the button which is between the emitter and ground.

schematic

simulate this circuit – Schematic created using CircuitLab

I calculated a resistor value which works great. Using these formulas:

Ib = Ic / Hfe Urb = Vcc - Vbe And finally Rb = Urb / Ib

BUT here is the thing, I realise that when measuring Ic I measured it to 0.113mA which I then used in the formula and forgot to divide by 1000 to get it in Amps, so my calculation was wrong but the circuit works. With an Rb around 1.2kOhms.

So I try to make it the riht way and use 0.000113 as Ic value instead. This gives me an Rb value in Mohms! And well, when adding a 1mohm resistor to the base the circuit does not work.

I just need to know what I am doing wrong. Hoping someone can tell me. So the values I used for the formulas are: Ic: 0.113mA (measured over the button I want to exchange) Hfe: 60 from datasheet Vcc: 5v as I run everything from the arduino. Vbe: 0.65 min value from datasheet

Or am I using the wrong formulas even???

Sourcery
  • 153
  • 1
  • 5
  • When using a BJT as a switch, the Hfe is not usually taken as 60. I think that's part of where you are going wrong. – jonk Aug 29 '16 at 20:58
  • Can you show us where the load is in a circuit diagram? – Scott Seidman Aug 29 '16 at 21:00
  • Way too much handwaving. Show a schematic and define variables you make up. Closing until then. Some of what you say doesn't make sense or is inconsistant. Emitter goes to the pushbutton? – Olin Lathrop Aug 29 '16 at 22:15
  • @Sourcery there is a schematic tool button on the question box. You can use it to draw schematics. Edit your question, provide a schematic and there's a good chance it will get reopened – Voltage Spike Aug 29 '16 at 22:41

2 Answers2

14

When using a BJT as switch, you do NOT usually imagine that \$\beta=60\$. You might in certain unusual circumstances. But usually not.

Let's take a look at the 2N3904 from OnSemi. The datasheet is found here: 2N3904 datasheet. That way we can share our views together.

Go look at Figure 16, Collector Saturation Region, in that datasheet. There you will see a nice chart. For operating a BJT as a switch, you want to have \$V_{CE}\$ be relatively low -- say under \$200\:\text{mV}\$ if possible. This \$200\:\text{mV}\$ itself varies from device to device, by the way. So what you want to do is to find that knee you can see in those curves there and move your eye a little to the right of the knee. In this case, they provide 4 curves -- one for each of some "practical" values for \$I_C\$. Let's say you feel that \$I_C=30\:\text{mA}\$ is closest to your needs (I hope it isn't a lot more than \$100\:\text{mA}\$!) Looking at that curve, you can see that about \$I_B = 1\:\text{mA}\$ is a "good" place. That's because the \$V_{CE_{sat}} \approx 200\:\text{mV}\$ there. (Large signal BJTs might show a higher value for a "good" \$V_{CE}\$ on their curves, so you have to adapt your mind to each device.)

So this gives you a figure of \$\beta = \frac{I_C}{I_B} \approx 30\$, here. Not 60! More, these are "typical" values. Not guaranteed ones. So a designer might look at this curve to get a "feel" for things, such as what to expect for \$V_{CE_{sat}}\$ for the transistor they are considering and also about what kind of \$\beta\$ would be reasonable. But then they would design in some serious margin. In this case, I'd say that you should plan on a \$\beta \approx 15\$. Now, a lot of designers just arbitrarily and without even checking a small signal BJT datasheet at all, just set \$\beta = 10\$ since they know it is being used as a switch. That's a pretty good bright line, if you are into bright lines. If you aren't and instead want to double check things, then go get the datasheet and look. Then make a reasoned judgment. Chances are, your saturation \$\beta\$ will be somewhere in the \$10 - 20\$ range. For large signal devices, you'd best check the datasheet.

Let's look at this another way. Look at Figure 17, now. The one called “ON” Voltages. Note here on the chart that they show some curves for \$\frac{I_C}{I_B} = 10\$? That is the datasheet writer providing information on the case where the BJT is "saturated" and operating as a switch. This is a very common use, so they provide standard curves. But notice that they selected \$\beta=10\$ for the purposes of charting some typical data (at some temperature.) This is yet another clue for you. It tells you that it isn't unreasonable to apply \$\beta=10\$ in this case. You should learn to read datasheets like this. It helps.

So now suppose you have this circuit:

schematic

simulate this circuit – Schematic created using CircuitLab

You look at Figure 17 and see the \$V_{BE_{sat}}\$ curve shows about \$815\:\text{mV}\$ for \$I_C = 30\:\text{mA}\$. So that is your estimate now for \$V_{BE}\$ for purposes of your switch calculations. Let's be different and stick with my \$\beta_{sat}=15\$, too, as well as \$I_c=30\:\text{mA}\$ for now. We'll take your figure of \$V_{CC}=5\:\text{V}\$.

So now you compute:

\$R_1 = \frac{Vcc-V_{BE_{sat}}}{I_B} = \frac{Vcc-V_{BE_{sat}}}{\frac{I_C}{\beta_{sat}}} = \beta_{sat}\cdot\frac{Vcc-V_{BE_{sat}}}{I_C}= 15\cdot\frac{5\:\text{V}-815\:\text{mV}}{30\:\text{mA}} = 2092.5\:\Omega\$

Round that up to \$2.2\:\text{k}\Omega\$ or down to \$1800\:\Omega\$. Both probably will work fine. Note that I took an exact \$V_{BE_{sat}}=815\:\text{mV}\$ from the chart? Actual parts will vary on that. So I might have, to be conservative, picked a value of \$V_{BE_{sat}}=1\:\text{V}\$ to be safer. That's partly why slight adjustments of the resistor value are probably okay. We are just approximating things, anyway.

Another note here is that the equation I used doesn't include any drop of voltage at the Arduino I/O pin. In fact, there will be a drop. So the output will not actually be \$5\:\text{V}\$. Especially not when supplying \$2\:\text{mA}\$ or so. The output of an Arduino actually has an equivalent resistor of about \$100\:\Omega\$ present. This is essentially just the ON resistance of the internal MOSFETs used by the Arduino CPU. But it does matter a little. In this case, you can expect a drop of about \$V_{drop}=100\:\Omega\cdot I_B = 200\:\text{mV}\$. As you can see, subtracting that means that we probably should have used \$4.8\:\text{V}\$ instead of \$5\:\text{V}\$ in our calculations. If you want to see the full equation with that included, then:

\$R_1 = \beta_{sat}\cdot\frac{Vcc-V_{BE_{sat}}}{I_C} - 100\:\Omega\$

In short, all you do is subtract off the expected impedance of the I/O pin. And as you can see, that's merely \$100\:\Omega\$ less that previously calculated.

Additional Note: But why \$V_{BE_{sat}}=1\:\text{V}\$ and not \$V_{BE_{sat}}=2\:\text{V}\$ to be even safer still? Well, it turns out that if we used an \$I_C\$ value that is 10 times higher, the needed \$V_{BE_{sat}}\$ would only be about \$60\:\text{mV}\$ more. So we only need to increase \$V_{BE_{sat}}\$ by one or two of these \$60\:\text{mV}\$ amounts in order to not only cover our bases, but cover them pretty well. So, really, \$V_{BE_{sat}}=1\:\text{V}\$ would be very conservative and there is no need to estimate any more than that here.

So I think by now you should realize just how many different "reasoned" elements are being brought into a calculation. This is why rounding to a nearest value usually works just fine for you. There are decisions that swing this way, and that way, but the main thing is that you get yourself into the ballpark without missing any important details. There are cases where precision counts. But this isn't one of them.

jonk
  • 77,876
  • 6
  • 77
  • 188
  • You put in a wrong number for $V_{CEsat}$. You used $V_{BE}$ – Scott Seidman Aug 29 '16 at 21:43
  • ... but nice answer – Scott Seidman Aug 29 '16 at 21:44
  • Thank you for a very informative answer. I will have to process this a bit, and go through the datasheet you supplied. I had a datasheet ofcourse, but it seems to have all different values and also not as comprehensive with graphs etc as the one you supplied. That is one of the errors I had. Also I have to find some way to explain all the "reasoned" elements as you say :) Thank you again. – Sourcery Aug 30 '16 at 13:45
  • @Jonk I have a question about the Ic value, you use the 30mA curve (fig.16 in the datasheet), but when I measure Ic in my circuit I only have 0.113mA, which I also stated in my question. Now the calculation you made works in my circuit ofcourse, Im just wondering if you missed that value, or if 30mA "always" should be used when using a BJT as a switch? Or would the 1mA curve be a better place to look? There are as you say many reasoned elements, and I am just really trying to get my head around it. Thanks again. – Sourcery Sep 02 '16 at 12:03
  • @Sourcery: No. I just used $30mA$ because there was a curve for it. Also, you didn't measure $I_C=0.113mA$ according to your writing of it. You measured $I_B=0.113mA$. Quite a different thing. – jonk Sep 02 '16 at 16:50
  • @Jonk thank you again, my mistake (ofcourse) I have edited my question to display the right measured value. With this value of Ic=0.113mA would the curve for 1mA be a better choice? – Sourcery Sep 03 '16 at 07:21
  • @Sourcery: Yes, of course. In fact, since your current is almost a factor of 10 still less, you can assume that $V_{BE}$ will also be about $60mV$ lower than shown on another chart, as well. – jonk Sep 03 '16 at 07:23
1

In the 70's Motorola Semi ( now ON Semi) used the terms "beta-overdrive factor" to explain how BJT's should be used as switches. Using the linear equation one would choose a range of 5x to 10x more base current than hFE would indicate to ensure adequate low Vce(sat).

But hFE has a wide tolerance and is temperature dependent, so a simpler method using Ic:Ib ratio with a guaranteed Vce(sat) at rated is used.

These days ultra low Vce(sat) transistors , which were patented by ZETEX (now called Diodes Inc) with over 50 patents are available with ultra low Vce(sat). enter image description here

Many other OEMs now use this process or similar.

The most notable difference is that these devices are more expen$ive but in the same class as low RdsON MOSFET power switches.

In fact since the Vce(sat) can reach near 0V ( 5mV) at 1% of rated low current. This 1% is a good knee point to use. They behave more as linear bulk resistors once they are saturated. Instead of the usual Ic:Ib ratios of 10:1 or 20:1 , they sometimes use 50:1.

The second most notable distinction is that in some parts they give V-I curves for Vce(sat) using 50:1 is about 10% of the minimum hFE for those devices.

So depending on your need for power dissipation during switching or Voltage rise with current, you may choose a range of 10:1 for heavy loads or up to 50:1 for better transistors using Ic:Ib ratios.

example of low Rce(sat) www.diodes.com/_files/datasheets/DSS5540X.pdf DSS5540X-13 PNP SOT89 Rce(sat) = 30 mΩ typ Ic = -5A, Ib = -500mA

This means if you use a 10:1 current ratio you can estimate the voltage rise using the Rce(sat) value. In conventional bipolar fabricated transistors you normally have to add 0.2~0.3 V to the computed Rce(sat) value from the data curves.

Tony Stewart EE75
  • 1
  • 3
  • 54
  • 185