In my circuit I am seeing strange behavior from my piezo. I am driving a 4Khz (TDK PS1240P02BT) piezo buzzer with a BSS138K N-channel logic-level enhancement FET. The PWM output of my microcontroller (PIC18) is connected directly to the gate of the transistor with a 100K Ohm pull-down also attached to the gate. The PS12 piezo has a 1K Ohm resistor in parallel just like the data sheet recommends. The voltage driving the piezo is 12V, and the gate voltage is 3.3V.
Edit: Added potential simulation with Olin's suggested clamping diodes: simulation
The issues I am seeing are dying transistors, piezo volume dropping during longer tones, and the piezo failing to work for a while after playing, and then working again after "resting" for a while.
I have a couple of questions:
Any ideas why the transistors are dying? It doesn't appear to be getting too hot.
Is there a way to determine the impedance of the piezo? It does not appear to be listed in the data sheet. I tried modelling the circuit but this is difficult to do accurately when the capacitance of the piezo is unknown. I did see much higher current spikes than expected when using ~100nF values.
The data sheet lists the piezo at 3.3VP-P, but says it can tolerate up 30V with no DC bias. Is running this through 12V going to destroy the piezo?
Generally, are current limiting resistors and flyback diodes needed for piezo drivers, and if so how does one calculate the value of the resistor?
Finally, as an aside, would the piezo survive in an automotive environment (my current problems occur on the bench with a regulated supply), e.g. would the voltage transients quickly destroy the piezo?