Hello! I have an Arduino GSM MKR 1400, and a sparkfun LIS3DH. I would like to be able to measure the vibrations of industrial equipment, with the goal of creating a dataset to use for predictive maintenance.

I've been working on it, and I am able to use the Arduino to output values from the accelerometer, and send it over 3g to azure blob storage. Now, I am trying to tune what I've written to ensure I can get sensible readings out of it.

Could someone help me understand how often I would need to take a sample (every quarter second? tenth a second? F=1/t, right? I'm not sure how accurate I should be aiming). You can choose a lot of different settings on the accelerometer too (max of 4/8/16G, different values for Hz..), how will they effect my performance? I'm a little unsure how to choose decent values, if someone could help that would be much appreciated.

ps, for some more complexity, the amount of reads I take will have to be balanced by the storage capacity of the arduino, the battery life of my lipo, and the number of calls I want to make to the GSM component.

No simple answer to that question without knowing more about what you are measuring.

According to Shannon's theorem, to avoid aliasing, one must sample at least twice the frequency of the highest frequency in the signal* (Nyquist rate). This is especially important if the data is in the frequency domain.

The other thing you need to know is that the accelerometer can be use to measure vibrations with highest frequency equal to half the maximum ODR (output data rate), which you can look up in the data sheet.

Any vibrations at higher frequency will confuse the readings, possibly to the point of making them impossible to interpret.

I did a study of this and you will find some examples here

If you are doing this for preventive maintenance you will need to look at the wave shape, to at least the third harmonic of the fundamental.

It would depend on the REASON for the vibration. Industrial motors often run at 3krpm = 60 rev /sec so to detect shaft imbalance or similar you would want to sample above 60 * 2 *3 = > 400 samples / sec.

only if you need to store a lot of values. You can do a statistical analysis of the data in real time and just display those values, and a "history"; you may not need to display a wave shape.

Actually its more than twice the signal frequency (loads of people get this wrong). This is all moot really as in practice 3 times or better is needed for realistic use.

What frequencies are the vibrations - whatever is the highest frequency of interest I'd sample at least 2.5 to 3 times as fast, then take the FFT, and then analyze the peaks. If you log the top few peaks that ought to be fairly useful data (without being too voluminous). You might not need to log the peaks very often, if they are fairly constant over time, as you are interested in long-term trends I think.

Most vibration happens in the 5 to 500Hz range I suspect, but of course I don't know what equipment you are instrumenting.

The key specifications of an accelerometer is its frequency response and sensitivity - again without knowing the vibrations in particular all I can say is make sure these are adequate to the actual situation.

No. If you sample a 10kHz signal at 20kSPS and happen to just see the zero-crossings you have no information on the signal - you can't tell its amplitude or if its even present...

The gotcha is that often the theorem is given in terms of absolutely integrable functions (of finite duration, basically), which is equivalent to saying you have sampled the entire signal from beginning to end - you can't have a 10kHz-only signal of finite duration as its notionally an infinitely repeating thing.

The finite-duration <= 10kHz signals that sample to all zeros must necessarily be the zero signal, but in the real world we don't care about the entire history of a signal, we look at part of it, and a 10kHz snippet sampled at 20kSPS can produce different output depending on phasing, meaning it is not re-constructable from its samples, only the strict inequality applies.

Or put another way you cannot start or stop a 10kHz waveform without having frequency components > 10kHz present, and the standard definition of the theorem sneakily hides that fact by talking about finite signals.

In the infinite signal domain the strict inequality applies, and this is the only useful version of the theorem in practice, usually.