Back
 JST  Vol.11 No.4 , December 2021
Measurement of Acceleration Due to Gravity Using Arduino and Ultrasonic Sensor
Abstract: In this study, a simple Arduino-based experiment was designed to examine the acceleration of the object during free fall and to calculate the value of “g” (acceleration due to gravity). Experimental data on the free fall of a plastic box through the air was gathered with the help of an ultrasonic distance sensor (HC-SR04). Readings were taken at different intervals during the fall to obtain distance time curves. Acceleration during the free fall was then determined by applying the standard kinematic equations. The shape of the distance-time graphs obtained from the experimental setup was in good agreement with the predicted graphs and the calculated values of g lie within the expected range. After repeated experiments, value of gravitational acceleration was found to be 9.805 m/s2. Hardware and software prepared for the experiment are sufficient to examine movement of ordinary objects during free fall, therefore the experiment can be easily settled in a laboratory for the purpose of learning and teaching.

1. Introduction

One important problem in School and High School labs (especially in developing countries) is unavailability of modern devices to acquire data. Manual ways to record readings are being used which consume a lot of time and are less accurate [1]. In a recent study, it is proposed by Chen et al. that if the general labs could be equipped with microprocessors and mobile data collection tools, the trend of working in lab will be directed more toward better data analyses instead of spending a lot of time in data collection. This will not only reduce time needed for data acquisition but will also increase precision and accuracy of the data. Moreover, students will get exposure to the practical use of modern technology [2]. One such bridge between the electronic and mechanical gadgets is made by Arduino which began in 2005 as a tool for students at the Interaction Design Institute Ivrea, Italy, aiming to provide a low-cost and easy way for both students and professionals to create devices that interact with the environment using various types of sensors and actuators. Common examples of such devices intended for beginner hobbyists include simple robots, automated path finding vehicles, thermostats and motion detectors. The simplest and easy to use circuit board available is the Arduino UNO which is equipped with sets of digital and analog input/output pins that may be interfaced to various sensors, expansion boards or other circuits. The board can be powered by the USB cable or by an external 9 volts battery, though it accepts voltages between 7 and 20 volts and is programmable with Arduino IDE (Integrated Development Environment) computer language/software. Therefore, Arduino UNO can provide an easy way to automate and improve various physics lab experiments. Recently, one such work was done by U. Sari who prepared an experimental setup for the calculation of coefficients of friction by the movement of a wooden block on an inclined plan [3].

Among the basic concepts of physics, gravity or gravitation is of utmost importance which is a natural phenomenon by which all things having mass (including planets, stars, galaxies, and even light) are attracted to (or gravitate toward) one another [4] [5]. The gravitational attraction of the original gaseous matter present in the Universe caused it to begin coalescing and forming stars and caused the stars to group together into galaxies, so gravity is responsible for many of the large-scale structures in the Universe [6] [7]. Gravity has an infinite range, although its effects become weaker as objects get further away. On Earth, gravity gives weight to physical objects, and is also necessary for our motion on the surface of the earth. Without gravity, we would have no weight and would not be able to walk around on the earth. Earth attracts every object towards its center with a force which is given by Newton’s law of universal gravitation. Due to this force every object in our daily life falls downwards when released from a height. Velocity of the freely falling object increases at a constant rate which is termed as acceleration due to gravity (g). In history, many experiments have been performed to determine the value of g, especially the famous experiment of Italian scientist Galileo which he performed at the leaning tower of Pisa, Italy. From these experiments scientists have been able to accurately determine the value of g which came out to be 9.8 m/s2 [4] [5]. Now, after having the availability of microprocessors, sensors and data analysis softwares, it is an interesting task to develop an experimental setup to determine the value of gravitational acceleration for a freely falling body with the aid of modern data acquisition and data analysis tools.

In the present work, we have used Arduino UNO and ultrasonic distance sensor HC-SR04 to measure distance of freely falling body at different intervals of time. Software’s like Microsoft Excel, Origin pro and DESMOS were used to plot the graphs for data analysis. Slope of the distance time curves was determined from the data which was then used in Newton’s equations of motion to calculate the acceleration due to gravity. This experiment will not only enhance the interest of students in physics experiments but will also allow them to verify and understand many basic science concepts like sound waves, value of g, Newton’s equations of motion, law of universal gravitation, practical implementation of calculus, derivatives and some computer programing.

2. Theoretical Background

According to Newton’s law of universal gravitation, every object in the universe attracts other objects with a force given by

