Detecting volume with piezo buzzer not stable

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

Have you measured the supply voltage when the relay is on and when it is off and verified it doesn't change?

Yes, I checked it and it doesn't change at all. it is a constant 4.98V.

I solved it. With the first test, the arduino was giving 5V to the entire circuit. It's 7805 that's built in is not strong enough. With the external power source, it is stable.