Papers in Physics, vol. 10, art. 100004 (2018) Received: 7 September 2017, Accepted: 1 March 2018 Edited by: A. Mart́ı, M. Monteiro Reviewed by: E. Arribas, Universidad de Castilla La Mancha, Albacete, Spain Licence: Creative Commons Attribution 4.0 DOI: http://dx.doi.org/10.4279/PIP.100004 www.papersinphysics.org ISSN 1852-4249 Open-source sensors system for doing simple physics experiments César Llamas,1 Jesús Vegas,1 Miguel Á. González,2 Manuel Á. González3∗ An open-source platform to be used in high school or university laboratories has been developed. The platform permits the performance of dynamics experiments in a simple and affordable way, combining measurements of different sensors in the platform. The sensors are controlled by an Arduino microcontroller, which can be wirelessly accessed with smartphones or tablets. The platform constitutes an economical sensing alternative to commercial configurations and can easily be extended by including new sensors that broaden the range of covered experiments. I. Introduction We have designed and constructed a low cost plat- form that can be used to do simple physics ex- periments combining different sensors’ data easily. The purpose of this work consist in implementing a cheap system that can be used in high schools and universities regardless of their budget in di- verse experiments, allowing a higher customization than equivalent commercial sets. II. System description The initial requirements of the system are afford- ability, simplicity, flexibility and extensibility. Un- der the affordability requirement, we have decided to employ systems that can be easily found on the Internet at low prices. Simplicity means that users ∗E-mail: manuelgd@termo.uva.es 1 Departamento de Informática, Universidad de Val- ladolid, 47011 Valladolid, Spain. 2 Departamento de F́ısica de la Materia Condensada, Uni- versidad de Valladolid, 47011 Valladolid, Spain. 3 Departamento de F́ısica Aplicada, Universidad de Val- ladolid, 47011 Valladolid, Spain. with little to no training can easily use the sys- tem in physics experiments without difficulty, but also, that its construction does not require special skills. Flexibility implies that the system should be portable enough to work on different types of ex- periments. Finally, its extensibility will allow users to include additional sensors in the platform to en- hance its capabilities and to use it in new experi- ments. In order to obtain an innovative platform as well as to add sharing features to it, almost exclusively open-source hardware and software components are used. Within this approach, the physics teacher community can work in open projects that can be used by other teachers, thus reducing the work of designing experiments with the platform. Follow- ing this condition, the characteristics of the system are published under a public GNU license in the GitHub repository [1]. All the technical details of the platform hardware and software are detailed in that repository: software code, assembling dia- grams and technical characteristics of the compo- nents. We initially decided to include sensors in the platform that measure kinematic magnitudes: ac- celerometer, gyroscope, distance sensor and light- gate sensors. Other sensors, such as a magnetome- 100004-1 Papers in Physics, vol. 10, art. 100004 (2018) / C. Llamas et al. Figure 1: A conceptual diagram showing the main com- ponents of the system. It comprises a mobile unit that includes several sensors (su, sv, ...) controlled by an Ar- duino board and a portable unit with a Raspberry Pi that communicates with the Arduino and establishes a Wi-Fi network. It can also host additional sensors (sx, sy, ...). The measurements of all the sensors can be transferred into the users’ devices as series of vectors M via a web front-end implemented in the Raspberry Pi. ter, a barometer, a thermometer, etc., can be easily added later. Figure 1 shows a diagram of the use of the platform in a physics experiment: the plat- form includes a mobile unit, which can be attached to a mobile body, containing sensors (su, sv,... in the figure) and a portable unit responsible for the Wi-Fi connection that allows the user to access the measured data, but which can also include addi- tional sensors (sx, sy,... in the figure). Measured data are collected by the portable unit and orga- nized in vectors (M = (ti, xi, ...)) in the figure) also containing the time stamp of the measure- ments. Whenever it is desirable and possible, the mobile unit can be attached to a body in order to study its movement. Then, the connection between the mobile and the portable units must be based on wireless communications, allowing the studied body and the attached unit to move freely. In our case, communications between the mobile and the portable units are performed via Bluetooth. The design of the mobile and the portable units was based on previous works of embedded systems [2] and they comprise the following elements: • Mobile unit: An Arduino Nano v3 controls a set of sensors. The version that has been tested in laboratory experiments included an infra-red line tracker, a motion processing unit consisting of 3-axis accelerometer, gyroscope and an ultrasound distance sensor. The AT- MEL serial interface of the microcontroller is connected to a HC-SR06 Bluetooth device. A LiPo battery supplies power to all the system. In its current design, the motion processing unit can be replaced by a similar one that also includes a 3-axis magnetometer together with the accelerometer and gyroscope which would permit to have a inertial measurement unit with 9 degrees of freedom. This system is pro- grammed in Arduino 1.6 [3] and it implements a simple protocol through a serial wireless con- nection, which is established by using Blue- tooth connectivity that allows the initializa- tion of the microcontroller as well as starting and stopping data acquisition. The main speed limitation in data measurements of the system is due to the Bluetooth connection. Figure 2 (top) shows an implemented mobile unit used in some physics experiments described below. • Portable unit: It consists of a Raspberry Pi2 with Raspbian Jessie [4] as an operating sys- tem. The core process of the unit is pro- grammed in Go [5] and it governs the over- all system as well as offering a web front-end. This unit supports the Wi-Fi and bluetooth connections. The data recorded in the mea- surements are stored in a SD card, constituting the local persistent storage unit. These data can be accessed and retrieved by the users’ laptops or smartphones via Wi-Fi connection. Additionaly, the portable unit can also allocate other wired connected sensors using the GPI of the Raspberry Pi. In the current configuration of the system, four infrared emitter-receivers are connected to it. These can be used, for example, to measure instant speed at differ- ent points along the trajectory of a body. The unit can be powered by an ordinary USB bat- tery, allowing to do physics experiments out- side the laboratory. Figure 2 (bottom) shows the portable unit. 100004-2 Papers in Physics, vol. 10, art. 100004 (2018) / C. Llamas et al. Figure 2: Mobile (top) and portable (bottom) units of the system. Portable unit shows the connections of four additional infrared sensors attached to it (connections A, B, C, and D in the figure). III. Use in the laboratory The system described above can be used in differ- ent ways in the physics laboratory depending on the users’ skill and knowledge of physics. We have tested the platform in two basic experiments: an air track in order to study an uniformly acceler- ated movement and a pendulum to analyze periodic motion and to obtain the gravity acceleration. Fig- ure 3 shows the mobile and portable units being used in the air track experiment. In this experi- ment, the mobile unit included a 3-axis accelerom- eter, a 3-axis gyroscope and an ultrasonic distance sensor. In addition, four static infrared beacons were placed at fixed points of the trajectory and connected to the portable unit. The sampling fre- quency was about 25 samples/s (∆t ≈ 0.0394 s). This frequency was the result of a compromise be- tween the measuring capabilities of the Arduino and the data communication limitations between the Arduino board and the Raspberry, using the bluetooth connection. With the arrangement of sensors used in the experiment, users can measure the cart acceleration (accelerometer), average ve- locities between different points (infrared beacons), and the change in the position with time (ultra- sound sensor and infrared beacons). From the data Figure 3: Photography of an air track experiment us- ing the platform. While the mobile unit is on the mov- ing cart, the portable unit stays on the table with four static infra-red beacons connected to it. recorded by the different sensors, the user can an- alyze the uniformly accelerated movement and the relationships between kinematics magnitudes. On the other hand, in a pendulum experiment, users can combine the accelerometer and gyroscope mea- surements to study the acceleration and speed in different points and the periodic dependence of both magnitudes. Infrared beacons can also be used to measure the passage of time at different points of the pendulum trajectory and enrich the physical measurements. See [6] for more details on an air track experiment. Recorded data are stored in the SD card as a plain CSV file with data of all the sensors used in the experiment. The CSV files are transferred to the users’ computer or mobile devices using the Wi-Fi established by the portable unit. The rows of the CSV file are tagged with the acquisition time, in order to ease the analysis of the data by sim- ply importing the file on any spreadsheet program. Figure 4 shows some results of the measurements with the air track. The measurements of the ultra- sound distance sensor and the component of the ac- celerometer along the direction of the movement are represented as a function of time. From the data shown there, it can be observed how the experimen- tal noise of the ultrasound sensor increases notice- ably with the distance to the reflecting screen. We have checked this noise and, according to our exper- 100004-3 Papers in Physics, vol. 10, art. 100004 (2018) / C. Llamas et al. 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 52 54 56 58 60 62 -2 0 2 4 6 8 10 12 14 y=0.8 - (1/2)(0.2)(t-56.75) 2 average acceleration a=-0.2 m/s D is ta n c e ( m ) A c c e le ra ti o n ( m /s 2 ) t (s) Distance Acceleration az Figure 4: Example of combined data recorded with the platform in an air track experiment. The dependence of the distance and the acceleration along with the di- rection of movement recorded in the same experiment are shown jointly. iments, it is due to the air exiting from the air track holes. Reducing or eliminating the airtrack pump- ing, that noise drastically decreases, as well as when the distance between the sensor and the reflecting screen decreases. This can be seen as a possible limitation of the used sensor, which can be solved using, for example, an optical distance sensor. The superposition of the data from the accelerometer and distance sensors allows a clear identification of the collision events between the cart and a rub- ber band at the end of the air track. From the diference in distances reached after consecutive re- bounds (marked as example in the figure) users can obtain the restitution coefficient of the collision. Complementary, from the accelerometer data, users can obtain the change in speed during each collision and compare that result to the one obtained by analizyng the maximum distance before and after the bounce. As an illustrative result, a parabol- lic curve y = 0.8 − (1/2)0.2(t − 56.75)2 is shown in the figure. The distance 0.8 was chosen to dis- place a little the theoretical curve upwards over the experimental points for clarity. The acceleration - 0.2 m/s2 corresponds to the average acceleration measured by the accelerometer sensor as shown in the figure. The agreement between different sen- sor data can help users to investigate relationships between different magnitudes in an experiment. IV. Discussion A cheap open-source system to be used in simple experiments has been developed. It comprises the hardware and software of a sensorized platform. The technical characteristics and the control soft- ware of the system can be downloaded for free from the Github repository [1]. The system permits the measurement of different magnitudes in the same experiment and the analysis of various phenomena. The electronic components used in the system can be acquired on the Internet by less than 100e, and additional cheap sensors can be also included. Un- like commercial sensor systems, this one constitutes an extensible and customizable platform that can be modified by adding other sensors and includ- ing other software characteristics. The use of the Githup repository also allows the collaboration be- tween users that can add new characteristics to the platform. Acknowledgements - This work has been sup- ported by University of Valladolid teaching innova- tion program under grant PID2016 82. [1] C Llamas, J Vegas, M Á González, M Á González, https://github.com/percomp/OSHIWASP, last accessed September 4, 2017. [2] C Llamas, M Á González, C Hernández, J Ve- gas, Open source hardware based sensor plat- form suitable for human gait identification, Pervasive Mob. Comput. 38, 154 (2017). [3] https://www.arduino.cc/en/Main/Software, last accessed September 5, 2017. [4] https://www.raspbian.org/, last accessed September 5, 2017. [5] https://golang.org/, last accessed September 5, 2017. [6] M Á González, A Gómez, M Á González, Smartphones in the air track, examples and difficulties, (unpublished). 100004-4