F = G M 1 M 2 r 2 (1)

Here F is gravitational force, G is gravitational constant, M1 and M2 are the masses of the objects and r is the distance between their centers [4] [5]. Earth attracts every object towards its center with a force that can be calculated by using the above relation. For the system of earth and an ordinary object (such as a tennis ball) of mass m, we get

F = G M e m R e 2 (2)

Here Me and Re are mass and radius of the earth. Since the distance between the centers of earth and a tennis ball placed near the surface of the earth is nearly equal to the earth’s radius, therefore we replaced the distance r with Re. Combining the constants into a single constant termed as g we can simplify the above relation as

F = m g (3)

Comparing this expression with Newton’s 2nd law of motion (F = ma), it becomes clear that g is the acceleration for a freely falling body under the action of earth’s gravity, i.e., the velocity of object keeps on increasing with an increment equal to g in each second as long as the object is falling toward the earth.

Motion of the freely falling object can also be analyzed by using the Newton’s equations of motion which are

v f = v i + a t (4)

v f 2 = v i 2 + 2 a ( y f y i ) (5)

y f y i = v i t + 1 2 a t 2 (6)

Here, v i , v f , y i , y f , a , t are initial velocity, final velocity, initial height, final heigh, acceleration and time. If the object starts from rest i.e., v i = 0 , then Equation (6) becomes

y f = 1 2 a t 2 + y i (7)

This is the equation of a straight line ( y = m x + c ) . Therefore, the graph of the distance of a freely falling object from a fixed point versus t2 should be a

straight line, whose slope will be equal to the half of the acceleration ( m = 1 2 a ) .

According to Equation (1), force of gravity should increase as the distance between the centers of the objects decreases. In the present case, we made the experimental setup in which the maximum change in object’s height is less than 1 m which is negligible compared to the total distance between the object’s and earth’s centers. Therefore, the gravitational force and hence the acceleration due to gravity can be taken as constant during the motion.

3. Experimental Setup

The apparatus used for collecting the data was constructed from a wooden frame which was 92 cm heigh and 25 cm wide as shown in Figure 1. Arduino UNO circuit board [8] and an HC-SR04 ultrasonic distance sensor [9] were used for data collection and are shown in Figure 2. Arduino UNO was placed on upper face of top plate and ultrasonic sensor was placed in such a way that it points downward. Sensor was electrically connected to Arduino UNO using breadboard and 4 jumper wires. Arduino UNO was connected to computer using the USB cable. Pin configuration for sensor and Arduino is shown in Figure 2. Here, Vcc, GND, Trig, Echo are the power supply, ground, trigger (input) and echo (output) ports of the SR04 sensor. These pins are connected to 5 V, GND,

Figure 1. Experimental setup for the determination of acceleration due to gravity during free fall motion.

Figure 2. Arduino UNO and HC-SR04 ultrasonic distance sensor [8].

pin 13 and pin 12 of the Aurdino board. Magnitude of Vcc determines the strength of ultrasonic signal generated by SR04. Trig and Echo are the input and output terminal of sensor. Once pin 13 is trigged to on state, SR04 generates an ultrasonic wave which travels and reflects back toward the sensor. If the reflected signal strikes the receiver, SR04 generates a signal in the Echo pin which is transferred to pin 12 of Arduino board and is recorded in the system.

By using the value of speed of sound and the time interval between trig and echo signals, distance of the object can be calculated from the relation

s = v t (8)

Sensor SR04 works best between 2 cm - 400 cm within a 30 degree cone, and is accurate to the nearest 0.3 cm. Sensor will transmit signal and will then receive the signal reflected from the object’s surface. By measuring the time taken by signal, its distance can be calculated (knowing the speed of sound). In the present experiment a plastic box of mass 156 g, length 22.5 cm, width 16.8 cm and height 6.8 cm was dropped from a height of 97 cm. Its distance from the sensor was recorded at various intervals of time during its downward motion under the action of gravity. As explained in the previous section, distance versus square of the time graph can be used to determine the acceleration during the motion (acceleration must be equal to two times of slop of the distance versus time squared graph). Software Arduino IDE was used to operate Arduino and sensor. This softwere is free and can be downloaded and installed on any computer. Origin pro 9 and DESMOS were used for data plotation and analysis.

4. Arduino Program

Arduino UNO was programed and operated by using software Arduino IDE. Arduino code written in Arduino IDE is given in Figure 3.

