This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Measuring the speed of sound
#1
Attached is a simple experiment for measuring the speed of sound (in air) with the help of an Arduino Nano 33 BLE Sense Rev2 and the ultrasonic distance sensor HC-SR04. The idea is pretty trivial: the HC-SR04 sends out a supersonic signal and by measuring the time it takes to detect the echo as reflected on a hard surface at a known distance (set by the user) we can compute the speed of sound (c_exp=2*d/t). By measuring the temperature and humidity at the same time with the onboard sensors of the Nano one can also calculate a theoretical speed of sound (c_theo=331.4+0.6*T+0.0124*H) and compare the result versus the experimentally determined value. Additionally, one can measure how the speed of sound varies as the temperature and humidity of the air changes, for example by continuously taking readings outside during the day (or night).

Notes
1. If you plan to use the original Nano 33 BLE Sense you will need to adjust the code in the "speed_of_sound_v1.ino" file as the temperature/humidity sensor has changed in the Rev2 edition (HS3003 vs HTS221).
2. The onboard temperature sensor of the Nano is slow to adapt to temperature changes of the surrounding air. It is advisable to add a thermistor or some other external sensor to the setup in order to capture temperature changes as close to real time as possible. If you decide to do so, you can use the attached  "speed_of_sound_v1_thermistor.ino" file and adjust the code to match your thermistor/external sensor.
3. I tested the setup with a battery operated Nano 33 BLE Sense Rev2 despite the fact the standard HC-SR04 sensor requires 5V to operate. Even with the 3.3V supply from the board, the sensor performed as expected.

Edits
28/02/2024: The phyphox file has been updated to correctly plot the theoretical speed of sound value vs time.

       


Attached Files
.txt   speed_of_sound_v1_thermistor.ino.txt (Size: 4.09 KB / Downloads: 39)
.txt   speed_of_sound_v1.ino.txt (Size: 3.76 KB / Downloads: 46)
.phyphox   speed_of_sound_plot_v1.phyphox (Size: 16.26 KB / Downloads: 45)
Reply


Messages In This Thread
Measuring the speed of sound - by terrain_inconnu - 02-19-2024, 08:21 PM
RE: Measuring the speed of sound - by solid - 02-19-2024, 09:12 PM
RE: Measuring the speed of sound - by Aewolframio - 03-01-2024, 12:28 AM
RE: Measuring the speed of sound - by Aewolframio - 03-01-2024, 01:57 PM

Forum Jump: