I'm using 1mOhm resistor in parallel to a piezo that is connected to analog1 pin on the Due,
and the following code to observe the readings in the serial monitor:
int piezo = A0;
int threshold = 200;//anything over 200 means I've hit the piezo
//this part checks if the threshold has been reached and then writes the strenght of the signal
int piezoVal = analogRead(piezo);
delay(10); //delay is used to prevent from getting multiple values one after another, usually 3-4
The things that bother me are:
if I do not use threshold, then I am constantly getting readings from the piezo, even if the threshold is slightly below 200.
if I do not use delay, then I'm getting getting multiple values one after another
and the strangest thing is while I hit the mouse pad that covers the piezo, the readings in the serial monitor are not matching the force being used to trigger the piezo. Sometimes they stay the same, sometimes they reach 6-700 after I directly touch the piezo, sometimes I hit really hard and I only get some slight increase (for ex. from 225 to 229).
This doesn't make sense to me. I think the stronger the vibration, the higher the values should be. Cause I've tried with two different piezos and different resistors (1mOhm, 1.2 mOhm and 1.5 mOhm) and I'm still getting the same result. I bought the Due few days ago in order to build a drum kit, and I have no problem with sending midi notes to a DAW, but this piezo sensitivity thing is driving me crazy. Any suggestions?