Czy BJT są odpowiednie dla osób zmieniających poziom? Wydaje się, że FET są bardziej powszechne, jak się porównują?

16

Jestem hobbystą i nigdy nie przeszedłem arkuszy danych / samouczków dla tranzystorów FET; Jestem mężczyzną z BJT. Nigdy nie znalazłem dyskusji dotyczących BJT vs. FET i konkretnych aplikacji najlepiej dopasowanych do każdego typu. Moje projekty to bardzo proste układy przełączające i logiczne. Kiedy więc dostałem BJT do spełnienia wymagań projektu, po prostu pozostałem przy tym, co działało. Spędziłem popołudnie badając to na EE-SE i znalazłem wiele dobrych rzeczy. Przekonałem się, że FET wydawały się bardziej popularnym wyborem dla osób zmieniających poziom. Miałem nadzieję, że ktoś może dostarczyć wyjaśnienie „dla manekinów” dotyczące mocnych / słabych stron i kompromisów związanych z FET i BJT w niektórych typowych zastosowaniach.

Wybrałem ten mechanizm zmiany poziomu dla mojego projektu: chcę sterować przekaźnikiem 5 V za pomocą ESP8266, który ma GPIO 3,3 V. Zmierzyłem prąd cewki przekaźnika, aby wynosił około 100 mA. Chcę użyć S8050 i minimum części, wymagania nie są wysokie. Po prostu używam ESP8266, aby odczytać styk czujnika PIR, a także odczytać niektóre przełączniki do sterowania światłem za pomocą przekaźnika. Czy powyższy obwód jest dobrym wyborem? Zaprojektowałem własny obwód, ale nie zamierzam go używać. Mimo to pomogłoby mi to zrozumieć, gdyby ktoś uprzejmie dostarczył analizę mojego projektu, opartą na przeczuciach, domysłach i być może trochę voodoo.

Krótko mówiąc, rozumowałem, że na mój prąd podstawowy (wyjście GPIO 3,3 V - podstawa 0,7 V w Q1) / 1 kilooma R2 = 2,6 mA nie będzie miał duży wpływ prąd w dzielniku napięcia R1 / R3, który moim zdaniem wynosi 5 / (100 K + 100 K) = 25uA. Nie wiem, jak będzie działać połączenie podstaw R1, R2, R3 i U1; Domyślałem się, że podstawa U1 obniży 2,5 V dzielnika do 0,7 V, ale nie byłem pewien, jak wpłynie to na 2,6 mA ze źródeł GPIO. Dlatego poszedłem z obwodem, który połączyłem.wprowadź opis zdjęcia tutaj

JRE
źródło
1
Co robi R1?
pericynthion,
W tym momencie pojawia się voodoo: to po prostu coś, co wygląda znajomo z różnych stron internetowych z obwodami. Po konsultacji z moją magiczną 8-piłką pomyślałem, że spróbuję „polaryzować” obwód. Przede wszystkim chciałem tylko, aby pin GPIO nie przekraczał 3,3 V. Jak powiedziałem, „voodoo” (a może przesąd ... cokolwiek).
5
Podejrzewam, że część popularności FET-ów polega na tym, że ponieważ są zasilane napięciem, a nie prądem, a większość ludzi używa aplikacji przełączających, łatwiej je zrozumieć pod wieloma względami. Konieczność myślenia prądami za pomocą BJT może być nieco kłopotliwa. Ironiczną wadą czasami jest to, że FETS wymaga tego napięcia, aby przyłożyć się do bramki, a nie masz dodatkowych woltów powyżej dodatniej szyny itp.
Ian Bland

Odpowiedzi:

17

Ray. Yes, there are hundreds if not thousands of good pages on using BJTs for pretty much any kind of switching arrangement you can imagine. They also work fine as level shifters, though despite your use of that phrase I actually don't think that's your situation here. If you want to look at an example of level shifting using BJTs, you can see my answer here.

