Piezo speaker as a knock sensor

Hi,

I am trying to use my piezo speaker as an sensor, that could detect vibrations. In the tutorials that I have followed they recommend to wire a 1 mega ohm resistor parallel to the speaker. Since I do not have resistors of such high resistance, I am wondering if there is something else that I can try and how important is it that there is exactly a 1 M ohm resistor.

thanks!

You need a "pull down" resistor to keep the input from "floating" to an undefined voltage/state. (The piezo doesn't provide a DC path.) You'll get "readings" without a resistor but you won't get reliable readings.

A lower-value resistor will reduce the signal level. We have no idea how much signal your piezo is putting-out, but you can try a lower value resistor. (You won't damage anything with a lower-value resistor.)

Since I do not have resistors of such high resistance,

Resistors are [u]a few cents each[/u] but if you don't have a local electronics store you'll have to put together a minimum order and/or pay for shipping. You might want to buy a resistor assortment and/or some other miscellaneous components.

You can use several resistors to get to a desired value. This can get very unruly if you only have low values to work with.

Not critical. Anything between 10k and 10Megohm will work.
Less than 1Megohm will lower sensitivity.
Leo..

You may try to switch input, where your sensor is connected (analog input, probably?) to output mode using pinMode just right after the event has been detected. Than keep pin a few milliseconds as output, to discharge an energy, and switch back to analog using analogRead

This:- Drum like me video
Is what I did with the sensor.

This is the circuit I used. You need diodes to protect the inputs of the Arduino. It was a ATtiny running off 3 AA batteries.

knock sensor.png

knock sensor.png