Piezo sensor sensitivity.

I have common disc type piezo sensor/transducer placed on the floor. While I get good output from the piezo with direct hit with my fingernail I need much more sensitivity for the project I am working on. I need it to pick up steps from 2-3m away along with steps next to it. I hoped to get reading in lesser numbers when further away and higher when near.

I have connected (+)red-wire to Arduino analog pin (-)black-wire ground parallel with 1Mohm resistor, 5v zener and small capasitor(47pf?).
Does the way I wire it to Arduino have much to do with sensitivity of the piezo? If I read the piezo output with Arduino serial monitor from 0-1023 I get values around 300 most of the time. And these are direct hits.
So I wonder what there is to do in order to increase or control the sensitivity of a piezo.
BTW I looked into electret mics as well, but these seem to pick up too much ambient unwanted noises. This is from my experience with sound recording. So maybe for this application this may not be the issue.

The difference between physically tapping directly on the piezo sensor and picking up footsteps a few meters away is many magnitudes of difference.

What you need is good physical contact with the floor, and some lowpass filtering.

My experience with piezo disks suggests that they are not sensitive enough to pick up footsteps through a typical floor and certainly not through the air. However, I've been able to detect if someone walks on a metal plate to which the piezo disk is firmly attached.

I am working on a dance performance, where dancers are hitting the floor pretty hard - kind of flamenco or stepping. So far I had kind of drum pad(self constructed) weighted to the floor with 100g disk. Piezo signal goes to lineIN on my mixer and gets some special effects added. It worked rather well - distant steps were lower volume and closer ones louder.
Now I plan to add ability to change the pitch of a sound(note) depending of the distance and volume of the step with the help of Arduino and MIDI.
So farI had good experience with the sensitivity of the piezo and I am a bit puzzled with the difficulties now. Maybe I should amplify the piezo and use audio as an input to Arduino instead.

Maybe this Piezo Vibration Sensor has the sensitivity your looking for.

OK, I shall try this. Do you wire it to Arduino the same way(resistor, zener, cap)?

Yup, also check out that product line before you buy, as there is a larger one.

After I ran the show with electret mic instead I got another idea. Mic needed to be amplified, but it was a pain to isolate it from ambient and stray sounds. So I am back to piezo, but with these we have the problem of piezo characteristics. When it picks up a knock/thump it will ring like a bell. Thus Arduino will read something like this; 1000, 800, 600, 300, 100, 50, 50, 50 in 10ms interval. For me everything but the highest read would be unwanted. So I need just one read per knock.
What do you think - can I achieve this by running piezo through amplifier that the signal is not decaying voltage any more, but more similar to mic signal?
Do you know any good amp schematics to amplify piezo?

If you want to set the minimum knock/thump that's sensed to trigger your required action, then in your sketch add a check like this:

int piezoPin = A1;

void setup()
{
  pinMode(piezoPin, INPUT);

}

void loop()
{
  int knock = analogRead(piezoPin);
  if(knock >= 1000) // change 1000 to the minimum knock/thump value that you need to react to
  {
    //perform action in response to knock/thump
  }

}

If you have a range that you want to react to, you can use an "if" statement like this:

if(knock > 500 && knock < 1000 ) // change knock/thump range values to what you need to react to
  {
    //perform action in response to knock/thump
  }

Thank you for the idea. Actually I use threshold already to eliminate very low readings.
But it would cause another problem. The loudest knock is not the maximum value every time. The idea is to control the pitch of a MIDI note with the reading from analog input. The stronger the input the higher the note. So I can not limit the readings to given number. Also I can not set the range too narrow so I would miss the lower/distant knocks.
So far all the testing of sensors and experimentation with the code(not too sophisticated ones) have lead to conclusion: mic/audio will be read as one single input while piezo as series of decaying inputs. Thus my thought to take piezo input and convert it to sound before feeding into Arduino.

I found this schematics on the web. Would this be good one. I do not have NPN transistors at hand right now to try it out.

bjtschematic.png

One thing here, " lower/distant knocks" are different situations.
Lower can mean standing right over the piezo and tapping foot lightly.
Distance could mean standing in entrance of room slamming or tapping foot on floor, compared to standing 1 foot from device doing the same.
How to tell if it is just a lower knock? Or if it is a knock of distance?
For distance maybe 2 or more piezos a distance apart, compare the readings, difference of readings give distance from primary piezo pickup.
Do you have a link to the info of the circuit you posted?
Maybe you could condition the piezo signal like described here, gives one nice pulse.

Thanks again looking into this. Your analysis is good one. However this is not the problem I am dealing with. And I looked into piezo conditioning earlier and found it not relevant at the moment.
It does not matter where in the space the knock is made - as long The Arduino can read higher and lower values from the sensor. That part functions without a problem.
My difficulty is with the characteristics of the piezo sound as I described few posts back.

Amplify and send the AC to a rectifier. Then you just get a single pulse with a fast rise time and a decay.

Can I get pointers to some good amp drawings. How about the one I found earlier?
Or this mic amp would be better.

biasinp.jpg

