I recently installed an SR04 ultrasonic ranging unit in my 3200l water tank for level detection. This was connected to a Beagle bone Black, and the routine to measure tank level was triggered every 5 minutes. Each measurement cycle was repeated 10 times, and the result averaged. However, I found that the level reported reading became "noisy" as the tank level dropped from 100% to 50% and below. The reading was also significantly affected by temperature - the air space in the tank can get to 50C or more with 95%+ humidity as the tank is exposed to tropical sun. The beaglebone is also running several other tasks as well as reading the tank - BMS, VE-direct and VE-bus programs are also running. So part of the "noise" could well be random delays caused by the processor being busy with other tasks - the beaglebone does not have a hardware interval counter that could be used for timing the return pules from the SR04 module. The longer the return pulse takes, the more likely it is to be 'missed' due to other tasks being executed, leading to timing variations.
I've now resorted to an analogue sensor made from a 2" pulley and a 100 ohm 10 turn pot - driven by a weighted line to a float on the water. Housings for the pot, pulley and float were all 3D printed. This can directly connect to the Bone's ADC, using the ADC supply and ADC ground to bias the pot. So far this is delivering much improved results with no detectable noise or temperature influence.
Whilst this setup only works for stationary tanks, it is relatively simple to implement - only the pulley diameter needs to be calculated for the height of the tank to achieve ~10 turns from full to empty.
I did try to look up articles on the effect of temperature and humidity on the speed of sound, but could not really come up with a definitive answer. The variation in measurement was also much greater than the articles seemed to suggest.
So if you have a large tank and the temperature variation is high, I would consider the analogue solution to be preferable to the Ultrasonic one....