I purchased the following ultrasonic sensor a couple of years ago.
I have it mounted in the roof of one of 5 joined 10000l water tanks to measure their level. It’s connected to a Raspberry Pi Zero WH. I has been working well for the most part but recently started behaving very erratically. For a few hours the readings were all over the place then settled at reading at about 4x the actual distance. So 300mm was more like 1200mm. Today it seems to have deteriorated further, more like 2600mm.
During the period shown in the chart, the level was actually fairly constant at close to 100%
Is there anything simple that might be causing this or is the sensor just need replacing?
There is one very distinct possibility here. Secondary echos. The initial pulse will reflect off the water then off the roof, off the water, roof and so on until all the energy is dissipated.
This will create standing waves and at some critical water level (distance from transducer) there will probably be cancellation at the transducer which will result in no echo being received. The transducer may pick up a later echo and this could be interpreted as a much lower actual level. The extent and duration of these multiple echos will depend on the original power of the incident signal and the reflective properties of the surfaces (water surface and roof).
Unfortunately this is a fact of life and short of lining the roof with some sort of non reflecting surface I don’t think there is much you can do about it.
As an example, while living in PNG I was sometimes tasked with repairing or checking Echo Sounders, sometimes known as Fish Finders. My method (the only practical way I could think of) of checking was to take them home to our quite large swimming pool and point the sounder at the other end. If I got half a dozen or more distinct echos I figured the unit had a good chance of operating OK in its own environment.
I would suggest removing the unit from the tank and try it in open air the way this sort of thing would normally operate (reverse parking sensors etc). If it works OK you may have to rethink your water level measuring method. It is really very difficult to predict what effects are in play in such an enclosed area.
EDIT: I have just noticed you have had this unit for a couple of years. So while I don’t think my reasoning is wrong this sort of thing has not apparently caused any problem in the past. Or has it ???
Yeah as I said it has been going well up until now. The change has been quite abrupt. It did coincide with a large rain event that filled the tanks to overflowing but there have been many of those without any issue.
The old straw that broke the camel’s back maybe ???