Below, rather than give you a fish, I'll try and teach you to fish.


For situations involving current compliance that exceeds your I/O pin (like a relay) or also a different, higher driving voltage than your I/O pin can handle (again, like your relay), or also where you need some protection against inductive kickback (once again, like your relay) you will probably want to use an external BJT or FET as a switch.

Możesz tak ustawić rzeczy, aby przełącznik był:

  1. Na niskiej stronie (blisko ziemi) lub
  2. Po stronie wysokiej (w pobliżu napięcia sterującego przekaźnika lub innego urządzenia) lub
  3. Po obu stronach (mostek H, obciążenie związane z mostem itp.)

Ale naprawdę musisz mieć dobry powód, aby wybrać (2) lub (3) powyżej. Obejmują więcej części i często są niepotrzebnie skomplikowane, jeśli nie masz dobrego powodu. Tak więc przełącznik niskich częstotliwości jest pierwszym wyborem do sprawdzenia czegoś takiego.


Aby zaprojektować dowolny przełącznik, zacznij od specyfikacji tego, co musisz prowadzić, oraz specyfikacji tego, co masz do prowadzenia.

Spójrzmy na arkusz danych ESP8266 :

enter image description here

Tutaj widać, że bieżąca zgodność dla pinów we / wy ma maksymalną wartość IMAX=12mA

VCC=3.3V

(Voh Min)VOH2.64V
IMAX.) They also guarantee a low output voltage of 80% of that, or
(Vol Max)VOL330mV
(This means, when sinking IMAX.)

Let's now look at a typical relay datasheet:

enter image description here

From here you can see that the resistance is 125Ω and that the required current is 40mA.

(Another detail is that it requires at least 70% of the specified voltage to engage, which confirms that a BJT switch-mode, saturated VCE drop of perhaps a few tenths of a volt is "affordable." If you don't understand what I mean, or why I say it, when I write 'switch-mode, saturated VCE drop' then you need to stop and think about this. It's important. When operating a BJT as a switch, you cannot afford a large-magnitude VCE. You want this to be as small as practical so that it really does work like a switch. But to achieve small magnitudes there, you need to operate it 'saturated,' which means the applicable β will be low.)


The above bits of data say that you really do need an external switch for all the reasons mentioned earlier. You need it because it requires more current compliance then your I/O pin can provide, because you want to protect your I/O pin from back-emf from the relay's inductance, and because the relay requires a higher voltage than your I/O pin can provide. Don't even think of using the I/O directly!

You also can use almost any BJT, because of the low current needed by the relay.

