Watertank level sensor using 6 temp. sensors.


This project was created for measering the volume left in a watertank of my campervan.

It uses 6 DS18B20 Dallas waterproof temperature sensors to measure the level of the liquid.


What we need:

1 * Arduino board of any kind.

6 * DS18B20 Dallas temperature sensors.

1 * 470 Ohm resistor to pull up datalines.

1 * Piece  of Tube to insert the sensors.


How to:

Connect all black wires together, also the red ones and the blue datalines. Sometimes the colors are differend. See pictures and textfile

Connect a 470 Ohm resistor between the Vcc an d the datalines.

Then connect all to the Arduino en uploud the sketch. If all goes well you should see the output of the sensors on your serial monitor.


Sensor Coding:

Before we can go on we have to find out wich sensor is sensor #1 and so one. We can do that by holding one sensor tight and watch the sketch to see wich ones temperature is rising. If we see one rising, label the wire of that sensor. Go one with the remaining 5 sensors.


Adjust the lenght of the tube to the depth of the tank, then devide the sensors on equal distances over the inside of the tube, sensor #0 at the bottom sensor #5 on top.


Sensor Calibrating:

For a good readout of the level we need to calibrate the sensors, we do that by hanging the sensors in a bowl of cold water, leave it for about 5 minutes and read the values on your serial monitor, and write them down.

You probably have 3 ore more values that are the same, use these as a zero point. The others are somewhat higher or lower.

For example you have 3 readout of 20 deg. and another of 20,5 deg. Then the clalibration for the 3 sensors of 20 deg are 0,0 and the calibration for the other is 0,5, and so on.

Now correct in the sketch the vars Calib_0 to Calib_5 according to the readout values.

The sensors are now clalibrated.


Set Treshold:

In the sketch there is a var called Tershold, this is set to 1 deg.. The treshold determines the difference between the sensors before the sketch decides off a sensor is low or high. experimentally you have to set this var to your needs, for water, in my case 1 was ok.


Set Volume:

The var Ltrs. determine the volume on use.

These can be set in the sketch for every sensor.

if (Temp_1 > Low + Treshold) Ltrs = 10;


Set Poll:

The var Poll is to determine the interval between measurements.


Set Debug:

By setting Debug = true;

You readout is routed to the serial monitor.

By setting Debug = false; nothing is send to the monitor.


Have Fun, Jay Brad