Vibration Data Analysis Using Smartphone
Vibration Data Analysis Using Smartphone
Kartik
IIT Bombay
In this lab, you will be acquiring vibration data with the help of your smartphone and analyze
it to get useful information. While you will be applying this to your own system, the method is
illustrated here using the example of a pendulum system. In this example, the smartphone itself
will be used as a pendulum bob and the accelerometer in the smartphone will be used to collect
the vibration data.
A gyroscope, or gyro for short, is a MEMS device that can sense the angular rotation speed.
An accelerometer measures linear acceleration of motion, while a gyro on the other hand
measures the angular velocity.
Many apps are available for smartphone sensor data logging in the Google Play Android app
store and other similar app stores. Install a suitable app of your choice in your smartphone.
Some suggested apps are phyphox (from RWTH Aachen), Physics Sensor Toolbox Suite, and
Physics Toolbox Accelerometer.
The MATLAB mobile app can also be used to log accelerometer data. The sensor data is logged
locally onto the device and uploaded to MATLAB Drive. You can use your IITB email id to
create a Mathworks account and access MATLAB Online and MATLAB Drive. For detailed
step wise instructions on using the MATLAB app, refer to the Appendix. Use an app in which
you can record the acceleration data and export the data to files and use the data for further
analysis.
Most of these apps record and display the acceleration data along the X, Y and Z directions.
The X, Y and Z axes of the smartphone are usually as shown in Figure 2. In order to check the
orientation of the axes, place the smartphone in various orientations and note the acceleration
values indicated along each axis. If the smartphone is kept stationary on a table such that the
screen is facing upwards, it should show a value of acceleration of ‘g’ = 9.81 m/s 2 in the z-
direction. Some apps provide a relative acceleration measure in which the acceleration due to
gravity is subtracted. Make sure whatever you finally measure with the accelerometer is the
absolute acceleration.
Figure 3: Smartphone attached to a ruler and used as a pendulum bob (phyphox app shown).
• Give a small initial displacement to the pendulum and release it. Ensure as much as
possible that the pendulum oscillates in the plane of the smartphone and there is very little
out of plane motion. Find out the frequency of the system by measuring the time taken by
the smartphone to complete a reasonably large number of oscillations (10-20 cycles). Take
5 sets of readings and average them.
• The smartphone will oscillate and its acceleration data will be captured by the
accelerometer. Since the smartphone is mounted such that X axis of the acceleration is
along the tangential direction, the accelerometer measures the tangential component along
the X axis and the radial acceleration along the Y axis. Note the sampling rate that you use
V. Kartik
IIT Bombay
for this trial. Save the data into your computer. The data can be used to find out the damped
natural frequency of the system
• Figure 4 shows the data acquired and then plotted using MATLAB.
• You would observe that the oscillations get damped out after some time due to air
resistance and friction at the point of suspension of the pendulum. This can also be seen
on the time response of acceleration. If the amplitude decay is exponential, the damping
coefficient of the system can be found from the response of the system by using
logarithmic decrement of the response assuming the system is underdamped. Also it can
be found out by using the relation between the natural frequency and damped natural
frequency.
• The smartphone can be used to determine the angular speed of a fan using the in-built
gyroscope. You need to make sure that your smartphone can record the rotational
rate/speed (usually in rad/s). You can find the axes’ positive directions in a similar way
to your previous experiment. You can slightly rotate your phone about its length, its
width and its out-of-plane normal. Using right hand thumb rule, you can find the
V. Kartik
IIT Bombay
direction of your rotation vector. These rotations would give a positive or negative spike
in the x/y/z direction. Based on it, you can find whether you gave the rotation in the
positive axis or the negative axis.
• Figure 5 shows how a smartphone can be attached to the ceiling fan to obtain its angular
velocity.
• You can now determine the steady state rotation speed of the fan for various regulator
settings.
• With the fan running at steady state, switch the power off. As the fan slows down to a
stop, the change of its angular rotation speed with time can be used to estimate the
dissipative forces/moments, such as those due to friction in its bearings, or aerodynamic
drag acting on its blades.
Figure 5: Smartphone attached to the ceiling fan to measure its angular speed.
V. Kartik
IIT Bombay
Appendix:
Step 1: Sign in into your Mathworks account with your IITB email id.
Step 3: In sensor settings set Stream to to ‘Log’ to log data locally on your phone. Set a suitable
sampling rate from 0.5 Hz to 100 Hz. Turn on the Acceleration sensor data recording. Hit the
START button once you are ready to record the data. Hit the STOP button when done.
V. Kartik
IIT Bombay
Step 4: After hitting the STOP button it will ask the filename for the sensor data log. Enter the
filename of your choice and click Save. It will first save the file locally to your device as a
‘.mat’ file and then upload it MATLAB Drive. You can download the file from MATLAB
Drive and use it for further analysis.
Step 5: The ‘.mat’ file contains the accelerometer data in ‘timetable’ format. It contains the
time stamp and acceleration along X, Y and Z axes in separate coulmns. The following
MATLAB code can be used to extract the acceleration data along X, Y and Z axes into separate
variables:
Acc = timetable2table(Acceleration);
Xacc = Acc.X;
Yacc = Acc.Y;
Zacc = Acc.Z;