(Your relay may require more current. But even if it is twice as much, most BJTs can handle that relatively easily. Regardless, you need to say so, if so. [EDIT: I think you've indicated in comments below my answer that the measured current is 100mA. That should be okay. But it changes some of the values I write below.)

In this case, I'd use what I have a lot of: OnSemi PN2222A devices. Let's start by examining Figure 11:

enter image description here

Look at Figure 11 and you can get a lot of important information. The first is that they "recommend" operating it as a switch with β=ICIB=10. (You can see this in two places: the lowest curve on the chart which is the value of VCE when saturated, where they specify ICIB=10 and also the top-most curve which they identify in the same way.) So this means

(Ib)IB=4mA
which is well within the limitations of your I/O pin. So that's nice. The second is that
(Vbe)VBE800mV
with that collector current. (Just look along the x-axis to find the collector current, then look up to where the curve intersects a y-axis value.) This last detail will be used in the design.

Time to prepare a schematic:

schematic

simulate this circuit – Schematic created using CircuitLab

The value of R1 is pretty simple to compute. First, assume that the I/O pin is operating at its lowest output voltage when high. You already know this value from above, Voh Min. Also, you know the typical value for the base-emitter voltage of the BJT from above, Vbe. And finally, you also know the likely base current, Ib. So just compute:

(R1)R1=2.64V800mV4mA=460Ω

The nearest value would be 470Ω. So that is what you see in the schematic. The diode, of course, provides a path for the relay's magnetic field energy to collapse, when you try to turn it off. It otherwise doesn't conduct.

Say your I/O pin is more powerful than we assumed and holds a full 3.3V when driving high. Then the I/O pin and BJT base current will be 3.3V800mV470Ω4.4mA. This is also just fine and won't hurt anything at all. So this design should work well.

There are reasons for adding a resistor to ground, from the BJT base. One is that it helps keep the base near ground if for some reason the other end of R1 were floating and not connected to your ESP8266. And there are other reasons. But it's not vital here, so I'll leave out the discussion of it for now.

EDIT: With you indicating (in comments below) value of 100mA for the relay, which is 2.5 times as much as I'd used above, you could consider the idea of using 2.5 times the base current. But also most of these small signal BJTs can work well as a switch with higher values of β than I earlier suggested from reading Figure 11. Let's look at Figure 4, now:

enter image description here

Here, you can see a curve labeled 150mA, which is more than you need. The x-axis is the base current IB, and the y-axis is VCE. You want a low value for VCE and you can see that it plateaus out at around 100mV. Keeping in mind that these are typical curves and not guaranteed curves, you can see that using IB8textrmmA looks pretty solid (far away from the curve knee) and that 10mA is even better. Well, this suggests that β from about 15 to 20 is probably going to work pretty well.

Taking all this together for your relay at 100mA, you need about 2.5 times as much base current because of the increased relay load but you can afford to drop it by a factor of from 1.5 to 2.0 because of the Figure 4 curve. So perhaps going from the earlier computed IB=4mA to perhaps IB=5mA to IB=6.7mA is just fine.

Let's re-compute the earlier equation for R1:

(R1 redo 1)R1=2.64V800mV5mA=368Ω

(R1 redo 2)R1=2.64V800mV6.7mA=275Ω

Between these two? I'd just go with R1=330Ω. I think that would be sound. Worst case I/O pin current should be approximately 7.5mA. This is well below the maximum of 12mA for the ESP8266 datasheet table I show above, but enough under it that I wouldn't be too concerned. (At least, not unless I knew I was repeating this driver across a large number of I/O pins. In that case, I'd probably go look to see if there was a specified limit for the port or device as a whole.)

jonk
źródło
Excellent answer! This will be the circuit I use, I already have some 2N2222A that I've scavenged. I thought I had this material down pat, but I'm glad you went into the detail that you did because I see that I'm a little shaky on some things: First, I'll be paying attention to the guaranteed values for high level output voltage and factor in the 80% (or whatever is the case), instead of just using the full 100% in my calculations. The thing that really surprised me was your use of the beta parameter of collector current / base current. I've been using hFE all this time. I glossed over
the calculations in my question, so: I measured 100mA through the relay using a 5V supply (I can't get the datasheet because I've glued over the printing). I multiplied this by a suggested 2X- 5X safety margin, so I settled on 260mA. Isn't that what I use for collector current? I divided this by the hFE of 100 to get a base current of 2.6mA. So here's where I'm all confused: thought hFE was the current gain of the base to the collector. Rearranging beta = Icollector / Ibase gives base current X beta = collector current. Where have I slipped? I'm also puzzled by the graph in Fig. 11,
@Ray71 You have to over-drive the BJT if you want it acting like a switch. Look at Figure 11. You can see curves with VCE=10V and this would be with a β you are used to. But the other curve is for "saturation." Which is what you want with a switch. If your relay current is 100mA then I think you will be fine using a β=15 or a little higher, perhaps. Which makes it still work for your I/O pin.
jonk
At the top there are 3 plots, 2 of which are well labelled, but the third one simply says, "1.0 V". Even though I used the one labelled, "Vbe(sat) @ Ic/Ib = 10" I'm curious about the "1.0V'. For the protection diode, I been in the habit of using ones in the range 1N4001-1N4007. How much does this matter. Again, out of ignorance, I thought that being "beffier" than the delicate looking 1N4148 meant it was more "heavy duty". I'm on board with the 1N4148 from now on, just wondering about the difference in behavior. I've inferred from he schematic that the diode's cathode should connect to the
@Ray71 The BJT becomes increasingly saturated as VCE gets less than a volt. You want to drive VCE well below a volt. So you must approach this as a saturated situation and you don't get to use the curves where VCE=1V or VCE=10V, obviously. Those would be very bad switches. Feel free to use any diode that works for you. Most will survive. I didn't want to get into the details of calculating the inductive kick back. (It can be done.)
jonk
10

You don't need this "voodoo". Both R1 and R3 are unnecessary here. A bipolar transistor is working on currents, not voltages. These resistors are only needed to bias the transistor into its linear region for linear amplifiers. You don't want linear amplification, you want high-efficiency switching.

schematic

simulate this circuit – Schematic created using CircuitLab

The emitter-base voltage UBE depends on the collector current but in general, it's about 1V. So, with 3.3V on its base and a 1k base resistor, you have about 2mA base current.

Use a switching transistor, these have a high beta value and go into saturation at very low input currents. You may also consider a darlington type for higher loads. Saturation leads to lower voltage drop and less heat production in the transistor.

Janka
źródło
4

FETs don't saturate. Thus a big speed win.

And a bipolar Vbe is pretty much set at 0.5--0.7volts, for useful currents.

Whereas a FET happily allows 1 or 2 or 5 or 10 volts between gate and channel. Thus a big win for flexibility of operation.

analogsystemsrf
źródło
2

A general comparison of BJTs and FETs:

BJT: - Current-controlled device - Charge carriers are both electrons and holes (hence bipolar) - Physically larger - Very little input capacitance (can give higher speed/higher frequency amplification) - More linear amplification since gain doesn't depend on bias voltage - Can have lower output impedance, and therefore drive low-impedance loads easier - Generally higher power consumption due to current control

FET: - Voltage-controlled device (lower power consumption, only draw power when switching state generally) - Charge carriers are either electrons or holes (depending on type, hence unipolar) - Physically smaller - Can scale easier (half drain current by halving gate size) - Generally higher input capacitance and Miller Effect means that as gain goes up, so does input capacitance - Can't drive low-impedance low very well (usually needs buffer stage) - Generally lower power consumption

This is by no means a complete list of differences, but hopefully answers your question as to the differences between the two types of transistors. In my educational experience, it seems that 95% of the time for hobbyist projects, BJTs are the way to go, but for large-scale, high density projects, CMOS is the primary choice since most digital circuits are CMOS, and therefore it's cheaper to produce both analog and digital in the same process.

K.Effinger
źródło
0

In some applications, energy efficiency is very important. Even though there are many applications where it doesn't really matter, many people don't like needlessly limiting designs to the latter applications.

If one needs to have a single-BJT-based circuit that is capable of switching 100mA, that circuit will probably need to draw somewhere between 2-10mA whenever it's supposed to be on, whether the load current is actually 100mA or zero. If the load will actually draw 100mA any time it's on, adding even 10mA to the power draw of the system at that time would only increase overall power consumption by 10%. If, however, the load might often be driving something that only takes 1mA, adding even 2mA to the power draw when it's on would triple the power consumption related to controlling that load. If the load will be switched on most of the time (but simply draw very little current) that could be very wasteful.

BJTs have been widely available longer than MOSFETs, and many circuits are designed around that availability. I don't know that any particular MOSFET is quite as ubiquitous as the 2N3904 and 2N3906. Those parts are nowhere near the best transistors on the planet, but they're everywhere. I don't know of any MOSFETs of which one can say the same.

supercat
źródło