I have a "noname" piezoelement from Aliexpress: enter image description here

I'd like to control it via microcontroller. Now I use this circuit to drive the piezo element: enter image description here

Microcontroller ports produce PWM signals. Everything works fine, the sound is loud enough.

The questions are:

  • Is this circuit reliable? (can it protect from voltage spikes).

  • How can this circuit be improved?

  • \$\begingroup\$ How loud do you want it? If louder then use a step-up impedance voltage gain autotransformer coil. \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Apr 10 '18 at 0:37
  • \$\begingroup\$ No, that won't do it. You need a gated oscillator circuit \$\endgroup\$ – Scott Seidman Apr 10 '18 at 1:50
  • 1
    \$\begingroup\$ @Scott If the GPIO are PWMable, an oscillator is not necessary. \$\endgroup\$ – dim Apr 10 '18 at 5:55
  • \$\begingroup\$ Or if you bit-bang them fast enough (and the MCU has nothing better to do). \$\endgroup\$ – Brian Drummond Apr 10 '18 at 8:33
  • 1
    \$\begingroup\$ @TonyStewartEEsince1975 Thank you for your answers! I searched for BAT54 parts - so, if I use the diode array (two diodes in one SOT23), it means I need 2 * SOT23 = 2 * (2.90 mm * 1.3 mm). I think it can fit. \$\endgroup\$ – Spark Apr 10 '18 at 20:50

R1 and C1 could be removed.

C1 protects the piezo against constant DC bias (highpass filter), but if you take care of that from the firmware, you're fine: avoid having one GPIO constantly high and the other constantly low. When mute, put both GPIO at the same level. Also, ideally, when driving, you should drive each GPIO out of phase, so the average value across the piezo is 0V.

R1 is there as the resistive element of the highpass filter created by C1. It helps discharging the piezo (which is like a capacitor) when not driven. But if you removed C1, you don't need it anymore. But it also lowers the level of the sound, so if you remove it it will be louder.

Don't remove the diodes and R2, it protects your MCU from the spikes created by the piezo when there is a shock. But if your aim is just to make the circuit smaller, you can choose dual series diodes in a single SOT23 package like the very common BAT54S. This will make this much much smaller.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.