Piezo consistency and repeatibility

Hi Everyone !
I'm trying to make a reliable and repeatible shock measurement (not just detection) using arduino Leonardo and a 20mm Piezo transducer (the ones used as a pickup for guitars) And i'm puzzled by its inconsistency. The final application should be a skill based "Hammer Game" where you should apply a given force to reach a selected goal

Yes, I understand "hitting the surface where it is mounted" is not a scientific measure, as each hit may fall on different spots, with different forces and I cannot expect a particular degree of reliability, So I'm broadly asking, what you think is the best approach: multiple piezos and get an average / capacitors to "slow down" the voltage peak, and measure it more reliably, or even, a whole different kind of sensor.
I also tried with load cells, but they are not fast enough to detect and measure an impact.

In my code, not that you may need it, I just measure the peak value, and return it to the game, as soon as the piezo returns ~0 again

Thank you for your ideas !

Use an accelerometer chip?

Hi, thanks for your reply jhaine,
is the accelerometer in rest position, reliably "still" ? or should I also account for noisy readings ?
Anyway, I'll try that road also, thanks !

There is I believe standard software to correct for zero drift. Actually in the vertical direction the "rest" acceleration is 9.81m/s/s but it's constant.

Your phone will have a 3-axis accelerometer + gyro built in.

Are you sure that it's the sensor itself that's inconsistent?

How have you proven that both the impulse you're applying and your measurement technique are entirely consistent/repeatable?

the measurement is the analog value plotted, the impact, as I stated, it is not scientifically generated or accurate: I knock 10 times hard, and I don't get 10 consistent values, but rather, about 8/10 return a reading "consistent" with my hit

I'd say that's almost certainly down to the fact that your "knocks" are not consistent.

You need to set up a consistent input!

Are you sure you have a sufficient sampling rate?

Yes, as I stated I'm not attempting to measure the actual force in Newtons, of the impact, I'm more focused on obtaining a consistent measure of the force being applied.

I think now I do, I'm using a 50v 1u capacitor in parallel with a 1K resistor with the piezo, and the peaks i plot, are way smoother, so I assume the sampling rate gets slowed down acceptably.
But i'm open to suggestion on improving / changing the circuit

Again, if the force is not consistent then you're never going to get a consistent measurement!

I strongly suspect this is the root of your "issue".

That has nothing to do with sampling rate - that's in the analogue domain.

Adding capacitance will slow down the response - that's the opposite of what you want to capture the peaks!

How are you applying the consistent impact force?
What is your test assembly?

Are you dropping a weight on it from a fixed height?

Please, how are you ensuring constant repetitive applications of test impacts?

Thanks.. Tom... :smiley: :+1: :coffee: :australia:

1 Like

I don't think (s)he is!

I suspect also direction & location of impact are inconsistent.

Can you show a picture or a link to a product page

1 Like

Thank you for your feedback, just to be more clear about my application and what is the issue, here are a few clarifications.
I'm well aware that tapping with my finger ten times on a disc, is by no means scientifically accurate. Not even dropping a pen repeatedly from the "same" distance is. Or sticking the piezo on a surface, and hitting that surface around the same area.
I know, and since I've been reading a good amount of topics on this forum, about piezo being used as a sensor, the complexity of the forces at work during an impact, isn't something i expect to magically "measure".
Not with a .30$ sensor, and a trivial max peak detection sketch.

It may be so fast, that it could happen between two clock cycles of he MCU, and not being recorded at all: like blinking your eyes exactly when a very fast car passes by. This is why i tried using a capacitor to "slow" it down. And it seems that i'm not missing reads, but please elaborate if you think it messes the reads in other ways.

But taken all of this into account, I'm trying to settle for a fair degree of precision: after all we have 1024 values, and it should be normal to expect that hitting the piezo hard 10 times, should yield 10 times 1023, but it doesn't. Let's not get into hitting it softly and expecting ~200 all the times, because I understand is way more complex generating a consistent input.
What I'm really asking, besides suggestions out of the box, is if is there any limitation on the hardware, both Arduino and piezo/piezo and capacitor, rather than only on the mechanical input side.
Thank you for your time :slight_smile:

I don't think those cheap 20mm piezo elements can withstand hard impacts without being damaged.

That would be my guess... You are only reading/sampling for one "instant" every time through the loop. Most of the time it's NOT reading!

There is an op-amp circuit called a Peak Detector. It charges a capacitor to the peak voltage quickly and the capacitor discharges more slowly.

I use peak detectors "all the time" with audio to get the "loudness". I can read at about 10 times per second instead of thousands of times per second, freeing-up the processor to do other things between reads.

Like most analog op-amp circuits it works best with positive & negative power supplies so it can do all the way down to zero, but a "rail-to-rail" op amp with a single supply will probably work fine in your application.

Or if you have enough signal voltage you can simply put a diode in front of your R-C circuit. Again it will charge faster than it discharges so you can have more time to read the voltage. But there is a ~0.7V drop across the diode so you need at-least about 1V before you get any useful readings.

Not between two clock cycles of the MCU, but possibly between two samples of the ADC - hence the question about what sampling rate you are using.

No, that doesn't make sense: you've just said that each of those 10 hits is going to be different.

Perhaps your thinking of averaging of 10 hits?
That would tend to smooth-out random variations...

You really haven't given much detail of your hardware to be able to comment.

Please post your schematic, details of the sensor you're using (as @jim-p requested), and some photos of the setup.

How do you ensure that the sensor's output is within the ADC's range?

I would not expect such a result.

I would run a significant number of experiments and from the results, form an opinion about the "typical" result and variations from typical, then proceed with that information.

Piezo devices normally generate hundreds of volts when struck. Does your device have some voltage limiting built into it?

That wouldn't be the case with one "used as a pickup for guitars", surely?! :flushed:

@vittoriofaella has already been asked more than once to supply details of this "pickup" - and the setup it is being used in ...

I suspect the accompanying audio amp takes care of that. Or the piezo is made with built-in limiting which is the OP's problem!