Instrumentation for mechanical vibrations analysis in the time domain and frequency domain using the Arduino platform

In this paper, we use the Arduino platform together with sensors as accelerometer, gyroscope and ultrasound, to measure vibrations in mechanical systems. The main objective is to assemble a signals acquisition system easy to handle, of low cost and good accuracy for teaching purposes. It is also used the Python language and its numerical libraries for signal processing. This paper proposes the study of vibrations of a beam, which is measured by position, velocity and acceleration. An experimental setup was implemented. The results obtained are compared with analytical models and computer simulations using finite elements. The results are in agreement with the literature.


Introduction
The oscillatory phenomena are an object of study since man realized how important and how often they appear in our life.These phenomena are present from our speech and hearing due to mechanical waves up to our vision and digital communication, which are electromagnetic wave [1,2].
Undergraduate students in physics and engineering when studying vibrations generally study only theoretically, by models of ordinary differential equations and computer simulation by finite elements [3,4].However, making the experimental analysis of vi-brations in mechanical systems is no easy task, given the complexity of instrumenting and high costs.
In order to avoid the complexity experimental analysis an high cost involved in this work we propose the use of the Arduino platform and sensors, wich present satisfactory precision for educational purposes [5][6][7].The Arduino plays the role of data acquisition system of the sensors (accelerometer, gyrocope and ultrassound), very popularized with incresing use in smartphones and tablets [8].

Arduino
The Arduino is an open-source microcontroller board, which has become very popular among the general public by being easy to use, simple programming and low prices, making it a great tool to quickly assemble and test electronic prototypes [9].
In this paper we used a board Arduino Mega 2560 Rev. 3, based on the Atmel ATmega2560 micro controller.This board contains 54 digital pins I/O (input/output), of which 15 pins can be used as PWM outputs, 16 analog inputs and 4 serial ports.It can be powered either by USB port of a computer or by an external power source.
The purpose of this paper is to use the Arduino platform as data acquisition system.In order to allow access to undergraduate students in Physics and Engineering courses for the experimental study of mechanical vibration phenomena, through sensors like accelerometer, gyroscope and ultrasound.Since such sensors have low cost, because of the popularization of smartphones, tablets and other devices that use them widely [10][11][12].
The Arduino connection is made by the USB computer and arduino's port and receives information from sensors by analog and digital ports.The Fig. 1 shows the Arduino board used in this paper.
See Ref.
[13] for more detailed information about the device used.

Accelerometers
Accelerometers are devices capable of measuring accelerations which they are submitted according to a non-inertial observer [8].In this paper one use an accelerometer with MEMS (Microelectromechanical systems) technology wich is capable of generating small sensors that measure several physical quantities with satisfactory precision.In this paper we used the MPU-6050 accelerometer.The MPU-6050 accelerometer is a triaxial MEMS type device, that can be programmed to measure from 2 g to 16 g [14].The MPU-6050 sensor is mounted on the board GY-521 (Fig. 2a).The sensor board has a capacitor for filtering the signal, a LED indicator of operation and a voltage regulator which allows the sensor to be used with 5 V [14].The board set and accelerometer has 0.00173 kg.

Gyroscope
The gyroscopes are sensors capable of measuring the angular speed which are submitted.From concepts of rigid bodies dynamics it can be calculated the tangential velocity at the point of interest.By numerical differentiation it is possible to obtain the tangential acceleration.
The accelerometer and the gyroscope used in this paper are on the same chip, MPU-6050 (Fig. 2a).The gyroscope sensor has a measuring range of 2000°/s in the three axes x, y, z [14].

Ultrasound
The ultrasonic distance sensor measures the position of any object using a sound wave transmitter that sends an ultrasound wave and by the phenomenon of reflection a receiver receives part of the sound wave sent, thus can be calculated the distance to the object by kinematics, because of the speed of sound in air is known, so that the distance to the object is half the distance traveled by the wave.
The sensor used was the HC-SR04 (Fig. 2b) which according to the instruction manual [15] can measure distances from 2 to 400 cm with an accuracy of 3 mm.Unlike the accelerometer and gyroscope, the HC-SR04 does not need direct contact with the mechanical system.

Vibration beams
The mechanical system used in this paper is a beam, which will be done an analysis of vibrations by bending, due to a small initial displacement in the structure, initially considered a cantilever beam (Fig. 3a) of mass m and length l.It is known that the beam is a continuous system with infinite degrees of freedom.This paper has interest in obtain the first natural frequency of the beam, thus a discretization is made, reducing to an equivalent system with concentrated mass (Fig. 3d) and one degree of freedom.The same procedure is done for the propped beams (Fig. 3b) and the fixed beams (Fig. 3c).So one can write the equation of motion of the equivalent system according to Eq. ( 1).
The equation presented in Eq. ( 1) is a second order homogeneous differential equation, which is a vibration system free of external forces and damped [16].The terms m eq and k eq represent, respectively, the equivalent mass and rigidity equivalent.Such equivalents values depend of the method of attachment, the beam geometry and material.From now on these terms will be denoted by equivalent parameters.For a cantilever beam, the equivalent parameters are presented in Eqs. ( 2) and (3) [17,18].
From Eqs. ( 2) to ( 7) the term E is the Young's modulus of material, I is the second moment of area, l is the length of the beam and m' is the linear mass distribution of the beam (m/l).Thus, the first natural frequency [rad/s] of the system is obtained according to Eq. ( 8) The natural frequency in Hertz, A long study of the classical theory of beams can be seen in Refs.[17][18][19][20].

