Help with Piezo element

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.

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.

Shoot! I meant to say microphone. I am trying to use the Piezo as a microphone.

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.

I guess you would have to route the signal from the Piezo into a OP-AMP like the or similar and then go into the Arduino.

But i won't reccommend using a Piezo as a real mic anyway.

I've seen FlashTriggers with a Piezo though.

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.


Mount the piezo element by one edge only. Glue a small weight to the opposite edge. This helps pick up smaller vibrations.