I tried this to amplify the "knock" a piezo picked up:
5.1v zener in parallel with piezo + 1N5819 in series > 1M ohm & 4.7nf cap in parallel> LM386 amp module 5V > speaker 8 ohm 1/2 watt
P++++5.1++1N5819+++1M++4.7+++++L++++++/ |
i z O N M /S |
e e H F 3 | P >
z n M | 8 \K |
o-Gnd-|----------------|-----|-------6--------\ |
It amplified the signal just fine, could here it through the speaker but the tones produced from the piezo are very low.
I used the conditioner setup described by Alan Burlison from the comments of the link I posted earlier.
It really cleans up the piezo pulse no "ring like a bell" effect as you described earlier, it produces a signal from a few mV to 5.2V depending on "knock" intensity.

Thank you again!
I tested the circuit given on the piezo conditioning page you linked. This did not work somehow. I got erratic notes and most of the time nothing. I then modified the circuit a bit moving zener to first position parallel before series diode. It does work rather good.
I do not have the parts at hand to try yours.
I added averaging of 10 readings to the code as well that would do the similar effect as the conditioning circuit.

#include <MIDI.h>
byte note = 0;
byte c = 1; //MIDI channel
byte d = 3; //MIDI channel offset

const int piezo = 0;  // the piezo is connected to analog pin 0
long randNumber;

int record[10] = {0,0,0,0,0,0,0,0,0,0}; //record 10 readings in a row
int record_max;  //max of 10 recordings
int a=0;
int i=0;
int b=32;        //lowest note allowed to play

void setup() {
 
  Serial.begin(31250); // use the midi port
 
 

 
}

void loop()  {
    a = analogRead(piezo);
     for(int i=0; i < 10; i++) 
    {
    record[i] = analogRead(piezo);   // read the input pin
    if(record[i] > record_max)
    {
      record_max = record[i];
    }
    }
    a = record_max;                 // record max
    record_max = 0;

    a = map(a, 0, 1024, b, 122);    //map recorded max to lowest and highest note
    randNumber = random(1, 8);      //generate random number 1-8
   if (a > 32 + randNumber)         //add random number to the lowest note to make it more interesting
   
 { MIDI.sendNoteOn(a,127,c);        //send note and note off
 delay(50);
  MIDI.sendNoteOff(a,0,c);
  delay(50);       


  }
 
}

What do you think of the circuits. I am pretty dumb with understanding electronics.

piezo_circuit.png

piezo_circuit_mod.png

Glad to hear it's doing what you want.
That circuit is open to modifications depending on the piezo used.
I tried 4 different piezos and had to modify the circuit for each one to get a clean pulse.
As the author states "Be warned that piezo are all differents, and that size matters… So experiment with that before engraving the above stuff in copper."
The way you have the circuit is fine, actually better if you are using the BAT85 diodes or any diode rated under 200V VRRM.
If you read the comments of that link Alan Burlison advises putting the zener in parallel first to protect the BAT85 diodes from over voltage. He also says the second diode isn't needed, I only found that to work with one of the piezos I tested.
So the circuit you used does this: Zener only allows 5.1xx volts to pass, diodes rectify to positive only voltage, RC filter cleans pulse.
editIn each test I checked the output using an oscilloscope to make sure it was a cleaned up pulse.
Were you able to test with an oscilloscope?

elac:
5.1v zener in parallel with piezo + 1N5819 in series > 1M ohm & 4.7nf cap in parallel> LM386 amp module 5V > speaker 8 ohm 1/2 watt
P++++5.1++1N5819+++1M++4.7+++++L++++++/ |
i z O N M /S |
e e H F 3 | P >
z n M | 8 \K |
o-Gnd-|----------------|-----|-------6--------\ |

Could you, please elaborate how do you connect the opamp(what pins where)

And it becomes apparent that depending of the room(floor where the sensor is placed) the piezo sensitivity will vary a lot. So I need some kind of physical control to calibrate the setup(it would not be possible to use computer) - like a pot in the wiring.
Something like this maybe >>>

LM386 AMP.png

I used a LM386 amp module like this one.
If you are planning on using a speaker and don't have the above module then connect the LM386 chip like the circuit shows here.
If you plan on feeding the signal to an analog pin then use a LM358 like in the circuits described here .

After the initial performance where the setup worked pretty well

I am developing the stuff further. Thanks elac!
My goal is to have as clear as possible correlation between the force of a hit and the high of a note. I have been messing with the code trying to clear up the un-wanted notes. So far it has not been too successful. So I came back to the question of piezo and its characteristics. And it appears that my electronic conditioning is far from perfect. Since a do not have access to an oscilloscope I finally recorded the piezo hit and looked at the waveform.
As seen on the attachment I do have eliminated neg values OK, but anything else is not looking good at all. So it is clear that my difficulties with coding come from this. Look at the discussion about the code:
http://forum.arduino.cc/index.php?topic=211968.0
I have piezo wired as the posted above. So I need some guidance how to do things different.
Again I started with this information
http://leucos.lstilde.org/wp/2009/06/piezo-transducer-signal-conditioning/

piezo.png