I am having trouble getting the piezo element to function as a speaker. I plan to do some different things with it, but I can't even get the Knock tutorial to work. http://arduino.cc/en/Tutorial/Knock
I am setting it up the same way they have it, and I am using the default program, but it is only giving me zero.
Connecting it up like that uses the piezo as a sound sensor not a speaker. Connect it to one of the PWM pins. Then analog write to it. Check the audio section of the playground for a library to use to generate sound. http://www.arduino.cc/playground/Main/InterfacingWithHardware#Output
Not going to happen. Its just not sensitive enough to pick up more then a loud knock or a bang. Now an actual speaker can be used as a crewed microphone but i'm not sure if the arduino is going to be able to get a good read from it without some sort of amplification first.
Assuming you have everything hooked up the same as that sketch (and you are observing the piezo's proper polarity), what isn't apparent in the sketch or writeup (but seems logical to do) is that I would imagine the piezo is somehow attached to the door, so that the sharp vibrations of the knock "flexes" the sensor enough to produce a voltage to sense. Proper attachment, I would imagine, would involve a small drop of epoxy.