Detecting spike in plotter

Here is an example of what I am trying to detect. Is there anyway to find this 'shape' in code with no visual response.

Thanks

Certainly looks like some values are greater or less than the average value. Does it look that way to you, also?

Yes it does, however, sometimes with the sensors noise is created and I believe it would throw it off, see below.

Well, that looks like your data typically occurs within a range of values…
Maybe filter out invalid values ?

Hi, @jztn
Welcome to the forum.

What is your application?
What is the signal from and what do you want to detect?

We need to know the big picture to advise you better.

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

That would depend on whether the "shape" is repeated. If it is, a cross-correlation function will detect it, by comparing the signal to a previously determined, representative example.

Otherwise, look for a large decrease from the running average.

Better: figure out why the signal is so noisy/erratic and fix the problem.

Have you soldered all the connections, and connected all the grounds?

I think "that shape" is just one of many shapes that could result from the cause. So in order to answer your question properly, we need to know what the signal is, and what the interference is.

Intense averaging might seem to get rid of your problem when it is only "sweeping it under the rug".

we used dual rate leaky integrators to detect speech vs background noise after determining an envelop

this is the basic computation
avg += (samp - avg) * K; // K < 1

after full-wave rectifying the signal, this can be used to perform low-pass filtering. for K = 1/N, the avg approaches the samp value after 3N iterations (e.g. 24 samples for K = 0.125)

this same computation can be used with K having two rates depending if samp > avg. a detector of short term energy might use values of Kattack = 1/8 and Kdecay = 1/32.

for detecting background noise, Kattack = 1024 and Kdecay = 1/8

Hi all,

Thanks for everyone's responses. To give a little more context to the data. I am using three electrodes connected to the body in order to read EMG. I am using a self-made circuit to filter out most of the external noise. I believe that there is still some 60hz noise coming through. The 'shape' i mentioned earlier remains mostly constant with muscle flex, however, occasionally it will vary slightly.

Judging from the posted plot, that could be vastly improved.

Do you have any good references on this?

Yea, I'm in the process of making a second version.
Just wondering if something could be done with software.

sounds like my master's thesis on Abnormal Arrhythmia detection (EKG)

What is your sample rate from the electrodes?

Your graph doesn't show any scales.
I presume the small sine is a result from mains pickup.
You probably have quite some amplification in your circuit as you want to measure small signals.
Before filtering, you should do the max to improve signal quality.
That means: shielding of your signal, prevention of earth loops (also through the body of the person being measured). Maybe a pre amplifier close to the electrodes could help as well.
You could also look at devices in the neighborhood that produce unwanted electrical fields. Those could be moved away...

instrumentation amplifiers are often used in biomedical applications, measuring the output between 2 probes on the body and cancelling common noise

a 60Hz notch filter may be needed

when i did heartbeat detection, a 3-pt peak detector detected the R wave
s [n-2] <= s [n-1] && s [n-1] > s [n]

Hi,
Have you googled;

EMG arduino

It is surprising what is available.
Tom... :smiley: :+1: :coffee: :australia:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.