Finding Peak from anlog sensor

hi , i would like to discuss about my problem so that i could get a solution

i am using a FSR (force resistive sensor) for detecting peaks when maximum force applied on it

So i have connected FSR to analog port of arduino uno , I would like to find the peaks of my analog signal when it exceeds the threshold (900)

then I used a counter to update when the analogread exceed the 900 threshold

but when i squeez FSR for a while the the counter is keep on increment it’s value

for more clear cut idea u can see the attachment , how to make that 12,13,14 peaks as a 1 count

any help would get me a soln :slight_smile:

Here’s the OP’s pic for convenience

06b0b9d4b7ad581e0bbbc950135b99a5a2c1b220.png

Have a look at the StateChangeDetection example: you need to see when the reading has just gone over 900, not that it is over 900.

The example looks for a change in state (ie its just changed high to low or low to high) coupled with it currently being high, which means it's just gone high. Then and only then, increment. Save the current state for the next look. You need to do that at your 900 threshold.

naidu003: So i have connected FSR to analog port of arduino uno , I would like to find the peaks of my analog signal when it exceeds the threshold (900)

If you want to find peaks in analog values series, the first thing you have to watch out for is NOT the absolute values, but the "slope" of the curve and how much the values are rising or falling.

If the slope of the curve created from the values is first positive, then becomes negative ==> you passed a top peak of the curve.

But if the slope of the curve is first negative, then becomes positive ==> you passed a bottom peak of the curve.

So peaks are more about increasing/decreasing slope and NOT so much about absolute values.

What you say is 100% right jurs, but it's a little unclear (to me, anyway) if OP actually means peaks as you describe or if he just wants to know when it goes over the threshold. It reads to me like the latter, and instead of those plateaux each reading as a zillion events, he just wants each to count as one.

But I'm not sure if that's what OP means....