The increasing spread of mobile internet devices with built-in accelerometers led to the idea of using them to build up low-cost seismological arrays (Minson et al 2015, Kong et al. 2017).
One example is the MyShake project of the Berkeley Seismological Laboratory, University of California. The MyShake app, available for iOS and Android Smarphones, is an earthquake early warning system that warns of current earthquakes. At the same time, users of the app provide information about earthquakes at their current location and thus contribute to the earthquake early warning system.
A somewhat simpler variant are apps to record, store, stream and display vibrations using the accelerometer. One of the older apps of this type is the Seismometer app from FFFF00 Agents AB. In addition, the vibrations can also be measured with MATLAB Mobile and evaluated and displayed in MATLAB Desktop. In this exercise xyz acceleration data are measured over time. One of the tasks here is to correctly understand the time data of the respective app and, if necessary, to convert it into calendar date and time information.
Exercise
1. Use a smartphone to record xyz acceleration values over a time of about 10 seconds with the Seismometer app and save the data.
2. Repeat the measurements with MATLAB Mobile and save the data
3. Display the data as a time series (xyz acceleration vs.s time). Interpret the results with respect to their use in a seismic array.
4. Can these readings be used to determine the velocity of propagation of elastic waves in a table?
Solution
1. Place the smartphone such as an iPhone 8 on a table. Launch the Seismometer app on your smartphone, push the ℹ︎ button in the lower right corner to go to the app’s preferences. There we set the sampling rate to the maximum possible value of 100 Hz. We also activate all three axes X, Y and Z. As filter we set a Butterworth (Balanced) and deactivate the sleep mode of the app. It is important that we activate the GPS time synchronization. Press the red button in the upper left corner of the app to measure the vibrations in x, y and z direction over a time of about 10 seconds. Push the button in the upper right corner to access the list of archived measurements from where we export the data by sending a .csv file via email.
2. Again place the smartphone on the table. Launch MATLAB Mobile and click on the button in the upper right corner to access the app’s menu. There we select Sensors where we again set the sampling rate to 100 Hz. We then select Stream to and choose Log to capture the sensor logs locally. Selecting More, we can enable Auto Upload to automatically upload the data to the MATLAB drive. We also activate the accelerometer in X, Y and Z direction. After pushing the START button the app is recording the measurements until we push the STOP button after about 10 seconds. The app asks for a file name and saves the data in a .mat file in the MATLAB Drive.
3. Launch MATLAB Desktop on your computer and import the data from both apps and display the xyz vibrations over time. If necessary, convert the time values into calendar date and time values. If the experiment is repeated with different degrees of coupling between the smartphone and the subsurface, the importance of good coupling becomes clear when using the device in a seismic array (Kong et al. 2016).
4. Indeed, Salaree et al. (2017) demonstrates such an experiment with an array of several smartphones running iOS and Android, as can also be seen in a YouTube video. According to their work the seismic velocity of the table was ~3,500 m/s and hence the travel time of the elastic waves along the 2.80 m long track is 2.8 m / 3,500 m/s = 0.0008 s only. The required sampling rate to measure this time difference is 1/0.0008 s = 1,250 Hz, which is significantly higher than the possible sampling rate of 100 Hz of the iPhone 8 used here. In fact, no app could be found that stores the acceleration data in a higher resolution. Amir Salaree from Northwestern University, author of the paper and YouTube video, told me that they used an app in 2017 that would allow GHz sampling on some smartphones but this app disappeared from the App Store and GooglePlay in the next year. In fact, several sources on the Internet suggest that acceleration data on smartphones are measured in GHz resolution, but manufacturers no longer allow the high-resolution data to be read and stored.
MATLAB Script
We use the following MATLAB script to solve tasks 1–4. We put the smartphone on the table or fix it with a double-sided adhesive tape for a better coupling with the surface. The experiment presented here uses an Apple iPhone 8 with a Bosch Inertial Measurement Unit combining a gyroscope with an accelerometer (https://www.techinsights.com). We use MATLAB Mobile to record xyz acceleration for ten seconds using the Log mode in the Sensors menu of the app. After we stopped recording we are asked for a file name to save the file on the MATLAB Drive. The file is then copied to the desktop directory of MATLAB Drive. We move the file to our working folder or any other directory contained in current search path of MATLAB. We then clear the workspace, the command window and close all figures using
clear, clc, close all
We first import the data from the .csv file recorded with the Seismometer app as a variable of type table.
data = readtable('recording_2020_02_07_1149.csv');
We then convert the UNIX time stamp to calendar day and time.
unixtime = table2array(data(:,1)); data.timestamp = datetime(unixtime,... 'ConvertFrom','posixtime');
Then we display the data in a stacked plot with the time stamp as x-axis.
figure('Position',[50 600 800 400]) stackedplot(data,'XVariable','timestamp'); title('Seismometer App')
Next we import the data from the .mat file from MATLAB Mobile.
clear datastruct = load('sensorlog_20200207_114151.mat');
We extract the data from the structure array datastruct. The resulting variable datatable is of type timetable.
datatable = datastruct.Acceleration;
Then we display the data in a stacked plot with the time stamp as x-axis (Fig. 7.exercise_7.4.1_1).
figure('Position',[50 100 800 400]) stackedplot(datatable); title('MATLAB Mobile')
As we see, we get a very similar result when measuring with the two apps on the same iPhone.
Download the MATLAB script and example file.
References
Kong Q, Allen RM, Schreier L, Kwon YW (2017) MyShake: A smartphone seismic network for earthquake early warning and beyond. Science Advances 2:e1501055
Minson S, Brooks BA, Glennie CL, Murray JR, Langbein JO, Owen SE, Heaton TH, Iannucci RA, Hauser DL (2015) Crowdsourced earthquake early warning. Science Advances 1:e1500036
Salaree A, Stein S, Saloor N, Elling R (2017) Turn your smartphone into a geophysics lab. A&G 58:6.35–6.36