A previous Design Idea demonstrates how you can use a microcontroller to drive a piezoelectric buzzer at a high alternating voltage through a four-MOSFET circuit that interfaces to two of its I/O pins (Reference 1). This expanded Design Idea provides a modification of the previous circuit to save one of the I/O pins of the microcontroller. Q4’s gate connects to Q2’s drain rather than a second I/O pin (Figure 1). The microcontroller turns on Q2 by applying a high logic level to the I/O pin, pulling Node A down to a low logic level. This action turns on Q3 and turns off Q4. The voltage on Node B becomes 15V, and Q1 turns off. The voltage across the piezoelectric element is now 15V.
Figure 1. | One microprocessor I/O pin drives this circuit to generate an alternating voltage across the piezoelectric buzzer. |
The microcontroller then toggles the I/O pin low, turning off Q2. Q1 is also off, so Node A slowly rises to a high logic level through pullup resistor R1. When the voltage on Node A reaches the switching threshold of the inverter comprising the Q3 and Q4 pair, Q3 quickly turns off and Q4 quickly turns on. The consequently low logic level on Node B turns on Q1 and speeds the increase of Node A’s voltage. The 15V across the piezoelectric buzzer is now of the opposite polarity.
R2 weakens the coupling between the output and the input of Q4 due to the presence of the piezoelectric element. A value of 330Ω for R2 is usually sufficient to suppress high-frequency oscillations that the feedback causes. The drained power from the supply increases if you use low values for R1. Using excessively large values for R1 also increases power dissipation by prolonging the switching of the transistors and associated shoot-through currents. The optimum value for R1 is approximately 1 kΩ.
Saving an I/O pin with this design involves the trade-off of increased power consumption. The circuit’s power consumption is thus one order of magnitude greater than the circuit described in the previous Design Idea.
Reference
- Ozbek, Mehmet Efe, “Microcontroller drives piezoelectric buzzer at high voltage”