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: 33)
.txt   speed_of_sound_v1.ino.txt (Size: 3.76 KB / Downloads: 38)
.phyphox   speed_of_sound_plot_v1.phyphox (Size: 16.26 KB / Downloads: 39)
Reply
#2
Hi, it is a good experiment. Just to note that the Nano 33 BLE Sense has an incorporated microphone and can be used in the phyphox classical experiment on measuring the sound speed instead of the second smartphone.

Look my "Double acoustic stopwatch and speed of sound" 
https://phyphox.org/forums/showthread.php?tid=1252

With Brest wishes
Mikhail
Reply
#3
Hi Mikhail, despite the advantages of using an ultrasonic sensor as in my case (e.g. continuous readings, statistics etc), I really like the unbeatable simplicity and elegance of the acoustic stopwatch approach.
Reply
#4
Hi terrain_inconnu, a good example of using an Arduino Nano 33 BLE Sense to communicate with Phyphox.

It's also an excellent example of the use of Phyphox's graphics capabilities that I plan to take note of for my future work.

The accuracy in measuring the speed of sound is very good and I would like to propose to you to use this same arrangement to measure the speed of sound but for gases other than air.

If you place the ultrasonic emitter at the end of a tube of known length and opposite this face of the tube, place a flat surface, and put an inlet and outlet on this tube to fill it with some gas other than air, you could measure the speed of sound for this gas. To explain myself better, I leave you with a reference to a device that I designed, also using an ultrasound sensor to make precisely this type of measurements in gases other than air.

https://projecthub.arduino.cc/aewolframi...hem-7035c3

At that time I didn't use Phyphox because my Arduino wasn't BLE (Arduino Nano V 3.0 CH340) but I think that based on the files you shared I might think about buying an Arduino Nano 33 BLE Sense Smile

Best regards

Alberto
Reply
#5
Thank you Alberto, that's high praise coming from you. I have actually studied your work on measuring the speed of sound in gases (but also on DTA) while looking for ways to overcome the following issue: I initially tried to measure the ping duration with the standard pulseIn function but this specific function seems to freeze the ongoing BLE communication between the Nano and the phone leading to an error message in Phyphox. I solved this by using the NewPing library instead. As far as the Arduino Nano 33 BLE Sense Rev2 is concerned, it is indeed a very resourceful and capable board with a great form factor.
Reply
#6
In fact, I also tried to use Phyphox to measure the speed of sound, but I ran into problems that were probably due to what you mention about ping and that in the end I didn't know how to solve.

Very good contribution you have made in the use of ultrasonic sensors with Phyphox.

Here is the link to the work I did at DTA using Phyphox that you mention in case anyone is interested.

https://www.instructables.com/Differenti...no-and-Ph/
Reply


Forum Jump: