Measuring Sound Speed with Arduino

Abstract: Arduino is an open-source electronic prototyping platform. With Arduino and the corresponding sensors, we can design experimental devices for scientific inquiry. This article introduces the application of Arduino and sound sensors in sound speed measurement experiments, using the design, production, and operation of a sound speed measurement device as an example, providing ideas for our own hands-on experimental device design for scientific exploration.

Keywords: Arduino, sound speed measurement, sound sensor, scientific inquiry

The Arduino board is an open-source hardware circuit production platform. It is not an exaggeration to say that it is like a computer, but the computers we usually use are much more powerful. After all, an Arduino UNO board is only about the size of a credit card, has no display, and is inexpensive; Arduino is like a miniature computer.

Although the Arduino board is small, its functions should not be underestimated. The Arduino board includes a microcontroller and related circuits. Microcontrollers are almost ubiquitous in our lives, making the devices around us smarter. The access control systems in communities and the automation control of home appliances like refrigerators, washing machines, and air conditioners all use microcontrollers. Nowadays, more and more people use Arduino to make robots, create interactive art, and control 3D printers. Furthermore, we can also use Arduino to design experimental devices for scientific exploration.

There are many methods to measure the speed of sound in air, commonly used in laboratories include the standing wave method, phase method, etc., but these methods have high theoretical and operational requirements for the experimenters. By using Arduino and sound sensors, we can create our own experimental devices to measure the speed of sound in air.

1. Experimental Materials

The experimental materials are listed in the table below. It should be noted that the sound sensor module used can detect analog sound.

Table 1 Material List

Equipment

Quantity

Arduino UNO

1

IO Expansion Board

1

Analog Sound Sensor

2

Touch Sensor

1

2. Experimental Scheme

Connect the two sound sensor modules to the analog input pins A1 and A2 of the Arduino UNO through the IO expansion board. For ease of distinction, we will refer to the sound sensor connected to pin A1 as Sound Sensor 1 and the one connected to pin A2 as Sound Sensor 2. The touch sensor module is connected to digital input pin 3 to control the program. The reason for choosing a touch sensor instead of a button is to avoid interference from the sound produced when pressing a button. The device is shown in Figure 1.

Measuring Sound Speed with Arduino

Figure 1 Sound Speed Measurement Device Diagram

Sound Sensor 1 and Sound Sensor 2 are placed in a straight line at a distance d from each other, with Sound Sensor 1 being closer to the sound source and Sound Sensor 2 being farther away. A sound is produced directly in front of Sound Sensor 1. When the sound is received by Sound Sensor 1, Arduino records the system running time t1. When the sound is received by Sound Sensor 2, Arduino records the system running time t2. The time taken for sound to travel from Sound Sensor 1 to Sound Sensor 2 is t = t2 – t1, and the speed of sound in air can be calculated using v = d/t.

The distance d between Sound Sensor 1 and Sound Sensor 2 is obtained through actual measurement. We can send the measured value of d to Arduino through the serial port and write the function module get_distance in the Mixly programming software as shown in Figure 2.

Measuring Sound Speed with Arduino

Figure 2 get_distance Function Module

In our experimental environment, there will inevitably be some environmental noise. To avoid the impact of environmental noise on the measurement, we need to determine what volume value Arduino considers as detecting the measured sound rather than environmental noise. Therefore, we need to collect the maximum volume of environmental noise in the environment through multiple measurements to obtain the maximum volume values max1 and max2 collected by Sound Sensor 1 and Sound Sensor 2, respectively. If the volume values collected by Sound Sensor 1 and Sound Sensor 2 during the experiment are greater than max1 and max2, it indicates that the measured sound has reached the position of the corresponding sound sensor. We write the background noise volume testing function volume_test as shown in Figure 3.

Measuring Sound Speed with Arduino

Figure 3 volume_test Function Module

The variable declaration is shown in Figure 4, where the variable state is used to store the detection status, with a value of 0 indicating “sound detection in progress” and a value of 1 indicating “detection completed”.

Measuring Sound Speed with Arduino

Figure 4 Variable Declaration

The main program is written as shown in Figure 5. The program will achieve: When Arduino starts, the operator can send the distance data between the two sound sensors to Arduino, with the unit being “meters”; next, the device will detect the maximum volume of environmental noise; after the environmental noise detection is completed, the operator produces sound directly in front of Sound Sensor 1, and Arduino calculates the speed of sound based on the measured data and prints it in the serial monitor. After the measurement is completed, lightly touch the touch sensor, and the system will enter the measurement state again. If you need to change the distance value between the sound sensors, you can restart Arduino to upload the distance d value again.

Measuring Sound Speed with Arduino

Figure 5 Sound Speed Measurement Main Program

3. Measuring Sound Speed

When Arduino starts, the serial monitor displays “Please input the distance:” The actual measured distance between the two sound sensors is 0.90 meters. The distance data of 0.90 is sent to Arduino through the serial monitor, as shown in Figure 6.

Measuring Sound Speed with Arduino

Figure 6 Sending Distance Data to Arduino

When the serial monitor displays “Testing……”, it indicates that the detection of the maximum value of environmental noise is in progress.

Measuring Sound Speed with Arduino

Figure 7 Detecting Maximum Value of Environmental Noise

When the serial monitor displays “Measuring……”, the sound speed measurement begins. A short sound is produced by clapping hands directly in front of Sound Sensor 1. The serial monitor immediately prints the time t for the sound to travel between Sound Sensor 1 and Sound Sensor 2 and the calculated speed of sound data, then displays “Done!” to indicate that the measurement is complete. The measured speed of sound in air this time is 349.38 m/s, as shown in Figure 8.

Measuring Sound Speed with Arduino

Figure 8 Sound Speed Data in Serial Monitor

4. Summary and Discussion

This experiment should be conducted in a quiet environment to reduce interference from environmental noise. Since the speed of sound in air is greatly affected by temperature, humidity, and atmospheric pressure, the data obtained is the speed of sound data under specific environmental conditions. Therefore, recording the environmental conditions is very important. In the next improvement step, we can add relevant sensors to monitor environmental conditions. Since the volume of sound will attenuate during propagation, the triggering ability of the program when the measured sound reaches different sound sensors is different. To reduce the systematic error caused by this, the produced measured sound should be as short and loud as possible, and the distance between the two sound sensors should be appropriately far while ensuring that the farther sound sensor can receive the sound. Of course, we can also consider optimizing from the program algorithm perspective.

This device simplifies the process of measuring sound speed, providing more possibilities for sound speed measurement methods, and also reflects the application value of Arduino and sound sensors in scientific inquiry experiments.

[References]

[1] Massimo Banzi, Michael Shiloh. Getting Started with Arduino. 3rd Edition. Beijing: People’s Posts and Telecommunications Publishing House, 2016.

[2] John Boxall. Arduino Workshop. Beijing: People’s Posts and Telecommunications Publishing House, 2014.

[3] Jia Haoyun. Researching Free Fall Motion with Arduino. Radio, 2017(11).

Leave a Comment

Your email address will not be published. Required fields are marked *