Wolfram Blog
Håkan Wettergren

How to Use Your Smartphone for Vibration Analysis, Part 1: The Wolfram Language

March 2, 2017 — Håkan Wettergren, Applications Engineer, SystemModeler (MathCore)

Until now, it has been difficult for the average engineer to perform simple vibration analysis. The initial cost for simple equipment, including software, may be several thousand dollars—and it is not unusual for advanced equipment and software to cost ten times as much. Normally, a vibration specialist starts an investigation with a hammer impact test. An accelerometer is mounted on a structure, and a special impact hammer is used to excite the structure at several locations in the simplest and most common form of hammer impact testing. The accelerometer and hammer-force signals are recorded. Modal analysis is then used to get a preliminary understanding of the behavior of the system. The minimum equipment requirements for such a test are an accelerometer, an impact hammer, amplifiers, a signal recorder and analysis software.

I’ve figured out how to use the Wolfram Language on my smartphone to sample and analyze machine vibration and noise, and to perform surprisingly good vibration analysis. I’ll show you how, and give you some simple Wolfram Language code to get you started.

Throughout the history of the development of machines, vibration and sound measurements have been important issues. There are two reasons for this:

  1. Vibrations are a source of noise, can decrease operating performance and can also cause workplace injuries such as “vibration white fingers,” also known as hand-arm vibration syndrome (HAVS), resulting from continuous use of handheld machinery vibrating at certain key frequencies.
  2. Vibrations can indicate wear or defects of the bearings and gears, and so analysis of vibrations is a useful and commonly used tool for fault detection.

The many applications of vibration analysis have led to a huge number engineers studying this subject in universities all over the world. The research area of “machine vibrations” has its own conferences and publications. Companies specialize in developing different kinds of equipment and services. Most large machine-building industries have departments specializing in vibrations.

So here we go: recording the sound of a vibrating machine with an iPhone is simple. I used the iPhone’s built-in digital voice recorder, Voice Memo. The recording can be converted to an MP3 file just by saving it in the MP3 format in iTunes. The default Apple M4A format cannot be used directly in the Wolfram Language. If iTunes is not available, there are a lot of free converters on the internet that will change your M4A files to MP3 files.

Play Audio

I’ll use an industrial gearbox as an example. The example itself is not that important, but it does suggest possible areas where the method can be used. Some data and dimensions have been modified from the original application.

A gearbox is making a lot of noise. What is the problem?

In the figure below, a motor drives the input shaft. The shaft speed is reduced by the gearbox. The power is used by the output shaft. Typically, the motor is a diesel or electrical engine; in this example, it is a diesel engine. The number of teeth are z1 = 23, z2 = 65, z3 = 27 and z4 = 43, respectively. The largest wheels are about one meter in diameter.


We ran the engine at 1200 rpm, recording five seconds of sound with my iPhone. Converted to MP3, the sound file was named “measurement.mp3”. Then all I needed to do was import it into the Wolfram Language to plot the frequency spectrum.


The excitation frequency in Hertz of the gear contact on the input shaft is z1*rpm/60, and
(z1/z2)*z3 *rpm/60 on the output shaft. Marking the histogram for the input and output shafts’ gear mesh excitation frequencies—red and green, respectively—makes it clear that these frequencies are correlated with the spectrogram.

Excitation frequency histogram

Let’s make the spectrogram interactive: often we don’t want to use the whole sound file, so we add an option to select a start and end time within the file. Let’s also make it possible to change the rpm.

Manipulate start and stop time

The analysis toolkit is ready. The options PlotRange, MaxValue and Manipulate in the plot above are set manually. Of course, this can be developed further. But we stop here to keep it simple.

So what happened with the real application investigation? Well, the same analysis as above was performed over the whole rpm region. The maxima of the peaks at each rpm are plotted below.

Amplitude and frequency graph

The input shaft’s highest value is 747.7 rpm, and the output shaft’s is 1,800 rpm. Both become excited at about 287 Hz, the gearbox fundamental resonance frequency. Note that
747.7/60*23 = 286.6 Hz and 1800*23/65*27/60 = 286.6 Hz

We concluded that the gear mesh was not optimized for smooth running and the gearbox had a bad resonance frequency. We opened the gearbox and were able to confirm wear on the teeth, which suggested possibilities for improving the contact pattern. We improved contact by selecting an optimum helical angle, as well as tip relief and correct crowning. Tip relief is a surface modification of a tooth profile; a small amount of material is removed near the tip of the gear tooth. Crowning is a surface modification in the lengthwise direction to prevent contact at the teeth ends, where a small amount of material is removed near the end of the gear tooth.


I have used this method, utilizing my smartphone and the Wolfram Language, several times for real-world and often complex investigations and applications. Often, measurement specialists have already gotten involved before I arrive. But they may have missed the basics because they are using comprehensive measurement programs.

The method I describe here may sometimes yield a similar—or even better—understanding of the problem in just a few minutes at no cost. Well worth trying.

Leave a Comment

One Comment


Thanks Hakan for this interesting blog. is there a notebook or CDF file that one could use to repeat the above experiment?


Posted by Michael    March 2, 2017 at 4:41 pm

Leave a comment


Or continue as a guest (your comment will be held for moderation):