Calculate the velocity of sound by measuring the pressure variation with distance. Sound travels as a series of compressions and rarefactions. Figure shows the High and Low pressure regions along the direction of travel, along with output of a pressure sensor at corresponding positions. We can display the pressure variation at any point with respect to the variation at the starting point. The phase of the microphone output waveform changes as you change its distance from the Piezo. Moving by one wavelength changes the phase by 360 degrees. If the phase changes by X degrees for D cm change in distance, the wavelength is given by λ = 360× D/X .
The velocity of sound can be calculated by multiplying the frequency with this. The Piezo buzzer is driven by SQR1 and it is kept in front of the built-in microphone. The MIC output is connected to A1. The phase difference between the driving waveform and the MIC output is measured for different distances between the buzzer and the microphone.