Piezo as input to Arduino

I would like to be able to use a piezo as a kind of vibration microphone. I want to place it on a vibrating surface and use an Arduino to digitize the waveform. What front end electronics will I need?

This can't be unique request. Does anyone have any links to tutorials/examples?

Start with File:Examples:Sensors:Knock in the IDE.

Maybe something here will help.

Thank you.

I saw many of those "knock" sensor descriptions in my search. But I want to be able to measure amplitude of the vibration, not simply have a circuit with a fixed cutoff value.

I don't have any real background in electronics and I also am lacking an oscilloscope. I can acquire both of those given time and money, but is there a short cut I can take?

Not really.

If those docs are too technical, try this site

I've used a very simple setup with 3 resistors. (In my case 47k each)

Two resistors form a divider between 5V and ground - they have the same value (10k, 100k sort of range is fine), so the mid-point is 2.5V.

You connect another resistor across the piezo element (sets the sensitivity - higher is more sensitive, this resistor basically converts the piezo current signal into a voltage signal.

The piezo element and resistor are connected between the 2.5V tap on the divider and an analog pin.

The resistor divider resistors limit the current into the analog pin, so 10k or higher is nice and safe.

You then read the analog pin and either threshold its value, or you can compute rms value or sample at audio rates if you want.

I used this to turn vibrations to light for a drummer I know.

The voltage divider, with resistors of equal value, reduces the 5v source to a 2.5v “base” at the junction of the two 47K ohm resistors – let’s call them R1 (nearer positive) and R2 (nearer ground). However, as soon as the 47K resistor straddles the piezo – let’s call that resistor Rin, it forms a parallel circuit with R2, reducing both resistances from 47K to 23.5K. R2||Rin = (R2 * Rin) / (R2 + Rin) = (47K * 47K) / (47K + 47K) = 23.5K

So now the anticipated 2.5v ends up as 1.66v. Vb = (Vs * R2||Rin) / (R1 + R2||Rin) = (5v * 23.5K) / (47K + 23.5K) = 1.66v

That is still enough to keep the piezo’s +.010v to -.010v excursions from giving any pin a negative value. Arduino pins can either source (put out conventional current) or sink (take it in), but not both (refer to OUTPUT and INPUT). The analog pins measure fluctuating current (okay), not alternating current (danger!).

So to be martinet and get back the 2.5v junction, here’s how to do it (keeping in mind that R2 = Rin). First, let’s find R2, given R1: R1 = (R2 * Rin) / (R2 + Rin) 47K = (R2 * R2) / (R2 + R2) 47K = (R2 squared) / (2R2) 47K * 2R2 = R2 squared 94KR2 = R2 squared 94K = R2, which also equals Rin

Then, find the value for R2 and Rin in parallel: R2||Rin = (R2 * Rin) / (R2 + Rin) = (94K * 94K) / (94K + 94K) = 47K

So now the anticipated 2.5v ends up as 2.5v. Vb = (Vs * R2||Rin) / (R1 + R2||Rin) = (5v * 47K) / (47K + 47K) = 2.5v

Wow, so many calculations, because you probably didn't read/understand the post of MarkT.

Piezo 'ground' is connected to the 1:1 divider, piezo 'hot' is connected to the Arduino pin. The resistor across the piezo eliminates DC on the piezo (== 2.5volt from the divider on the pin), and reduces sensitivity (mainly the lower frequencies). For full specrum, use 1-10Megohm across the piezo. The voltage divider can be any value, and 47k or 100k seems right. Leo..