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.
Odpowiedzi:
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ł:
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 :
Tutaj widać, że bieżąca zgodność dla pinów we / wy ma maksymalną wartośćIMAX=12mA
Let's now look at a typical relay datasheet:
From here you can see that the resistance is125Ω 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, saturatedVCE 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 is100mA . 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:
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
Time to prepare a schematic:
simulate this circuit – Schematic created using CircuitLab
The value ofR1 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:
The nearest value would be470Ω . 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 full3.3V when driving high. Then the I/O pin and BJT base current will be 3.3V−800mV470Ω≈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 ofR1 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 of100mA 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:
Here, you can see a curve labeled150mA , 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 IB≈8textrmmA 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 at100mA , 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 forR1 :
Between these two? I'd just go withR1=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.)
źródło
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.
simulate this circuit – Schematic created using CircuitLab
The emitter-base voltageUBE 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.
źródło
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.
źródło
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.
źródło
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.
źródło