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:
This is the 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.
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:
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: