Electronic – Piezo speaker with distorted sound

piezo-buzzer

I'm creating a simple circuit, where a microcontroller drives a piezo speaker. I couldn't find a datasheet for the piezo (the part number is HKDZ-G) but I know it has a internal oscillator and it's rated at 3V.

The speaker beeps are loud and clear 80% of the time. Occasionally, however, the sound will come out distorted (with a non-fixed higher pitch and lower volume, much like a teenager changing his voice). I can't really identify why.

This is the circuit schematic:

Circuit

This is the circuit:

Circuit

And this is the back of the circuit. The green wire is the one that leads from the MC to the speaker. While my soldering job is not so good, I tested all connections to see if their are not crossing. I also tried replacing the green wire (the photo is before the replacement) but with no success.

Circuit back

What causes the sound to come out distorted? Is it possible that there is some interference going on here? (I don't have an oscilloscope to test)

EDIT: I don't know if it's important to mention, but since the piezo has a internal oscillator, I'm not oscillating my signal, just plugging "1" on the MC pin output for a few hundred microseconds.

Best Answer

A likely cause for the occasional sound distortion is that the CR2032 cell is unable to sustain the current draw of the piezo buzzer plus the ATTiny for extended periods. This would be likely if:

  1. The buzzer is operated several times in quick succession, not giving the cell a chance to recover
  2. The ATTiny itself is consuming more power at certain times due to parts of its code

This hypothesis can be validated by running the buzzer directly off a partly depleted CR2032 for a few minutes - If the buzzer sound distorts like in the circuit after a bit, then the culprit has been identified.

Possible Solutions:

  1. Use two or three CR2032 cells in parallel for greater current sourcing capacity
  2. Use a reservoir capacitor of a relatively large value, to tide over the high load periods - This won't solve the problem, just alleviate it a bit
  3. Use a battery with more current delivery capacity