I am working on a ultrasonic gas analyzer and I used a hc-sr04 sensor for the first test.
To minimize reflection problems I desoldered the transducers and fixed them face to face in a tube.
So the distance is fixed and I measure the time of flight.
From these values I can calculate the speed of sound.
Temperature is also measured. And at a given gas mixture (for example air) the speed of sound can be calculated.
When I compared the theoretical and measured values at a given temperature, there was a big difference.
The only thing I can do to calibrate my setup is to change to distance in my code, until the theoretical and measured values are identical.
The real distance between the tx and rx is ~150mm. In my code I had to modify it to ~133mm.
So the difference is quite big.
I also measured the wave form of the hc-sr04 with a scope, the real frequency is ~39.22 kHz.
But the speed of sound in a material is not influenced by the frequency.
So, where this big difference comes from?