Strange readings from HCSR04 ultrasonic sensor

I have a tank of water with a pump and am doing level measurements with the hcsr04 ultrasonic sensor. It works mostly, but sometimes the level reading is off by maybe 10-40 cm, for certain periods. See attached image. I iknow that the level of water in the tank can vary between 30 and 150 cm.

I am taking readings every 30 seconds, and each reading consists of 11 samples. The annexed chart displays the median of 10 of those readings, so it's one median every five minutes. So to me this indicates a systematic error. The water surface is always too low for a while, and then autocorrects after a while.

Could this be because of some external factors such as noise interfering with the ultrasonic sensor?

Please don't give us any details; we love guessing games.

Do tests with something else first ------ not water. And do it in pretty much the same environment - as in same 'well' or water it is that is holding the water ---- except use a solid reflector to start with.

And - provide details of your setup. Adequate details.

I did a lot of tests before and they were okay. I calibrated the sensor by measuring the distance to the ceiling. It has also been accurate for a long time, but after 6 months these strange readings started. I guess I could just replace the sensor but I'm curious about the technical explanation.

My setup is on a raspberry pi actually and I initially had two sensors in parallel, but one stopped working. Do you think it could be because of the wiring? I mean it does get a reading all of the time. If it was something bad with the setup then there would be bad or empty readings.

I just looked at the associated data sheet and there is no mention of using their device in an atmosphere where the humidity could reach 100%.

Paul

The result from Ultrasonic sensor may be incorrect because of noise. It is had better to get more sample per reading and make a notice filter to remove the incorrect samples

jools72:
I did a lot of tests before and they were okay. I calibrated the sensor by measuring the distance to the ceiling. It has also been accurate for a long time, but after 6 months these strange readings started. I guess I could just replace the sensor but I'm curious about the technical explanation.

My setup is on a raspberry pi actually and I initially had two sensors in parallel, but one stopped working. Do you think it could be because of the wiring? I mean it does get a reading all of the time. If it was something bad with the setup then there would be bad or empty readings.

A helpful comment only - the above information was roughly what should have been mentioned at the start of the thread smiley_small.jpg

Is this system used indoors? Or outdoors? And 6 months is only half-way into a season. So also consider the environment - is it humid, rainy, snowy etc?

And also - if the system had operated just fine for six months, then was there any improvement when replacing that sensor with a spare?

Various testing should be done first - just as when you first started ---- and you managed to get six months of normal operation out of it.

In order to determine possible causes for the change in performance ------- adequate information may be required. Temperature, humidity, inspection of the system (to see if it's dirty of anything), and details (pics etc) of the actual system and setup. It is assumed that no changes were made the the software code.

You mentioned that you had two sensors working in 'parallel' and one stopped working. When did it stop working? And does that mean you were using 1 of these sensors (while the other one wasn't working) for 6 months? And the system was performing excellently for 6 months?