# Determine Sampling

#### jgauthier

Mar 22, 2013
63
I have two scenarios, and I am trying to figure out appropriate sampling for these scenarios.

First scenario is a piece of equipment with an accelerometer on it. The piece of equipment is going to be activated suddenly and travel at 20ft/s for 21ms. It will also stop suddenly. I want to capture the data before and after the travel (but only a small window)
How should I calculate the sampling rate for the accelerometer?

Second one is very similar. I have an object with an IMU on it. The object will be thrown (tethered IMU) and is expected to spin/rotate etc. We want to capture the data of this for the duration of 150ms.

Same question: How should I determine the sampling frequency for this device?

Last edited:

#### Harald Kapp

##### Moderator
Moderator
Nov 17, 2011
13,767
The piece of equipment is going to be activated suddenly
How sudden is suddenly?

One could tackle this scientifically: Make a Fourier analysis if the signal to be measured (acceleration), then determine the highest relevant frequency component fmax from the Fourier analysis. Then set the sampling frequency to >= 2 × fmax.
Sounds practical? It doesn't.

The pragmatic approach I'd choose:
If you want to catch the moments when acceleration starts and stops, your sampling interval should be shorter than the time it takes to accelerate from 0 to max and to decelerate from max to 0.

Second one is very similar. I have an object with an IMU on it. The object will be thrown (tethered IMU) and is expected to spin/rotate etc. We want to capture the data of this for the duration of 150ms.
Duration is not the relevant parameter. Sampling has to be done faster than the max. frequency to be measured to avoid aliasing.

#### jgauthier

Mar 22, 2013
63
Thanks for your responses. These are the challenges I am trying to solve exactly. So, I appreciate your advice.
When I say "suddenly" I mean there will be an immediate 100G force applied to the object. My coworkers suggested using the first order filter system of Tr = 0.35/Fc. Thus getting 25Hz, and suggested sampling at 100Hz. However, at 100Hz, it's possible to only obtain 1 or 2 samples of the travel time (14ms) and I don't "feel" that is sufficient. (feeling is not quantitative at all). Which would not capture both the start and end of acceleration. I used the argument that if we sampled at 1Khz, we would capture 14 data points of the travel, 1 per ms. His response is that it doesn't make sense. we don't need "that much" data and it's not justifiable. - I think I need to go back to the mechanical designer and ask what he wants to capture - then make the decision from there.

As for the IMU problem, the only data I have is duration. For instance, I don't know how to correlate the duration to a frequency. I'm being asked to justify/implement data collection from the IMU but I am not sure what data rate to even consider without knowing the behavior of the object other than that it will will pitch, might roll. IMUs are fast - the one I am using can provide an output data rate anywhere from 100-6000Hz. But choosing frequency without any more information seems.. well like guesswork. I would like to back that guess work up some.

#### crutschow

May 7, 2021
857
What is the maximum frequency rating of the accelerometer?
I would sample at more that twice that frequency.

#### Nanren888

Nov 8, 2015
622
Sampling has to be done faster than the max. frequency to be measured to avoid aliasing.
.. here read as sampling frequency of twice the max frequency, as in the text.

#### Nanren888

Nov 8, 2015
622
Why?
What's it for?
If you really can't estimate the movement that you want to caprure & hence the maximum freiqnecyof interet, then , consider a model, ...
One approach is to model it a little. Say we simulate the systems and use a very high sample rate. Then we filter the samples, down to lower sample rates to simulate having used lower samplign rates. As above, this is similar to the spectrum approach.
But, you could plot the curve taken, the movement, whatever you are doing this for and look at the waveform you expect.
The simulated lower sample rates will create distortion of this waveform. When the rate causes distortion that is objectionable to whatever the purpose it, then it's too low.
In other words, tailor the rate to what you want from it and if you stil can't estimate form that, simulate it & check the effect.

#### Harald Kapp

##### Moderator
Moderator
Nov 17, 2011
13,767
My coworkers suggested using the first order filter system of Tr = 0.35/Fc.
His response is that it doesn't make sense. we don't need "that much" data and it's not justifiable.
YOu can always discard data you "don't need", but you can't gather data after the fact. If you have enough memory available, better sample more and process later.
Another option is to sample fast, but not to store every data point. Store only data points if the sampled data is sufficiently different from the last data point, then store value and timestamp (sample time) as a data pair. Thus you can reconstruct the signal without having to store data for times when no change occurs. It's a bit similar to run-length encoding to save memory.

I don't know how to correlate the duration to a frequency.
You can't. At least not in a clearly defined way. When you consider the throw of the object as a single event - at least justifiable if the time between throws is much longer than the duration of the flight, then a Laplace analysis will give you an infinite range of frequencies, which is clearly impractical.
You may treat the throw as a repetitive event, assuming for simplicity's sake the same duration for flight and non-flight phases (even if in practice it isn't exactly so as non-flight phases will, I assume, be longer than flight phases). You then have a repetitive event with a total duration of Ttot = Tflight + Tnon-flight = 2 × flight = 300 ms. This results in a fundamental frequency of f = 1/Ttot = 3.33 Hz. Assuming you want to catch up to say the 100th harmonic, the upper "cutoff" frequency (at least with respect to your measurements) would be 333 Hz which requires a sampling frequency of at least 666 Hz (NyquistShannon sampling theorem). The problem here is, however, that the object under inspection may and likely will tumble much faster than at 3.33 Hz during flight. If it, for example, rotates only 10 times during the flight, then one rotation takes 15 ms and the above calculation leads to an upper cutoff frequency of 3.33 kHz. You do the math for faster rotations...

Replies
7
Views
148
Replies
3
Views
596
Replies
4
Views
1K
Replies
5
Views
2K
Replies
6
Views
1K