Analysis of transistor drive circuit and level conversion
[Copy link]
The transistor, whose full name should be semiconductor transistor, is also called bipolar transistor or crystal transistor. It is a semiconductor device that controls current. Its function is to amplify weak signals into electrical signals with larger amplitude values, and it is also used as a contactless switch.
The triode is one of the basic semiconductor components, which has the function of current amplification and is the core component of the electronic circuit. The triode is made by making two PN junctions very close to each other on a semiconductor substrate. The two PN junctions divide the whole semiconductor into three parts. The middle part is the base area, and the two sides are the emitter area and the collector area. There are two arrangements: PNP and NPN.
Transistor level conversion - 3.3V-5V level conversion circuit
As shown in the figure above, the left end is connected to the 3.3V CMOS level, which can be the IO port of STM32, FPGA, etc. The right end outputs a 5V level to achieve the conversion from 3.3V to 5V level.
Now let's analyze the role of each resistor (the core idea is that the Vbe of the transistor is a constant value of about 0.7V when it is turned on):
Assuming there is no R87, when the high level of US_CH0 is directly added to the BE of the transistor, where will the voltage >0.7V go?
Assuming that there is no R91, when the level state of US_CH0 is uncertain, will the default output of Trig be high or low? Therefore, R91 plays the role of fixing the level. At the same time, if there is no R91, the transistor will be turned on as long as the input is >0.7V, and the threshold voltage is too low. R91 has the function of increasing the threshold voltage (see the analysis of the buzzer in the second section).
However, when adding R91, we must pay attention to the following: if R91 is too small, the base voltage will be approximate.
Only when Vb>0.7V can US_CH0 be turned on when it is at a high level. In the above figure, Vb=1.36V
Assuming that there is no R83, when the input US_CH0 is high level (when the transistor is turned on), D5V0 (5V high level) is directly added to the CE level of the transistor, and the CE of the transistor, the transistor is easily damaged.
Let's further analyze its working mechanism:
When the input is high level, the transistor is turned on, and the output is clamped at the Vce of the transistor. The circuit test result is only 0.1V
When the input is at a low level, the transistor is not conducting, and the output is equivalent to using a 10K resistor to pull up the input of the next level circuit. The actual test result is 5.0V (no load).
Please note:
For large current loads, the characteristics of the above circuit will not be so good, so it has been emphasized here that this circuit is only suitable for level conversion of loads from 10 mA to tens of mA.
Buzzer drive circuit
The above is a circuit uploaded from Zhou Ligong's iMX283 development board. It can be either an active or passive buzzer. Let's analyze it:
Calculate the current at each location (β of S9013 = 120, assuming the buzzer current is 15mA):
The threshold voltage for a high input level is calculated as:
R1 plays the role of providing the threshold voltage.
The main difference between the driving circuits of active buzzers and passive buzzers is that the passive buzzer is essentially an inductive element, and its current cannot change transiently, so a freewheeling diode D1 must be provided to provide freewheeling current. Otherwise, there will be a reverse induced electromotive force at both ends of the buzzer, generating a spike voltage of tens of volts, which may damage the driving transistor and interfere with other parts of the entire circuit system. If the operating voltage in the circuit is large, a diode with a larger withstand voltage value should be used, and if the circuit operates at a high frequency, a high-speed diode should be selected.
The basic idea of designing this circuit is to determine the load current (buzzer 10mA~80mA) and input threshold voltage. Calculate the values of R1 and R2 according to the method in 1.
ULN2x03 driver circuit
For the above drive circuit:
1. The load is connected to an infrared diode, and its series resistor is a current limiting resistor to control the infrared emission intensity.
2. The input is connected to the STM32 PWM function common IO port (set push-pull output), and the COM port is connected to the output voltage 5V
For the above circuit test (Power=5.0V):
1. Input 3.3V, output 0.6V
2. Input 0V, output 5.0V
3. Input is not connected, output is 5.0V
Therefore, ULN2003/2803 can also be used for level conversion. Why is that? What is the relationship between ULN2803/2003 and transistors? Its internal implementation is two transistors.
Its structure has three characteristics:
1. The output collector is open drain, so you can connect a pull-up resistor to pull the signal up to the corresponding level. The ULN2803 manual states that the maximum voltage it can withstand is 50V
2. The data sheet states that the input threshold voltage at Ic=250mA is VI(on)=2.7V
3. There is a reverse diode at the COM terminal: when connected to the output power supply, it can provide a current loop protection circuit when the power is turned on and off when driving load inductance devices such as motors; if the output voltage is higher than the COM terminal voltage, the voltage will be clamped at around VCOM+0.4V (the diode voltage drop here is small)
The only difference between ULN2003 and ULN2803 is that ULN2003 has only 8 channels, while ULN2803 has 9 channels.
Compared with the self-built transistor circuit above, it has better current driving characteristics. Therefore, the self-built transistor circuit above is suitable for level switching and small current driving, while ULN2803 and ULN2003 are suitable for larger current driving (the datasheet says that the maximum driving current can reach about 500mA). Therefore, ULN2803 and ULN2003 (and others such as 75452, MC1413, L293D) are often used to improve the system's load capacity (motors, large LEDs, relays, etc.).
The role of the transistor
The transistor has the function of current amplification. Its essence is that the transistor can control the larger change of collector current with a small change of base current. This is the most basic and important characteristic of the transistor. We call the ratio of ΔIc/ΔIb the current amplification factor of the transistor, which is represented by the symbol "β". The current amplification factor is a constant for a certain transistor, but it will change to a certain extent as the base current changes when the transistor is working.
|