Accurate water level measurement with Arduino

I am trying to design accurate continuous water level indicator with Arduino. I used HC-SR 04, but while researching on the topic I learnt that the readings from this sensor will vary with temperature. I want this to turn on/off water pump based based on input from this sensor. Is there any better way to design this ? Perhaps using some other sensor/method. I need continuous water level measurement not just that the pump starts when the tank is empty and OFF when the tank is full. Also I need 1 CM accuracy in measurement.

Also, it could be that the top surface might be disturbed due to water falling into the tank from the inlet pipe.

Is there any better way to do this ?

I am trying to design accurate continuous water level indicator with Arduino. I used HC-SR 04, but while researching on the topic I learnt that the readings from this sensor will vary with temperature. I want this to turn on/off water pump based based on input from this sensor. Is there any better way to design this ? Perhaps using some other sensor/method. I need continuous water level measurement not just that the pump starts when the tank is empty and OFF when the tank is full. Also I need 1 CM accuracy in measurement.

Also, it could be that the top surface might be disturbed due to water falling into the tank from the inlet pipe.

Is there any better way to do this ?

5mm resolution accuracy (repeatable) may get pricy. Well, 1cM should be do-able...

Before you go crazy and spend a fortune, you may want to look into hydrostatic sensors. One is:

The Arduino test code is avsilable for the above here.

Other links to hydrostatic sensors

Ray

on2k17nm:
I am trying to design accurate continuous water level indicator with Arduino. I used HC-SR 04, but while researching on the topic I learnt that the readings from this sensor will vary with temperature.

I'm curious where you heard that. I'm not sure what's in the ultrasound sensors, but I don't think it's anything that would be affected much by temperature. Unless it's about sound propagation through the air.

It would also be a good idea to have a float switch at the top and bottom of the tank as a backup, just like a moving object would have limit switches.

on2k17nm:
I am trying to design accurate continuous water level indicator with Arduino. I used HC-SR 04, but while researching on the topic I learnt that the readings from this sensor will vary with temperature. I want this to turn on/off water pump based based on input from this sensor. Is there any better way to design this ? Perhaps using some other sensor/method. I need continuous water level measurement not just that the pump starts when the tank is empty and OFF when the tank is full. Also I need 1 CM accuracy in measurement.

Also, it could be that the top surface might be disturbed due to water falling into the tank from the inlet pipe.

Is there any better way to do this ?

temperature effects can be calibrated out. you know the media,, (air) and the denisty as it changes temperature.
as for the surface being disturved, you can put in a tube, then there will be no problems with surface disturbance. When I put my sump pump sensor into a tube, the reading went to rock steady.

For our intents and purposes, the speed of sound in air depends ONLY on temperature. If you know the air temperature, you can correct the readings of the ultrasonic ranger accordingly. It is a small effect for ordinary temperatures (about 1.6% for temperature change from 20C to 30C).

Discussion and speed equation here.

Why are you cross posting http://forum.arduino.cc/index.php?topic=428112.0

@on2k17nm, please do not cross-post. Threads merged.

Hi,
There is a version of ultrasonic sensor that has "temperature compensation". It's type SRF-06

That said, unless your tank has a very small vertical distance I don't think you need that.

You should average several readings. See:
https://bitbucket.org/teckel12/arduino-new-ping/wiki/Home

and the averaging:
https://bitbucket.org/teckel12/arduino-new-ping/wiki/Home#!timer-median-sketch

Why do you need continuous measurement to turn a pump on and off? You just need to know two levels: one to turn it on and one to turn it off. If it's anything between that then you don't really need to know. You can make those measurements very accurately - much better than 1mm.

Accuracy vs. Precision.

I assume you want both?
Which are you having an issue with?

Are your results:

A) Accurate but Imprecise.
B) Inaccurate but precise?
C) neither?
D) Accurate and precise but not true?

try a float/potentiomer as used in a car fuel gauge...

regards

Allan