Envelope Detection

Go To Last Post
31 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Greetings Freaks -

 

I don't have an instantaneous application for this, so it is more "academic" than practical. But, I CAN see a potential  application in my accelerometers, so there is some real-world, here. Thus, it is NOT a troll, but a sincere question.

 

Suppose that you have a "signal" which consists of a high frequency component, a low frequency amplitude modulation of the high frequency component, and maybe quite a bit of noise. For data reduction, and because it is what the situation calls for, I want to store the "envelope" rather than the point-by-point digitization of the combined signal in real time. 

 

The question is: How to do this with the limited power of a non-DSP  micro (assuming that all of the sample rates, etc, are within the capability of what-ever chip is chosen)?

 

For example, suppose that I have sequential samples Xm and Xn. Lets further suppose that the values of X have been increasing for several samples, up to Xm. Now, Xn is less than Xm. Is Xm a peak that represents a point on the envelope? Or, is Xn just a momentary noisy deviation, only to be followed by a sample that is larger than Xm? You can't know at sample n because you cannot "see" the future.

 

So, it would seem like you have to evaluate over some extended interval. Maybe you evaluate over a an interval that is a bit longer than the expected period of the high frequency component and look for the maximum and minimum within that interval? Or, maybe that is not such a good test and maybe there is something better? Or., maybe its not such a good test, but it is as good as it gets? If that is an appropriate test, should the interval be a running interval or should it be in sequential blocks? 

 

At this point, I am wondering if anyone, here, has tried to implement something like this? Or, has anyone tried some other method? If so, what were your experiences?

 

Many thanks

Jim

 

 

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Sat. Apr 18, 2020 - 06:55 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1


So we're talking, in analogue radio terms, AM demodulation?

 

 

It feels like each element of that circuit should be fairly easy to model in software.

 

This is quite a nice explanation...

 

https://sam-koblenski.blogspot.c...

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Brian Fairchild wrote:
So we're talking, in analogue radio terms, AM demodulation?

Exactly what I was thinking!  Thanks for the link!

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

Last Edited: Sat. Apr 18, 2020 - 08:11 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, and that may be a good way to think of it. A peak capture with decay toward zero (well, actually, the signal median). 

 

Thanks

 

Jim

 

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Brian Fairchild wrote:

So we're talking, in analogue radio terms, AM demodulation?

 

 

It feels like each element of that circuit should be fairly easy to model in software.

 

This is quite a nice explanation...

 

https://sam-koblenski.blogspot.c...

Nice find, and ties in neatly with something I'm trying to sort out ATM.

Four legs good, two legs bad, three legs stable.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If your AM is actually an ASK stream - then you might be able to use the comparator to sync to the carrier and then and ADC to sample the peak.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A slightly different approach is to use Downsampling.

Note that this is a two step process to prevent higher freq components from aliasing into the signal.

 

Essentially one LPF's the signal and then decimates, (Keeps every Nth sample), the signal.

 

