These exercises are not tied to a specific programming language. Example implementations are provided under the Code tab, but the Exercises can be implemented in whatever platform you wish to use (e.g., Excel, Python, MATLAB, etc.).
All these exercises require a smartphone with an app that gives access to accelerometer data. There are several possibilities such as the Android apps **Accelerometer Analyzer** by _Mobile Tools_, **G-sensor Logger** by _Peter Ho_, **Sensor Kinetics** by _Innovetions, Inc._, etc. Also, the apps **Physics Toolbox Sensor Suite** by _Vieyra Software_ and **phyphox** by the _RWTH Aachen University_ are available both for Android and iOS systems.
Exercise solutions in this set are based on experiments performed with the app **Accelerometer Analyzer**.
##EXERCISE 1: SMARTPHONE FALLING DOWN A SLIDE
Measure the angle of a slide and its friction coefficient with your smartphone.
###Experimental procedure for data acquisition
![Figure E1](images/Smartphone/figureE1.jpg "")
Figure E1 is a sketch of the smartphone configuration at the different steps of data acquisition.
a) Set Sensor Speed at the accelerometer app to FASTEST (so that the time interval between measurements is of the order of 5 -10 ms). Place your smartphone, screen up, on the initial horizontal portion of the slide, and start saving the acceleration _vs._ time data. Keep on measuring in this position for about 2 seconds in order to obtain vector **g** (*Rest period I*)
b) Without interrupting the measurement, place your smartphone at rest on the inclined portion of the ramp for about 2 seconds, to obtain vector **g** in a tilted reference frame (*Rest period II*).
c) Without interrupting the measurement, let your smartphone slide down the ramp (*Moving period III*).
d) Pick you smartphone before it reaches the bottom of the ramp and stop the measurement.
e) Take a side picture of the slide to estimate the angle $\theta$ of the ramp.
###Data analysis
f) Share the measured text file by e-mail to transfer the data from your smartphone to a computer.
g) Import data into a 4-column array corresponding to the Cartesian components of vector **a-g**, $(a-g)_x$, $(a-g)_y$, $(a-g)_z$ and time increment $dt$.
h) Plot the time dependence of $(a-g)_x$, $(a-g)_y$ and $(a-g)_z$
i) Obtain the magnitude of $|\mathbf{g}|$ from the mean of the smartphone readings at rest period a) when $a=0$. Calculate its statistical error from the standard deviation of smartphone readings in the same period. Compare the measured $|\mathbf{g}|$ with the expected value 9.81 $m/s^2$, and discuss whether the differences are smaller or larger than the statistical errors.
Differences between measured and nominal $|\mathbf{g}|$ values larger than the statistical error can be attributed to problems with the calibration of the smartphone accelerometer sensor. Discuss with your teacher how to correct systematic errors related with inaccuracies in sensor calibration.
j) Obtain the angle $\theta$ from the smartphone readings at rest periods a) and b) when $a=0$. Compare it with the angle estimated from the slide picture.
k) Obtain the coefficient of friction $\mu$ from measurements in period c)
##EXERCISE 2: ELEVATOR ACCELERATION
Obtain the acceleration _vs._ time of an elevator as it goes up from floor 0 to floor 1 and back to its original position.
###Experimental procedure for data acquisition
a) Set Sensor Speed at the accelerometer app to FASTEST (so that the time interval between measurements is of the order of 5 -10 ms). Place your smartphone, screen up, on the elevator floor, and start saving the acceleration _vs._ time data. Keep on measuring in this position for about 2 seconds in order to obtain vector **g** (*Rest period I*)
b) Without interrupting the measurement, press the elevator button to start the trip to a different floor (Floor 1) until the elevator stops on the higher floor (*Moving period II*).
c) Stay at rest on Floor 1 for about 2 seconds (*Rest period III*).
d) Make the same trip downwards (*Moving period IV*) until you reach the initial position (Floor 0) (*Rest period V*) . Keep on recording the acceleration vs. time curve in the whole trajectory.
###Data analysis
e) Share your data by e-mail to start the numerical analysis of the elevator motion.
f) Import data into a 4-column array corresponding to the Cartesian components of vector **a-g**, $(a-g)_x$, $(a-g)_y$, $(a-g)_z$ and time increment $dt$.
g) Plot the time dependence of $(a-g)_x$, $(a-g)_y$ and $(a-g)_z$
h) Characterize **g** vector (angle relative to $Z$ axis and magnitude $|\mathbf{g}|=(g_x^2+g_y^2+g_z^2)^{1/2}$ at rest periods a), c) and the final stop position.
* What is the statistical error of these measurements? Are they equal within the confidence interval?
* Is the accelerometer $Z$ axis aligned with gravity? Can you estimate the angle of deviation from your measurements?
* Do you obtain the expected $g = 9.81 m/s^2$ value. Why? What does it tell you about your smartphone calibration? Discuss possible systematic errors related with inaccuracies in the calibration of the smartphone accelerometer using the same procedure as in Exercise 1.
* Can you identify any other time intervals of constant velocity as the elevator moves from floor to floor? Which is the statistical error in this interval? What does it tell you about elevator vibrations?
i) Characterize the elevator acceleration **a**:
* Identify the time intervals for positive and negative elevator acceleration in the acceleration vs. time graph.
* What is the average positive and negative $a_z$ of your elevator as it starts/stops on its way up to floor 1? Which is the statistical error of these measurements? Estimate the elevator velocity on its way up and down using simple kinematical equations for uniform acceleration motion.
* Is the acceleration truly constant at defined field intervals as expected from simple uniform acceleration models? It is very common to observe damped oscillations in the motion that require a full numerical integration to obtain meaningful velocity vs. time curves.
j) Try to filter out random noise with a moving average filter using different parameters. Notice that too strong filtering can seriously distort your experimental measurements.
##EXERCISE 3: EULER INTEGRATION OF ACCELERATION DATA
Obtain the velocity and position _vs._ time curves from measured acceleration data
a) Obtain the time dependent acceleration of the elevator by subtracting $g_z$ from the measured $(a-g)_z$ values.
b) Obtain the time dependent velocity curve from Euler integration of acceleration data assuming that at the
initial conditions the elevator is at rest
$$\begin{align}
v(0) & = 0\\
v(t_{i+1}) & = v(t_i)+ a_z(t_i) ×(t_{i+1}-t_i)
\end{align}$$
c) Obtain the time dependent Z position curve from Euler integration of velocity data assuming that at the
initial conditions the elevator is at rest and an initial elevator position $z_0$.
$$\begin{align}
z(0) & = z_0\\
z(t_{i+1}) & = z(t_i)+ v(t_i)\times (t_{i+1}-t_i)
\end{align}$$
d) Evaluate elevator velocity at the initial rest period, at intermediate rest period when it was stopped at Floor 1 and at final rest period when it returned to Floor 0. Is it zero in the three cases as it would be expected?
e) Is the final elevator position the same as the initial one?
f) Often the answer to questions e) and d) is not what you expect: the calculated final elevator position is quite different from the initial one even though you know that you left the elevator in the same floor where movement started.
The reason is related with electronic drifts in the accelerator sensor that are smaller than statistical noise but strongly affect the integrated signal.
Try to filter out electronic drifts from acceleration data by replacing the constant $g_z(0)$ measured at the initial time position by a time dependent $g_z(t) = g_z(0) +bt$.
You can estimate the empirical constant $b$ from the experimental $g_z$ values measured at the different periods in which the elevator was at rest.