I currently have a functioning fuel level sensor for my fuel tank built with an ultrasonic hc-sr04 device and it works pretty ok.
Before installing that on the top of the tank (hot-glued to the cap actually) all my tests were done on a water tank, so I know beforehand that this works well with water.
There some things you'll want to consider though:
- This does NOT work well on moist environments, you'll have wrong readings, I recommend the "water proof" version for that (it's not waterproof, it simply works better with higher humidity levels)
- If the water is moving you'll have different readings (as with ALL water level meters) I've modified the sketch to read the distance several times at random intervals (for example 6 times with intervals at 1 sec, 3, 5.5, 6,7, 9.2 secs) and then give the average distance, this flattens false readings and gives a more realistic value.
Hope that it works for you.