In the digital circuit design, often need to switch the digital signal through the expansion device to drive some buzzers, LED, relays and other devices that require a larger current, the most used switch expansion devices to the number of transistors. However, during the process of using, if the circuit is improperly designed, the transistor can not work in the normal switching state, which can not achieve the expected purpose. Sometimes it is because of these small errors that the re-boarding is caused, resulting in waste. I have suffered losses in this area, so I use some of the experience of the transistor and some common errors to share with you, in the circuit design process can reduce some unnecessary trouble.
Here are some common transistor circuit to do the switch. A few examples are buzzers as driven devices.
Figure 1 a circuit using the NPN tube, note the buzzer connected to the collector of the transistor, the drive signal can be a common 3.3V or 5VTTL, open high, the resistance can be taken according to the rule of law 4.7K. For example, a circuit, open high 5V, the base current Ib = (5V-0.7V) /4.7K = 0.9mA, can make the transistor fully saturated. b circuit is a PNP tube, the same buzzer connected to the collector of the transistor, the difference is that the drive signal is 5V TTL level. Both of these work well, and the buzzer (active) emits the loudest sound as long as the PWM drive signal is operating at the right frequency.
Figure two compared to the two circuits, the biggest difference is that the driven device connected to the emitter of the transistor. The same look at the c circuit, open when assumed to be high 5V, base current Ib = (5V-0.7V-UL) /4.7K, where UL is driven device voltage drop. Can see that the same base resistance taken 4.7K, the base current flowing through a smaller circuit than the Figure a, how much depends on how much UL. If the UL is relatively large, then the corresponding Ib is small, it is likely to cause the transistor can not work in saturation, making the driven device can not move. Some people would say that the base resistance can be reduced, but the voltage drop of the driven device is hard to know, and some of the driven device's voltage drop is fluctuating, so the base resistance is difficult to choose the right Value, the resistance value is too large will drive failure, the choice is too small, loss and larger. Therefore, it is not recommended to use the two circuits in Figure 2 as a last resort.
Let us look at Figure three these two circuits. The drive signal is 3.3VTTL level, while the driven device requires 5V for turn-on voltage. In the 3.3V MCU circuit, it is easy to design these two kinds of circuits carelessly, and these two kinds of circuits are all wrong. First analyze the e circuit, which is a typical "positive emitter bias, collector bias" amplifier circuit, or emitter emitter. When the PWM signal is 3.3V, the emitter voltage of the transistor is 3.3V-0.7V = 2.6V, which can not reach the expected 5V. Figure f circuit f is also a very failed circuit, first of all this circuit is open is no problem, when the drive signal is low, the device can be driven by the normal action. However, this circuit can not be turned off. When the driving signal PWM is 3.3V high, Ube = 5V - 3.3V = 1.7V can still turn on the transistor, so it can not turn off. Here, some people would say that this circuit has been used, no problem ah, and MCU voltage is 3.3V. I say you definitely use the OD (Open Drain) drive, and it is a true OD or 5V tolerant OD, such as the STM32 IO port can be set to tolerate a 5V tolerant OD drive (but some do not work) . When the drive signal is OD gate drive mode, the output high, the signal becomes a high-impedance state, the current flowing through the base is zero, the transistor can be effectively shut down, this time f circuit is still valid.
Based on the analysis of the above several kinds of circuit conditions, we can see that the two kinds of drivers in Figure 4 are considered as the optimal driver circuit. The difference between Figure 1 and Figure 1 is that Figure 4 adds a 100K resistor between the base and the emitter. There is also a certain role, you can make the transistor has a known default state. When the input signal is removed, the transistor is still off. In terms of safety and stability, the increase of this resistance is still very necessary, or that can make the transistor work in a better state switch.
Transistor as a switching device, although the drive circuit is very simple, to make the circuit more stable and reliable, or can not be taken lightly. In order not to make mistakes, personal advice is to give priority to the circuit in Figure 4, try not to use the circuit in Figure 2, to avoid the use of Figure 3 of the working conditions.
Next: No Information