Using mobile-device sensors to teach students error analysis
Martin Monteiro, Cecilia Stari, Cecilia Cabeza, Arturo C. Marti
UUsing mobile-device sensors to teach students error analysis
Mart´ın Monteiro ∗ Universidad ORT Uruguay
Cecila Stari, Cecila Cabeza, and Arturo C. Mart´ı † Instituto de F´ısica, Facultad de Ciencias,Universidad de la Rep´ublica, Igu´a 4225, Montevideo, 11200, Uruguay (Dated: September 16, 2020)
Abstract
Science students must deal with the errors inherent to all physical measurements and be consciousof the need to expressvthem as a best estimate and a range of uncertainty. Errors are routinelyclassified as statistical or systematic. Although statistical errors are usually dealt with in the firstyears of science studies, the typical approaches are based on manually performing repetitive ob-servations. Our work proposes a set of laboratory experiments to teach error and uncertaintiesbased on data recorded with the sensors available in many mobile devices. The main aspectsaddressed are the physical meaning of the mean value and standard deviation, and the interpre-tation of histograms and distributions. The normality of the fluctuations is analyzed qualitativelycomparing histograms with normal curves and quantitatively comparing the number of observa-tions in intervals to the number expected according to a normal distribution and also performinga Chi-squared test. We show that the distribution usually follows a normal distribution, however,when the sensor is placed on top of a loudspeaker playing a pure tone significant differences with anormal distribution are observed. As applications to every day situations we discuss the intensityof the fluctuations in different situations, such as placing the device on a table or holding it withthe hands in different ways. Other activities are focused on the smoothness of a road quantifiedin terms of the fluctuations registered by the accelerometer. The present proposal contributes togaining a deep insight into modern technologies and statistical errors and, finally, motivating andencouraging engineering and science students. a r X i v : . [ phy s i c s . e d - ph ] S e p . INTRODUCTION In many experimental situations when a measurement is repeated –for example when wemeasure a time interval with a stopwatch, the landing distance of a projectile or a voltagewith a digital multimeter– successive readings give slightly different results under identicalconditions. This occurs beyond the care we take to always launch the ball exactly the sameway or to connect the components of the circuit so that they are firmly attached. In effect,this phenomenon occurs in the real world because most measurements present statisticaluncertainties . When facing repeated observations with different results it is natural toask ourselves which value is the most representative and what confidence level can we havein that value. The International Standard Organization (ISO) (see also ) defines theerrors evaluated by means of the statistical analysis of a series of observations as type A,in contrast with other sources of errors that are systematic and defined as type B. Theevaluation of the latter is estimated using all available non-statistical information such asinstrument characteristics or the individual judgment of the observer. In this work, we focuson the teaching of statistical errors in the first years of science and engineering studies usingmodern sensors.The study of error analysis and uncertainties plays a prominent role in the first years ofall science courses.On this matter, AAPT recommends that students should be able to usestatistical methods to analyze data and should be able to critically interpret the validity andlimitations of the data displayed. In general, a physicist must be able to design a measurementprocedure, select the equipment or instruments, perform the process and finally express theresults as the best estimate and its of uncertainty . Perhaps the most important messageis to persuade students that any measurement is useless unless a confidence interval isspecified. It is expected that, after finishing their studies, students are able to discusswhether a result agrees with a given theory and, if it is reproducible, or to distinguish a newphenomenon from a previously known one. With this objective, various experiments areusually proposed in introductory laboratory courses . These experiments usually involvea great amount of repetitive measurements such as dropping small balls , measuring thelength of hundreds or thousands of nails using a vernier caliper or randomly samplingan alternating current source . The measurements obtained are usually examined from astatistical viewpoint plotting, histograms, calculating mean values and standard deviations2nd, eventually, comparing them with those expected from a known distribution, typically anormal distribution. Although these experiments are illustrative, most of them are tediousand do not adequately reflect the present state of the art.In contrat with the expectable learning outcomes mentioned above, recent studies report several difficulties associated with error analysis among students. The study by S´er´e et al highlighted the lack of understanding of the need to make several measurements, thepoor insight into the notion of confidence intervals or the inability to distinguish betweenrandom and systematic errors. Another investigation remarked the inconsistency of thecommon view of students with generally accepted scientific models. On many occasions, thestudent’s model of thinking is close to a point paradigm as opposed to a more elaborated probabilistic interpretation of the measurements. A reseach-based assesment showed thatalthough the impact of introductory laboratory courses was positive, only a relatively smallpercentage of students developed a deeper understanding of measurement uncertainty .The fluctuations present in the sensors of modern mobile devices give rise to an alternativeapproach to teaching error analysis. Indeed, most smartphones and tablets come equippedwith several built-in sensors such as accelerometers, magnetometers, proximeters or ambient-light sensors. Several Physics experiments using these sensors have been proposed in recentyears (see for example ). In almost all the experiments, only mean values are takeninto consideration; however, due to their sensitivity, sensor readings also display statisticalfluctuations. Although being detrimental in many situations, these fluctuations can be usedfavorably to illustrate basic concepts related to the statistical treatment of measurements.Using these sensors, it is certainly possible to acquire hundreds or thousands of repeatedvalues of a physical magnitude in a few seconds and analyze them in the mobile device or ina PC. We propose here a set of laboratory activities to teach error analysis and uncertaintiesin introductory Physics laboratories based on the fluctuations registered by mobile-devicesensors. In the next Section we describe the basic set of activities while Section III is focusedon other applications that take into account sensor fluctuations in non-standard situations.Finally, in Section IV we present the summary and conclusion.3 I. A LABORATORY BASED ON MOBILE DEVICES
Among all the sensors, accelerometers, capable of measuring the acceleration of the de-vice in the three independent spatial directions, are the most ubiquitous in mobile devices.Though it is possible to use accelerometers or anyone of the others or even more than onesensor simultaneously here, for the sake of clarity, the proposed experiments are mainlybased on the z component of the acceleration a z , defined as perpendicular to the screen.As a general rule, the characteristics of the sensors can be found using specific applications( apps ) or looking for datasheets in the internet. The range (difference between the maximumand minimum value that it is capable of measuring) and the resolution (minimum differencethat the sensor can register, which is sometimes incorrectly termed as accuracy) of severalsensors are summarized in Table I. It is worth remarking that, although being universallyknown as accelerometers, in fact, they are force sensors . Indeed, a device standing on atable would register a value close to the gravitational acceleration in the vertical axis whilea free-falling device would register a value close to zero in the same axis. Phone Sensor Range (m/s ) Resolution (m/s )Samsung Galaxy S7 K6DS3TR ± . ± . ± . ± . ± . ± . ± . ± g , ± g , ± g ,..., which areset by the mobile-device manufacturer. The resolution depends on the choice of range.In the case of the iPhone the manufacturer does not provides this information. In general, a specific piece of software, or an app, is necessary. Digital stores offer manyapps that are able to communicate with the sensors. In particular, Physics Toolbox Suite ,4ndrosensor and PhyPhox , whose screenshots are shown in Fig. 1, are suitable for theexperiments proposed here. Using these apps it is possible to select the relevant sensors, andto setup the parameters such as the duration of the time series and the sampling frequency.The registered data can be analyzed directly on the smartphone screen or transferred to thecloud and studied on a PC using a standard graphics package. Others useful characteristicsof these apps are the delayed execution and the remote access via wi-fi or browser. Thesecapabilities allow the experimenter to avoid touching or pushing the mobile device once theexperiments has started. FIG. 1. Screenshots of three suitable apps : Physics Toolbox suite (left), Androsensor (center),Phyphox (right). The right panel shows a Phyphox screenshot of the experiment
Statistical Basics including a temporal series of the vertical component of the acceleration (top) and the corre-sponding histogram (bottom) overlapped with a Gaussian curve with the same mean and standarddeviation indicated in the image.
A. Normal distribution of the sensors’ fluctuations
The first experiment consists of recording the fluctuations of the vertical component ofthe accelerometer sensor with the mobile device in three different situations: laid on a table,hand-held and resting on another smartphone playing a 600 Hz pure tone. In all the cases, we5hoose, unless stated otherwise, a delay of 3 s and register a z for 30 s. The delay is importantin order to avoid touching the device when the register starts and thus introducing spuriousvalues. Let us denote N the number of measurements registered by the sensor, a z the meanvalue and σ a z the standard deviation.The results of the experiment are summarized in Fig. 2 in which the top panels display thetemporal series, a z ( t ), and the bottom panels show the histograms using the same respectivecolors. In all the cases the accelerations fluctuate stationarily around mean values. Althoughthese values are close to the well-known value of the gravitational acceleration, they areslightly different and they are not expected to represent a measure of that magnitude.This is due to several reasons, for instance it depends on the horizontalitly of the table orthe hand or also on the calibration of the sensor. It is interesting for students to checkthat the mean value changes when the device is laid on a table with the screen pointingupwards or downwards. Another possible, and equivalent, alternative (not shown here)consists of plotting a x ( t ) or a y ( t ) which exhibit similar temporal evolutions and histogramsbut fluctuating around a value close to 0 m/s .The differences in the intensity of the fluctuations exhibited in the three mentioned sit-uations are evident in the top panels of Fig. 2. The intensity is clearly larger when thesmartphone is hand-held (red) or under the influence of the 600Hz tone (green) in compari-son with the smartphone on a table (blue). The standard deviation of each series, indicatedin the legend boxes, is clearly related to the intensity of the fluctuations. This observa-tion substantiates the use of the standard deviation in the framework of the applicationsproposed in Section III.A relevant aspect to study is the distribution of the fluctuations and how it compareswith the normal distribution. The firt approach to testing the normality of the distributionis qualitative. In the bottom panels (Fig. 2), the histograms are compared with normal(Gaussian) functions with the same mean values and standard deviation and the verticalscale adjusted so that the area under the normal curve and the sum of the bins of thehistogram are equal. It can be observed that the histograms and normal functions agreevery well in the cases of the blue and red curves. By increasing the number of samples N and simultaneously decreasing the width of the bins, it is possible to see that the agreementimproves even more (not shown here). Contrarily, in the green case, the pure tone breaks the normality of the distributions as it is clearly revealed by the disagreement between the6 IG. 2. Fluctuations registered by the accelerometer. The top panels display a z ( t ) with thedevice horizontal in three different situations: laid on a table (blue), hand-held (red) and restingon another smartphone playing a 600 Hz pure tone (green). The smartphone was the LG-G3 with a∆ t = 0 .
004 s sampling period. The bottom panels display the histograms and the continuous lineswith the same color are normal (Gaussian) functions with same mean value, standard deviationand normalization. Legend boxes indicate χ values, calculated with 8 bins, and the correspondingconfidence levels (CL). histogram and normal curve.The second and more quantitative approach to verifying the normality of the distributionsis given by the comparison of the fraction of observations in a given interval around the meanvalue and the expected percentage according to a normal distribution. Table II displays thesepercentages for the experiment depicted in Fig. 2. It can be seen that, in agreement with the7ualitative test, the observed and expected percentages are quite similar when the device ison the table or hand-held where they present considerable divergences under the influenceof the 600 Hz tone. Experiment Table Hand Speaker TheoreticalN 3554 3579 3547 - x ± σ (m/s ) 9 . ± .
019 9 . ± .
066 9 . ± .
054 -( x − σ, x + σ ) 69.3% 67.9% 58.2% 68.2%( x − σ, x + 2 σ ) 95.2% 95.5% 99.2% 95.4%( x − σ, x + 3 σ ) 99.7% 99.7% 100.0% 99.7%TABLE II. Fraction of observations in intervals around the mean defined in units of the standarddeviation compared with the expected number according to a normal distribution. Each columncorresponds to each of the temporal series plotted in Fig. 2. To gain further insight into the normality of the distributions, a chi-squared test compar-ing the difference between the number of observations measured and expected in each bin ,was performed. Each χ valued can be associated with a confidence level that determinesthe rejection of the hypothesis of normal distribution. Clearly in the blue and red cases the χ test indicates the compatibility of the normal distribution hypothesis while in the greencase this hypothesis must be rejected. B. Resolution in digital sensors
By zooming in on the temporal series displayed in Fig. 2, it can be seen that the sensorvalues do not take continuous values, but only a discrete set is possible. This is moreevident in the experiment displayed in Fig. 3 where the horizontal axis has been zoomedout in the left panel, and a horizontal histogram with the same values is shown in the rightpanel. The difference between the discrete values in the vertical axis is the resolution ofthe instrument, that is, the minimum difference that the sensor can register. This is typicalof digital instruments, where a continuous magnitude (such as acceleration, in this case)is transformed by a sensor into an analog electrical signal, which is in turn transformedby an analog-to-digital converter (ADC) into a digital signal which can only take certain8
IG. 3. Discrete nature of the sensor data. The horizontal axis in the left panel was zoomedout to emphasize the discrete nature of the accelerometer values. The right panel shows the samevalues in a horizontal histogram with the same vertical scale. discrete values. In this case, the acceleration sensor of the Samsung S7 is a K6DS3TR andits resolution, indicated in Table I, is δ = 0 . which corresponds exactly tothe difference between consecutive acceleration values.The resolution of the sensor, δ , is the quotient between the range, 2 R , and the numberof different values that the sensor can register, 2 n , δ = 2 R n (1)where n is the number of bits of the sensor and the factor 2 stands because it registers notonly positive measures, but also negative accelerations. Taking into consideration Table I,it can be determined that this sensor is capable of measuring 2 R/δ = 65536 different valuesand since 65536 = 2 , this means that it is a 16-bit sensor, which can be easily verified onthe data sheets. C. Standard error and optimal number of measurements
The standard deviation, if N is large enough, is characteristic of the set of all the possibleobservations whereas the standard error, or standard deviation of the mean, generally defined9
563 1156 1746 2348 2941 3535 4166 4733 5327 5919 σ a z (m/s ) 0.020 0.019 0.018 0.019 0.020 0.019 0.019 0.019 0.019 0.020TABLE III. Standard deviations of a z ( t ) corresponding to several experiments under identicalconditions but with different number of measurements. as σ ( ¯ a z ) = σ a z / √ N represents the margin of uncertainty of the mean value obtained in aparticular set of measurements . The result of a specific measurement is usually expressedas a z ± σ ( ¯ a z ) representing the best estimate and the confidence in that value. In Table. IIIthe standard deviation is shown as a function of N . As mentioned above, it is clear fromthat data that σ a z is nearly constant and, as a consequence, σ ( ¯ a z ) is proportional to N − / .The choice of N in a specific experiment is a delicate question. Indeed, if we could repeatthe measurements infinite times the standard error would vanish and we could achieve aperfect knowledge of the best estimate. However, as the decrease of the standard error withthe number of observations is slow, it is impractical to increment this number excesively.A common criterion is to take a number of measurements, often referred as the optimalnumber of measurements , N opt , such that the statistical uncertainty is of the same order asthe systematic (or type B) errors. Here, in the absence of other sources of systematic errors,the standard error should be of the same order as the resolution of the digital instrument: σ ( ¯ a z ) = σ a z / (cid:112) N opt ∼ δ . In the experiment depicted in Table III with a LG G3, theresolution is δ = 0 . , therefore N opt ∼ . III. OTHER APPLICATIONS
In this Section we propose a couple of activities in which the knowledge of the fluctuationsmeasured by a sensor can contribute to quantify another magnitude.
A. The steady hand game
An interesting experiment is to study the intensities of the fluctuations depending onthe way in which the experimenter holds his/her device. This activity can be adapted fora group of students as a challenge consisting of trying to hold the device as steadily as10
IG. 4. Comparative table of the standard deviation σ for different mobile devices in differentactivities as a function of the different models (see Table I). Lines are guides for the eyes possible. Another possibility (not recommended by the authors) is to study the fluctuationsof the gait of a pedestrian as a function of the alcohol beverage intake similar to .The steadiness of the device is quantified by the standard deviation of a given temporalseries. The intensities of the fluctuations in different situations and for different sensorsare displayed in Fig. 4. It is evident from these values that the mobile device on the tableexhibits in all the cases less fluctuations than when the device is held by the experimenter.Moreover a more stable position is achieved by keeping the device close to the trunk asopposed to the classical selfie position. Another point worth mentioning is that the intensityof the fluctuations depends on the specific sensor but exhibits in all cases the same trendsmentioned above. Several interesting extensions to this experiment can be proposed: thedependence on the characteristics of the experimenter (age, training, concentration). Theorigin of the fluctuations, mechanical or electronical, can be considered in case of having anantivibration table. When using interferometric methods a precise calibration of the mobiledevice sensor could also be performed. 11 . The smartphone as a way to assess road quality Recently, smartphones’ sensors were proposed to assess road quality . In this activity,which can be performed outdoors, students can assess the quality of a road. A means oftransport, in this case a car, is employed under similar conditions (speed), but other pos-sibilities, such as a bike, are equally feasible. The intensities of the fluctuations travelingby car on different roads are listed in Table IV. To get an insight of the fluctuations at-tributable to the road the noise with the car stopped and the engine idle is indicated in thefirst road. A similar measurement performed in a flying aircraft is included solely for thesake of comparison. This activity can be extended to evaluate comfort in any other meansof transport media, for example, elevators. Situation N σ G3 (m/s ) N σ XR7 (m/s )Engine idle 1181 0.3818 4984 0.0352Smooth pavement 1200 1.3487 4974 0.5642Stone pavement - - 4952 1.1491Aircraft 1999 0.4374 - -TABLE IV. Assessment of the quality of different roads. Standard deviation of a z while the deviceis on the floor of the car with the screen orientated upwards. IV. SUMMARY AND CONCLUSION
The activities discussed above were successfully proposed at our university to freshmanEngineering and Physics students. In previous laboratory experiments students alreadyknew the usefulness of the sensor to study several phenomena in which the noise was a factorto avoid. However, when sensors were proposed to study fluctuations, they were surprisedto discover a kind of underlying world . Despite having gone through statistical topics inseveral courses, the normal distribution appearing as an experimental fact rather than amathematical consequence, was original. It is worth discussing, how the distributions of theother sensors change. For example, magnetometer fluctuations, significantly influenced bymotors or ferromagnetic material in the vicinity, do not follow normal distributions. Several12hallenges can be proposed in relation to sports, comfort evaluations or quality control.The main conclusion is that modern mobile-device sensors are useful tools for teachingerror analysis and uncertainties. In this work we proposed several activities that can beperformed to teach uncertainties and error analysis using digital instruments and the builtinsensors included in modern mobile devices. It is straightforward to obtain experimentaldistributions of fluctuations and compare them with the expected ones. It is shown that thedistributions usually obey normal (Gaussian) statistics; however, it is easy to obtain nonnormal distributions. The role of noise intensity, spreading or narrowing the distributionsopen up the possibilities of new applications. Holding the mobile device in different waysalso gives an idea of how firmly it is held. Registering acceleration values in a car canassess the smoothness of a road. In this approach, the lengthy and laborious manipulationsof traditional approaches based on repetitive measurements, are avoided allowing teachingto focus on the fundamental concepts. These experiments could contribute to motivatingstudents and showing them the necessity of considering uncertainty analysis. Several possibleextensions related to non-normal statistics can be considered, such as Poison distribution ,distribution of maxima, Chauvenet criterion , or Benford law . ACKNOWLEDGMENT
The authors would like to thank PEDECIBA (MEC, UdelaR, Uruguay) and express theirgratitude for the grant Fisica Nolineal (ID 722) Programa Grupos I+D CSIC 2018 (UdelaR,Uruguay). ∗ [email protected] † marti@fisica.edu.uy John Taylor.
Introduction to error analysis, the study of uncertainties in physical measurements .University Science Books, 1997. Ifan Hughes and Thomas Hase.
Measurements and their uncertainties: a practical guide tomodern error analysis . Oxford University Press, 2010. OIML ISO. Guide to the expression of uncertainty in measurement (gum).
Geneva, Switzerland ,1995. Barry N Taylor, Peter J Mohr, and M Douma. The nist reference on constants, units, anduncertainty. available online from:. physics. nist. gov/cuu/index , 2007. Bureau International des Poids et Mesures. Evaluation of measurement data–guide to theexpression of uncertainty in measurement, 2008. Joseph Kozminski, Heather Lewandowski, Nancy Beverly, Steve Lindaas, Duane Deardorff,Ann Reagan, Richard Dietz, Randy Tagg, Jeremiah Williams, Robert Hobbs, et al. Aaptrecommendations for the undergraduate physics laboratory curriculum.
American Associationof Physics Teachers , 29, 2014. I. M. Meth and L. Rosenthal. An experimental approach to the teaching of the theory ofmeasurement errors.
IEEE Transactions on Education , 9(3):142–148, 1966. E. Mathieson and T. J. Harris. A student experiment on counting statistics.
American Journalof Physics , 38(10):1261–1262, 1970. P. C. B. Fernando. Experiment in elementary statistics.
American Journal of Physics , 44(5):460–463, 1976. Arvind, P. S. Chandi, R. C. Singh, D. Indumathi, and R. Shankar. Random sampling of analternating current source: A tool for teaching probabilistic observations.
American Journal ofPhysics , 72(1):76–82, 2004. Tadeusz Wibig and Punsiri Dam-o. ‘hands-on statistics’—empirical introduction to measure-ment uncertainty.
Physics Education , 48(2):159–168, feb 2013. K K Gan. A simple demonstration of the central limit theorem by dropping balls onto a gridof pins.
European Journal of Physics , 34(3):689–693, mar 2013. Marie-Genevi`eve S´er´e, Roger Journeaux, and Claudine Larcher. Learning the statistical analysisof measurement errors.
International Journal of Science Education , 15(4):427–438, 1993. Saalih Allie, Andy Buffler, Bob Campbell, Fred Lubben, Dimitris Evangelinos, Dimitris Psillos,and Odysseas Valassiades. Teaching measurement in the introductory physics laboratory.
ThePhysics Teacher , 41(7):394–401, 2003. MF Chimeno, MA Gonzalez, and J RAMOS Castro. Teaching measurement uncertainty toundergraduate electronic instrumentation students.
International Journal of Engineering Edu-cation , 21(3):525–533, 2005. Trevor S. Volkwyn, Saalih Allie, Andy Buffler, and Fred Lubben. Impact of a conventionalintroductory laboratory course on the understanding of measurement.
Phys. Rev. ST Phys. duc. Res. , 4:010108, May 2008. Rebecca Vieyra, Chrystian Vieyra, Philippe Jeanjacquot, Arturo Marti, and Mart´ın Monteiro.Five challenges that use mobile devices to collect and analyze data in physics.
The ScienceTeacher , 82(9):32–40, 2015. Katrin Hochberg, Jochen Kuhn, and Andreas M¨uller. Using smartphones as experimentaltools—effects on interest, curiosity, and learning in physics education.
Journal of Science Edu-cation and Technology , 27(5):385–403, 2018. Martin Monteiro and Arturo C Marti. Using smartphone pressure sensors to measure verticalvelocities of elevators, stairways, and drones.
Physics Education , 52(1):015010, 2017. Mart´ın Monteiro, Cecilia Cabeza, and Arturo C Mart´ı. Exploring phase space using smartphoneacceleration and rotation sensors simultaneously.
European Journal of Physics , 35(4):045013,2014. Mart´ın Monteiro, Cecilia Cabeza, and Arturo C. Marti. Acceleration measurements usingsmartphone sensors: Dealing with the equivalence principle.
Revista Brasileira de Ensino deF´ısica , 37:1303 –, 03 2015. Rebecca Vieyra and Chrystian Vieyra. Physics toolbox suite, July 2019. S Staacks, S H¨utz, H Heinke, and C Stampfer. Advanced tools for smartphone-based experi-ments: phyphox.
Physics Education , 53(4):045009, may 2018. Tirra Hanin Mohd Zaki, Musab Sahrim, Juliza Jamaludin, Sharma Rao Balakrishnan,Lily Hanefarezan Asbulah, and Filzah Syairah Hussin. The study of drunken abnormal hu-man gait recognition using accelerometer and gyroscope sensors in mobile application. In , pages151–156. IEEE, 2020. PM Harikrishnan and Varun P Gopi. Vehicle vibration signal processing for road surface mon-itoring.
IEEE Sensors Journal , 17(16):5192–5197, 2017. Braden J Limb, Dalon G Work, Joshua Hodson, and Barton L Smith. The inefficacy of chau-venet’s criterion for elimination of data points.
Journal of Fluids Engineering , 139(5), 2017. Jonathan R Bradley and David L Farnsworth. What is benford’s law?
Teaching Statistics ,31(1):2–6, 2009.,31(1):2–6, 2009.