HC-SR04 ultrasonic sensor - incorrect readings

I have a few of these HC-SR04 sensors.

http://www.dx.com/p/new-hc-sr04-ultrasonic-sensor-distance-measuring-module-3-3v-5v-compatible-for-arduino-416860

It can operate at 3.3v and I am using it with a barebones ATmega328p to monitor the water level in a rain tank.

The readings are mostly correct and within the specified 3mm accuracy, but occasionally I get readings that are completely off.

I monitor the water level at minute intervals and I get readings like this (Units = cm)

78.5
78.5
78.5
78.6
78.5
78.5
78.6
65.5 <---
78.6
78.5
78.6
78.6

I'm using NewPing library which has a ping_median() function. I do ping_median(100) to get the median value of 100 samples.

I thought that condensation may be building up on the sensor mesh, but it doesn't seem to be the case. I tested a sensor in the house by placing water droplets on the mesh, but it didn't affect the readings much at all.

Sometimes I get several hours of correct readings, then around 10-20 minutes of incorrect data, after which the readings go back to normal for the next few hours.

Othertimes It is just one incorrect reading amongst hours of correct readings. With the water level over 70cm away, I've seen some readings of around 7-14 cm.

What could be causing these incorrect readings?

Interesting how the bad readings can go for so long.

I don't really have a solution for you but personally I just installed a JSN-SR04T into an outdoor rain tank and (since sorting out my power supply issues) it works perfectly with ping_median(30).

Two things come to mind - the first a defective sensor - you say you have several of them, so I would try a different one and see if the problem persists or goes away when you change sensors. The second possibility (I don't know just how it is configured and wired) is that something in the Arduino code is affecting the timing and measuring the echo pulse correctly (some interrupt or something that affects the timing count).

Additionally, as you have several sensors, wire up another one and get the values from both sensors and see if they both give you incorrect readings (at which point you know it's not the sensors but must somehow be the supporting circuitry. I don't think it would be the NewPing software, that is very mature).

Worth doing at it's just a couple of extra wires?