I’m working on an Alarm Clock in which I’m using a IR Distance Sensor ( http://www.adafruit.com/index.php?main_page=product_info&cPath=35&products_id=164 ) and and normal Piezo buzzer.
Everything is fine as long as the Piezo hasn’t made any sounds. After he has made sound and stops, there is a constant noise coming from it (not very loud but hearable and very annoying, it’s like a very fast beeping).
It doesn’t matter if I produce the sound with the standard tone() function or with the Tone library. The noise even occurs when i just do “analogWrite(51, 0);” in setup and nothing else.
The strange thing now is that if I unplug the Distance Sensor, the noise immediately stops and starts again when I plug it back in. It just has to be powered, no reading of the signal has to be done, so I think the only possibility is that the the sensor interferes with the piezo in some way.
I’m using an Arduino Mega and Win 7 64-Bit.
I hope someone knows why this noise occurs and how I can fix it.