Ultrasonic sensor suddenly reading erratically

Hi,

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?

Thanks
Phil

1 Like

Hi Phil.
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.
Cheers Bob

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 ???

3 Likes

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.

2 Likes

The old straw that broke the camel’s back maybe ???
Cheers Bob

2 Likes

Sorry to revive an old thread but I was wondering if you ever managed to resolve your issue Phil?

I built a similar device using the A01NYUB Waterproof Ultrasonic Sensor and am having a very similar issue. Mine seems to fluctuate by about 500mm. The strange part is that for me it seems to be based on time of day. Here’s my data over four days - the pattern is quite obvious. Seems to be accurate from about 8am to 3pm then ramps up each evening and by 7pm it’s reading 2000L (about 500mm difference) higher than it should be. Then slowly resets and is normal by 8am the next day.

Correct volume:
actual

High reading:
high

I wouldn’t have thought temperature or air pressure would cause this much of a fluctuation. I get the same result with different sensors too (have tried two identical).

I store measurements every 30 seconds. A measurement is the median of 20 readings with a delay of 150ms between each reading.

It’s driving me crazy!

I’ve heard of traffic rumble creating problems with these sensors. If I recall correctly the vibrations from nearby heavy vehicles can tremble the sensor and give a spurious reading. Is there any vibrating equipment or otherwise nearby @Robert15496 ?

eg. If noise from a running pump is coupling into the tank that may correlate with the error.

I know @Jacob has had similar experiences with these sensors. Does this ring any bells @Jacob ?

1 Like

hmmm maybe also heating cooling cycles overnight with condensation near the sensor ???

Murray

Hi Robert,

That is very odd. Not sure if I can be any real help. My fix was easy in the end…replace the sensor. Apparently, mine had become faulty.

I had been having issues with fluctuations but they were pretty minor compared to yours, maybe 5mm? I found that at least some of that due to temperature variation over the day. I’ve actually allowed for that in my algorithm as well as other correction factors and I’m pretty happy with the results now. I generally have no more that 0.1% variation between readings. More than good enough for my application.

Just looking at what you do different to me, I only take a measurement every 15mins and with 10 readings 500ms apart. Being sound waves, maybe there’s an echo or resonance going on that doesn’t have time to dissipate between readings? Not sure what time of day would have to do with it but maybe its a temperature thing?

Hi Everyone. Thanks for your responses. I meant to get back to this thread sooner but ran out of time over the weekend. On the plus side it has given me a chance to capture some more data.

Michael regarding noise - there are pumps almost directly against the tank but these only run for maybe 30 minutes each day in the morning. We’re quite high up on a hill so we get a lot of ambient noise from the surrounding area but nothing that sort of coincides with the sensor data.

Murray125532 / pssturges your suggestions about temperature causing the fluctuations I think might be on the money. Based on the data I have collected over the last 4 days - it seems that only on days that reach 22 degrees or more there are errors. I’ve also noticed that the error data is pretty much the same (max) value every day vs. the actual data which varies.

Here’s the latest including the last four days + daily max temp. Notice how as soon as it gets below 22 the problem seems to stop?

What I am not sure of yet is whether it’s the temperature inside the tank itself which is causing issues (eg. condensation) or whether it’s the sensor sitting out in full sun and overheating which is causing the issue.

I read that a light coat of Vaseline on the sensor will help prevent condensation build-up (so will try this). And I will also make up a cover for the sensor so that it is not sitting in direct sunlight all day.

I will report back with any progress (or otherwise) :slight_smile:

1 Like