On the computer the compiler compiles this code and sends it to the Arduino. After running the Arduino motherboard code, it sends back two experimental measurements to the computer after each 100 ms. Thus, the time (t) of the object that moves away from the sensor and the distance between the sensor and the object are measured. The Arduino Serial Monitor will display the distance between the object and the sensor and the time when the reading was taken. The data can be easily read and written in an Excel table for further analysis.

Figure 3. Arduino program code.

5. Results

The plastic box was left to fall under the action of gravity and its distance from the sensor was measured after every 100 ms. Experiment was performed several times to attain accurate results. Data points of one such best run are presented in Table 1, while Table 2 shows the same data converted to standard units i.e., the time in seconds and distance in meters. Data points of Table 2 are plotted in Figure 4. Slope of this graph gives the velocity of the object at any time. Here it is important to mention that the increasing slope implies that the velocity of the object keeps on increasing during the motion (as explained in the introduction section).

To calculate the acceleration, data points of Table 2 are plotted as distance versus time squared (Table 3) graph and are presented in Figure 5. This is nearly a straight-line graph as expected. Slope of this graph is equal to half of the acceleration. Therefore, we measured the slope of this line using DESMOS and multiplied it by 2 to get the value of acceleration due to gravity which came out to be ~9.8 m/s2 which is significantly accurate.

Table 1. Data of free fall motion experiment.

Table 2. Data of free fall motion experiment (in SI units).

Table 3. Distance and t2 data for the free fall motion experiment.

Figure 4. Distance versus time curve for the free fall motion experiment.

Figure 5. Distance versus t2 curve fitted with the straight line for the free fall motion experiment.

6. Explanation of c

In the equation of straight line (y = mx + c), c is the point of intersection of line and the y axis. On y-axis we have distance so c will be equal to that initial distance from which we dropped the object. In our case, we dropped the object from 5 cm or 0.005 m, as shown in Tables 1-3. That is why c is taken as 0.005 in all the calculations. Initial distance and hence the value of c can be reduced to 2 cm, as this is the minimum distance to which SR04 can determine the distance of the object accurately.

7. Summary and Conclusion

A simple Arduino based experiment was designed to measure the acceleration caused by gravity during the free fall motion of the object through air. This physics experiment can be carried out to collect data in an inexpensive and efficient way using an Arduino UNO board, an HC-SR04 ultrasonic distance sensor and a breadboard. A close match can be seen between the obtained distance-time experimental data and the theoretical model. We hope that the teachers will be able to create experiments with the system in this work and can easily examine the free fall motion for objects and determine the free fall acceleration.

Cite this paper: Shoaib, M. , Iqbal, A. and Imran, M. (2021) Measurement of Acceleration Due to Gravity Using Arduino and Ultrasonic Sensor. Journal of Sensor Technology, 11, 55-63. doi: 10.4236/jst.2021.114004.
References

[1]   Liu, C.-Y., Wu, C.-J., Wong, W.-K., Lien, Y.-W. and Chao, T.-K. (2017) Scientific Modelling with Mobile Devices in High School Physics Labs. Computers & Education, 105, 44-56.
https://doi.org/10.1016/j.compedu.2016.11.004

[2]   Chen, S.F., Lo, H.-C., Lin, J.-W., Liang, J.-C., Chang, H.-Y., et al. (2012) Development and Implications of Technology in Reform Based Physics Laboratories. Physical Review Physics Education Research, 8, 020113.
https://doi.org/10.1103/PhysRevSTPER.8.020113

[3]   Sari, U. (2019) Using the Arduino for the Experimental Determination of a Friction Coefficient by Movement on an Inclined Plane. Physics Education, 54, 035010.
https://doi.org/10.1088/1361-6552/ab0919

[4]   Halliday, D., Resnick, R. and Walker, J. (2013) Fundamentals of Physics. John Wiley & Sons, Hoboken.

[5]   Serway, R.A. and Jewett, J.W. (2018) Physics for Scientists and Engineers. Cengage Learning.

[6]   Schulz, N.S. (2007) From Dust to Stars: Studies of the Formation and Early Evolution of Stars. Springer Science & Business Media.

[7]   Figer, D.F. (2003) Massive Stars and the Creation of Our Galactic Center. Symposium-International Astronomical Union, Cambridge University Press, 487-496.
https://doi.org/10.1017/S0074180900212680

[8]   Arduino Website.
http://arduino.cc

[9]   2014 HC-SR04 Datasheet Website.
https://www.electroschematics.com/8902/hc-sr04-datasheet/

 
 
Top