Finite element simulation
A modal analysis was made using the SolidWorks software for comparison.For the analyzed beam, we used two types of beams for simulation, a steel beam and another aluminum beam, with the same properties of the beams used in experimental analysis (Table 1).It is not purpose of this work detail this analysis because of it is a very well-documented analysis in the literature [20][21][22].The results are shown in Table 2.This type of analysis based on finite element it can be performed in various software used by the scientific community, there are commercial, student and free versions of these software.Fig. 4 shows the cantilever beam modeled on the software used and Fig. 5 shows the results of simulation in which are obtained the natural frequencies of interest.

Experimental analysis
For the experimental analysis was used two types of beams and its properties are described in Table 1.
For each beam three type of fixations were proposed for the vibration analysis: • Cantilever; • Propped; • Fixed.To fix the beams was used two clamps type C of 2".The experiment apparatus with the beams is shown in Fig. 6.
The purpose of the measurements is to obtain signals in the time-domain of the acceleration (accelerometer), angular velocity (gyroscope) and position (ultrasound sensor).As accelerometer and gyroscope are integrated on the same sensor, in the cantilever beam experiment the sensor was fixed in the free end of the beam with double-sided tape.In the propped and fixed beams experiments the sensor was positioned at the geometric center of the upper face of the beam.The described arrangements are shown in Fig. 7. Varanis et al.To obtain the magnitude of the position beyond the clamp type C of 2" was also used universal support in Delta, which has the function to fix the solderless breadboard and ultrasound distance sensor.In the case of the cantilever, the universal support in delta was positioned so that the ultrasonic sensor attached thereto was placed parallel to the beam.In the cantilever-supported and bi-cantilever cases, the universal support in delta was positioned so that the ultrasonic sensor was positioned parallel to the beam in center of the beam.Again, the described arrangements are shown in Fig. 8. Figure 9 shows the circuit diagram necessary for use of the sensor (accelerometer/gyroscope), it takes 4 cables for its connection to the board, the red cable is providing power for the board, connecting 5 V output of the Arduino to the VCC pin of the sensor.The green cable is responsible for binding of the "ground wire" connecting the two GND terminals present in Arduino board and the sensor.The black and white cables are responsible for conducting communication via the I2C protocol between the Arduino board and the sensor.The black cable connects the pins SDA present on the board and the sensor while the white cable connects the SCL pins.SDA and SCL means Serial Data and Serial Clock.The SDA pin effectively transfers data and the SCL serves for timing between the devices, so that the communication by SDA may have reliability.Both the sending and receiving of data is performed using the SDA line.A detailed study of the I2C protocol, can be seen in Ref. [23].

1301-5
Figure 10 shows the circuit diagram necessary for using ultrasound sensor distance, as the diagram shown in Fig. 9 too, it takes 4 cables for the connection to the board, the red cable is that is providing power to ultrasound sensor by connecting the output of 5 V of the Arduino to the pin VCC sensor.The Black cable is responsible for binding the "ground wire", linking the two GND terminal present on the Arduino board and on the ultrasound sensor.The white cable is responsible for sending an electrical signal to the sensor, which will trigger a sound wave in the direction of the beam, according to the configuration done through software, the pin responsible for sending the signal to the ultrasound sensor is digital pin 12, connected to the trigger pin.The yellow cable is responsible for sending the electrical signal generated by the reception of the reflected sound wave on the beam.In this process the Arduino calculates the round trip time of the sound wave and the distance from the sensor to the object.The settings of the above parameters are made through software programing by an element called sketch.The sketch is the name that Arduino uses for the program.It's the unit of code that is uploaded to run on the Arduino board.A more detailed study of the subject can be found in Ref. [24].
The acquisition of the signals was made with 2048 points and sampling frequency of 248 Hz, thus respecting the Nyquist criterion [25] with that one can obtain the acceleration, velocity and position magnitudes in the time domain.The MPU-6050 Sensor does not deliver the acquisitive signals with values in S.I. it is necessary make the conversion.For the accelerometer, this procedure is done by multiply- ing the signal elements by a conversion factor.This relationship is shown in Eq. ( 10) In Eq. ( 10) a z is the acceleration signal in S.I, g is the local constant acceleration of gravity.The factor 2048 is a sensor constant, this value is used for the range of +-16g.For other measuring range one should check the new constant in the sensor datasheet [14].
The signals obtained from the gyro sensor are also not delivered in S.I. and the conversion ratio is shown in Eq. ( 11) The factor of 16.4 is a sensor constant, this value is used for the range +-2000°/s.Again, for other measuring range one should check the new constant in the sensor datasheet [14].
In the case of the signal obtained through the ultrasound sensor conversion must be made from centimeters to meters.
An analysis of the signals in the frequency domain is performed.For such was used the FFT algorithm (Fast Fourier Transform) [24].The implementation of the algorithm is done in Python language using the scipy library and its signal processing tools (scipy.signal)[25].The graphs of the signals in the time domain and frequency domain are made using the matplotlib library [27].The FFT is applied to the acceleration signals, so to obtain the response in the frequency domain of the ultrasound and the gyroscope signals a numerical derivation must be aplied.For the numerical differentiation was used the numpy library [27].It is emphasized that any other computational tool can be used for this procedure, such as Matlab and Mathematica, for example.

