You are on page 1of 7

V.

Kartik
IIT Bombay

ME 423 Machine Design Lab


Vibration/Dynamics Data Acquisition Using Smartphone Apps

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.

Accelerometers and Gyroscope-Sensors

An accelerometer is a device that measures the acceleration of the object to which it is


attached, and outputs this data as a voltage signal. Smartphones are equipped with several
sensors, which typically include an accelerometer and a gyroscope, as shown in Figure 1.
Accelerometers in mobile phones are used to detect the orientation of the phone. They are
MEMS (Microelectromechanical System) devices which are used to measure position, motion,
tilt, shock, vibration, and acceleration. It comprises a micro-cantilever beam which vibrates
according to the excitation; the connected electronic circuitry converts this motion into voltage
signals. A 3-axis accelerometer senses the acceleration along three directions. It is used to
detect the orientation of the phone and changes the screen, images, web browser, etc.
accordingly, allowing the user to easily switch between portrait and landscape mode.

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.

Figure 1: Some of the commonly used sensors in smartphones.


V. Kartik
IIT Bombay

App-Based Data Logging

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 2: Orientation of the X, Y and Z axes for a smartphone.


V. Kartik
IIT Bombay

Example 1: Using the smartphone’s accelerometer to measure the natural frequencies


and damping of a pendulum
• Consider a ruler of length of atleast 30 cm. You can use a metallic or plastic ruler that
has a hole punched in it so that it is easy to hang it over a nail. The smartphone is used
as a pendulum bob in this experiment.
• Attach the smartphone to the lower end of the ruler such that the X-Y plane of the
smartphone is parallel to the plane of the ruler, as shown in Figure 3. The X and Y axes
of the smartphone should be oriented such that they are aligned with the tangential and
radial directions respectively in any position of the pendulum.

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.

Figure 4: Data acquired using smartphone accelerometer

• 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.

Example 2: Using the smartphone’s gyro-sensor to measure the rotational speed of a


ceiling fan and estimate friction

• 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:

Instructions for using MATLAB App:

Step 1: Sign in into your Mathworks account with your IITB email id.

Step 2: Select the ‘Sensors’ option from the menu.

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;

You might also like