I have used the circuit described here: NerdKits - Piezoelectric Sound Meter
The circuit works and I have adjusted the 100K pot so that my readings are around 512 when there is no sound. But now I have something strange. On another digital pin of the Arduino, I have a transistor to switch a relay. If I bring this pin to high, the sound meter reads around 620-630 when there is no sound. So depending on what I do on the other pins, the analog reading of the piezo buzzer is different. As I use a threshold to detect if the volume rises above a certain level, I want the readings to be stable.
How can I make this reading from the piezo consistent? I prefer a hardware solution over compensating for it in my sketch.
I use an arduino nano and an external 7805 to give a stabilized 5V that with enough current for both the arduino and all the surrounding electronics.
Regards,
Cedric