As you likely have some real world data from your accelerometers it would be relatively easy to generate a series of graphs in excel or whatever, based on a family of curves for different LPF cutoff frequencies, and for various decimation integer values, (Keep every sample, (The original (albeit LPF'd) signal, keep every other sample, (50% compression), keep every Xth sample, …)

 

Wiki Downsampling explains it better than I.

 

JC 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Good ideas!

 

Signal is likely to be semi-random "noise" with the amplitude being the significant measured quantity.

 

Thanks

Jim

 

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't think this applies in your case, but if you are generating one or part of the signals (and picking up a to-be-measured response), then you have critical information that can be put to use in enhancing the detected response.

This would be an "in-phase" , "coherent" , "synchronous",  "lock-in" or other such named type of operation.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It seems to me that all of it is best done in hardware,

especially the high frequency noise elimination.

Of course, if all frequencies are low enough,

it can all be done in software.

That said, ADC takes a lot longer than a CP cycle.

Moderation in all things. -- ancient proverb

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Think of "carrier" bandwidths UNDER 100Hz. Sometimes under 10Hz. "Carrier" in this case is noise picked up from the ground that I expect to increase when a vehicle or train goes by. Experiments come very soon. The digitizing is done IN the sensor. I just read the data as it is generated.

 

Jim

 

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Sun. Apr 19, 2020 - 05:59 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Absent noise, you would just need to record the local extremes in the data.

The real issue is how to detect noise spikes and what to do about them.

Moderation in all things. -- ancient proverb

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

See edits in #11. Sorry.

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Per Brian's post above: it's a peak detector with a suitable decay constant. I've done this a number of times;

- with a variable K, start with K = 0

- for each sample: if the absolute value is greater than K, store it in K

- decay K by some suitable value: this depends on the time constant you need, but 1/16, 1/256, or other factors of 2 are easy to implement with shift and subtraction.

 

If you're doing something like an audio peak power meter, you might need as much as 1/32k or more; you may be looking in a similar range for your application.

 

Tip: things like this are a doddle to simulate in Excel/Libre Office spreadsheets, if you have the initial data available in some handy .csv format...

 

Neil

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

Suppose that you have a "signal" which consists of a high frequency component, a low frequency amplitude modulation of the high frequency component, and maybe quite a bit of noise. For data reduction, and because it is what the situation calls for, I want to store the "envelope" rather than the point-by-point digitization of the combined signal in real time. 

One critical piece of info missing seems to be the relative levels of each portion...which is larger & by how much 1.3x?  2x? 10x? 100x?   That can change the whole ball game strategy, since ultimately (assuming) you want the signal.  

 

The top shows the high freq ampltude much smaller than the low freq mod, the other is an opposite example; the high freq is amplitude is much larger 

 

Also, you mention envelope......sounds like you want to store the "top edge", though you could store the "centerline" as the wave goes up & down.

 

 

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Sun. Apr 19, 2020 - 03:28 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And I will add to #15:

We need to know what your " high frequency component " is compared to the speed of your ADC ? (you say non-DSP but a peak meter could be better than a real LPF).

 

Will this be AC coupled or will the be a DC component ?

 

Add:

and how constant is "the high frequency component" perhaps sampling in sync could be used.

 

perhaps have two (or more) comperator timers. that way no ADC is needed, and the time will give a "picture" of the envelope 

 

Add:

Perhaps a delta tracker is all you need , like if ADC>100 add 100 else -1.  

 

 

 

Last Edited: Sun. Apr 19, 2020 - 12:47 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

Here is one where the high freq is 5x of the low, with an amplitude 0.3 vs 1 & a phase shift of 2 rads (it just scoots the little warbles around up or down the long line)

 

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Sun. Apr 19, 2020 - 03:40 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

What helps a lot in this case, where there is a separation in the frequency of interest and the noise in the signal, is that one can LPF or BPF the signal, in hardware or in software, and attenuate / eliminate the noise, and be left with the desired signal.

 

JC 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What I am going to look at is vibration transmitted through the ground from moving vehicles or trains. Think of just off the gravel bed of the train track or in a ditch next to a paved country road. 

 

I want to track the noise amplitude with time. From similar "recordings" IN a vehicle, it looks pretty random. I guess that the noise bandwidth is 10X or more higher than the envelope bandwidth. The sensor is an accelerometer with built-in digitizing (its really something like a delta-sigma ADC inside). 

 

The sensor has a built-in anti-alias filter. I set it to 250Hz with a 100Hz sample rate. The filter bandwidth is higher than I want, but the next lower setting is something like 25Hz. I down-sample by block averaging (average 4 samples to get 25Hz sample rate or 10 samples to get 10Hz sample rate). This also provides filtering consistent with the sample rate, though I do expect some higher frequency noise to be aliased down into the pass-band because the internal filter is so much higher than the sample rate.

 

In any case, what I THINK is important in this experiment is the noise amplitude. I could try an RMS computation (on the raw data) post experiment, but that would never fly in real time. So, what I am looking for is a method that can be applied in real time at the equivalent of a few Hertz envelope sample rate.

 

That is what this is all about.

 

Thanks

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If I understand correctly,

the envelope data are a subset of the local extreme data.

Picking all local extremes might get more than you want.

 

You might try something like this:

Declare x[j] to be in the envelope iff it is an extreme of x[j-w] through x[j+w].

w is a parameter of the formula.

 

Another possibility is to consider all local extremes.

If a local min is too close to a local max,

remove both of them.

"too close" is a parameter of the formula.

Moderation in all things. -- ancient proverb

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ka7ehk wrote:

What I am going to look at is vibration transmitted through the ground from moving vehicles or trains. Think of just off the gravel bed of the train track or in a ditch next to a paved country road. 

What's the motivation for filtering this out?  Is it to reduce power consumption by writing less data to the SD card?  Have you done a cost/benefit analysis of what this would buy you in terms of battery life?

 

I would suggest that you leave any of this filtering for after-the-fact, on whatever platform you're going to use for data analysis.  IMO it's always better to log >>more<< data, not less.  Any techniques which you could apply locally on your logger can be equally applied at a later stage.  Arguably, with greater fidelity than can be done on the logger itself with its limited compute resources.

 

Think of astronomy and planetary science.  Very little post-acquisition processing is done on the devices which do the acquisition.  Much useful information can be gathered from what might initially be dismissed as noise, only later to be revealed as important.

 

In your case, if you're thinking about filtering out ground vibration so that only the tree-sway signal is left, consider that ground vibrations might be useful in a forensic investigation, or a traffic study, or... probably lots of other applications for the raw data.  Might open up new markets for your logger!

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This isn't about tree sway. Its another possible instrument application area.

 

Yes, I am more than familiar with "more data is never enough". Ultimate target is "vehicle counting" (if it works).

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I want to track the noise amplitude with time

Wy do you want to "track" it?  Do you hope to remove it from the vibration measurement?  I assume the vibration is considered periodic, and corrupted by this "noise".  Do you ultimately want to measure this vibration level?

 

Have you looked at a Kalman filter---it seems possibly useful for this application, though it may be overly complex.

https://www.codeproject.com/Articles/326657/KalmanDemo

 

https://www.researchgate.net/publication/267803648_ACCELEROMETERS_USABILITY_FOR_DANGER_TILT_OFF-HIGHWAY_VEHICLES_AND_SIGNAL_FILTRATION_WITH_KALMAN_FILTER

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

NASA's now retired Kepler Space Telescope is the mission that keeps on giving. On Wednesday, NASA announced the discovery of what might be a very Earth-like exoplanet found lurking in old Kepler data.

Kepler ran out of fuel and went to sleep in 2018, but scientists are still combing through the observations it made during its epic hunt for planets beyond our own solar system.

 

https://www.cnet.com/news/nasa-discovery-of-planet-remarkably-like-our-own-gives-hope-for-second-earth/

 

 

Over the next few hours, Voyager 2 flew within 50,600 miles (81,433 kilometers) of Uranus’ cloud tops, collecting data that revealed two new rings, 11 new moons and temperatures below minus 353 degrees Fahrenheit (minus 214 degrees Celsius). The dataset is still the only up-close measurements we have ever made of the planet.

 

Three decades later, scientists reinspecting that data found one more secret.

 

Unbeknownst to the entire space physics community, 34 years ago Voyager 2 flew through a plasmoid, a giant magnetic bubble that may have been whisking Uranus’s atmosphere out to space. The finding, reported in Geophysical Research Letters, raises new questions about the planet’s one-of-a-kind magnetic environment.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Sun. Apr 19, 2020 - 05:22 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for that link to Kalman filter application. Need to read it over, for sure.

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

you might like this---although it is something different:

 

Vehicle Counting and Moving Direction Identification Based on Small-Aperture Microphone Array

https://www.mdpi.com/1424-8220/17/5/1089/htm

 

Monitoring Traffic Information with a Developed Acceleration Sensing Node--- an acceleration sensing node for pavement vibration was developed to monitor traffic information, including vehicle speed, vehicle types, and traffic flow, where a hardware design with low energy consumption and node encapsulation could be accomplished. The service performance of the sensing node was evaluated, by methods including waterproof test, compression test, sensing performance analysis, and comparison test. The results demonstrate that the sensing node is low in energy consumption, high in strength, IPX8 waterproof, and high in sensitivity and resolution

https://www.mdpi.com/1424-8220/17/12/2817/htm

 

 

S. Taghvaeeyan and R. Rajamani, "Portable roadside sensors for vehicle counting, classification and speed measurement,"IEEE Transactions on Intelligent Transportation Systems, vol. 15, no. 1, pp. 73-83, Feb, 2014

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

THAT is interesting.

 

Thanks

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It's not clear to me if the carrier frequency is known or not.  If so, and you want to get the amplitude in the presence of noise, then one option is a matched filter.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In fact, there is no carrier in the traditional sense. The noise IS the high frequency component. What I think will be important is the Peak (or Peak-Peak, or maybe RMS) amplitude of the noise. Peak-Peak is nice because you don't have to determine the mean.

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Sun. Apr 19, 2020 - 10:24 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK.  I'm trying to get my hands around a model for the measured signal.   Are you saying your measurement looks like a(t)*n(t) where a(t) is the source signal you you wish to extract and n is noise with high frequency characteristic (i.e., power spectral density is big for large frequencies)?   I think you will have more luck finding algorithms if this can be modeled as signal + noise.  Hence, I'm digging into the characterization of the measured signal.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, that is a plausible model. Not sure of the noise spectrum though I would expect it to start falling somewhat below Fsample/2 (just from the nature of block averaging). The highest sample rate that is physically available is 25Hz which comes from 100Hz samples, averaged in blocks of 4. 

 

I would expect a(t) to have a bandwidth of a few Hertz, if that (imagine a car driving by at 50 mph or so on a hard but somewhat rough surface - more rough than good asphalt, not nearly as rough as a gravel road). 

 

Will have more data when the first experiment is done in a few days.

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Mon. Apr 20, 2020 - 02:11 AM