I recently bought a Piezo component to be able to detect knocks on a surface. I've verified that the component works as an output device, as I used it to successfully generate a given tone (using the example here: http://arduino.cc/en/Tutorial/Tone). However, when attempting to use it as an input source, I get less than desirable results.
The piezo is connected to analog input A0 through a 1M? resistor. Here is a picture of how it's set up:
I've used code that simply loops and spits out the sensor reading (using analogRead(knockSensor)) per every iteration. The output does seem to change if I touch the Piezo sensor, but it doesn't seem to respond when I knock on the surface it's taped to. Additionally, if I tap it, the output either drops down to 0, or it continues rising up to 1023 long after I got away form it (it usually takes about 7 seconds to reach 1023 after tapping it). Why is this happening?
Also, did I post this in the correct section? If not, I'll delete it and post it where I should.