Results
In the experimental procedure fifteen measurements were performed with each sensor (accelerometer, gyroscope, ultrasound), for each type of fixation proposed in aluminum and steel beams, thus obtaining a total of 270 signals.As mentioned above, signals were obtained with 2048 points and sampling frequency of 248 Hz, respecting the Nyquist criterion [25].Figure 11 shows the signal at time domain obtained from the accelerometer to a cantileversupported aluminum beam.
Figure 12 presents a sample signal in the frequency domain for the aluminum beam cantilever-supported with a value of 44,02 Hz.
Figure 13 shows the time domain signal of a sample obtained from a gyroscope sensor of the aluminum bi-cantilever beam.
Figure 14 presents a sample signal in the frequency domain, for the bi-cantilever aluminum beam with a of 63.89 Hz, for obtaining the response a conversion was made by multiplying each element of the signal to its respect distance to the beam sensor position to convert the angular velocity into linear velocity.The numerical derivation of the linear velocity signal was applied to obtain the acceleration signal and subsequent application of FFT.
Figure 15 shows the signal in time domain of the sample obtained with ultrasonic distance sensor to the cantilever steel beam.
Figure 16 shows a sample signal in the frequency domain, for cantilever steel beam with a value of 10.04 Hz, to obtain the frequency response a numerical derivation was applied twice in the position signal obtained through the ultrasonic distance sensor, then the FFT was applied.
Table 2 presents the results obtained in the experimental analysis for steel and aluminum beams and makes the comparison with analytical results and the finite element through computer simulation.

Conclusions and Prospects
The objective of this paper was to present a proposal instrumentation for vibration analysis in the time domain and in the frequency domain, for educational purposes, aimed at simplicity of operation, good accurate results and low cost.The Arduino platform was proved to be suitable for use as signal acquisition for educational system.The sensors proved to be suitable for the proposed application, to have good accuracy and very low cost.The use of the Python language for signal processing is justified to be a free-open-software and their libraries for numerical computation are widely used by the scientific community in various areas of knowledge.
Note that in Table 2, the experimental results are very close to the values obtained analytically and by computer simulation, with all the sensors.It is noticed that, in general, the best experimental values  are obtained using the accelerometer.This due to the fact that the signals obtained with ultrasound and gyroscope must be numerically derived for obtaining the acceleration magnitude and later applying FFT to obtain the response in the frequency domain.
In the accelerometer signals it's not necessary this differentiation procedure.
Although the results obtained with Arduino platform were satisfactory, current with the literature and with the results of the computer simulation, one should emphasize that the main application of this platform is the prototyping of electronic designs, therefore some problems may be encountered when this platform is used for the purpose of acquiring experimental data, such as excessive noise of some sensors in the measurements.In this work the ultrasound sensor presented this problem.Apart from that, more complex mechanical systems is recommended the use of specific acquisition systems.

Future work
As an extension of this work are proposed: • Use of other sensors, such as infrared and LED; • Improved data acquisition system through the use of computational platform Raspberry Pi in conjunction with the Arduino platform; • System application proposed to other mechanical systems; • Obtaining the system damping factor and other physical parameters and modes of the structure; • Introduction and analysis of external forces of the system [28]; • Study deformation in the system with the use of strain gauges and Arduino.

Figure 5 :
Figure 5: Result of modal analysis simulation.

Figure 9 :
Figure 9: Circuit diagram for the use of the sensor (accelerometer/gyroscope).

Figure 10 :
Figure 10: Circuit diagram for use of the ultrasound sensor.

Figure 11 :
Figure 11: Response in the time domain of the cantilever-supported beam in aluminum by accelerometer.

Figure 12 :
Figure 12: Response in the frequency domain of the cantilever-supported aluminum beam.

Figure 13 :
Figure 13: Response in the time domain of the bi-cantilever aluminum beam with gyroscope sensor.

Figure 14 :
Figure 14: Response in the frequency domain of the bi-cantilever aluminum beam.

Figure 15 :
Figure 15: Response in the time domain of the cantilever steel beam at ultrasound sensor.

Figure 16 :
Figure 16: Response in the frequency domain of the cantilever steel beam.

Table 1 :
Physical properties of the beams used in the experimental analysis

Table 2 :
Comparison between the results for obtaining the natural frequencies through analytical method, experimental method and finite elements method.