Hi all, this has been driving me nuts for a while!
Im trying to use a piezo sensor to allow me to get velocity sensitive data coming out my arduino.. I have the piezo connected to analog in, pin 0 and a megaohm resistor across the legs of the piezo between the input and ground.
My first sketch initialised a variable (threshold) and i stated: val = analogRead(piezoOne); if (val >= THRESHOLD) { Serial.print(val, DEC);
and then delayed some time inside that 'if' loop to stop repeated readings. I noticed the numbers i was getting out were seemingly pretty random, though the thresholding worked relatively well. A very hard hit would often register a low val, and consequently a soft hit might have a very high val.
I realise maybe that this is because it is simply throwing out the first value that it samples that is above my threshold. I wanted to find the peak value though, or an indication of relative hit velocity.. Is there a way I could incorporate this well in software on the Arduino?
I looked at a link to todbot: spooky-arduino-projects-4-and-musical-arduino/ which claims to have a hack attempt at measuring velocity of a piezo's hit... but it really didnt work... the t variable did not seem relative to my strike velocity at all!!
Thanks for any advice or comments, all.