Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 11:14 01 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : SRO4 (waterproof) for Watertank Depth

     Page 1 of 2    
Author Message
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 871
Posted: 02:52am 20 Aug 2021
Copy link to clipboard 
Print this post

Hi,
I'm about to embark on a simple device to measure the depth of water in a tank.
There were several threads x years ago - Here is one.
In that link TassyJim gives the search I have followed to procure my sensors (now enroute from China . . .).

As is my want, I'm checking if any shedders have any updates?

I do have some questions - people have been mounting the sensor above the tank and "shooting" through a hole in its top to get the distance to the very top of the water in the tank. If the sensor is say 200mm above the top of the tank:
- what diameter does the hole need to be to avoid interference from the steel tank? (eg is a 100mm dia plastic pipe likely to be enough?)
- is there anything water, or at least, mosquito-tight I might mount the sensor in (eg as a top hat over the hole?) to retain water quality?

Cheers,

Andrew
(I plan to use a MM170 (one of BigMick's offerings) with an HC-12 to send the data to my base station (F4 with an EastRising 9" LCD). The depth of water is just on 2m).
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 03:00am 20 Aug 2021
Copy link to clipboard 
Print this post

I mounted my sensors in the end of a short bit of 25mm (or 19mm) conduit.
The hole in the top of the tank is just big enough to take the conduit.
Silicon does the sealing.

That part of my system is out of service at the moment. I found that my setup was very vulnerable to lightning. I have replaced the water flow sensors but not the water leverl sensors yet.

The tank that gets the bore water pumped in suffers a bit from bad readings while the pump is running so I am thinking of trying the sensor in the end of a bit of 40mm pipe to see if that gives me a usable stillwell.
That's a job for summer.

Jim
VK7JH
MMedit
 
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 871
Posted: 03:38am 20 Aug 2021
Copy link to clipboard 
Print this post

Hi Jim,
Thanks for that. You give me confidence that it is doable with only a minor hole in the tank! (I had visions of 300mm etc.  25 sounds much better!)

Cheers,

Andrew
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2442
Posted: 08:13am 20 Aug 2021
Copy link to clipboard 
Print this post

has anyone thought of a length of 4" downpipe, length a little less than the internal height of your water tank, sealed at each end with glued caps and filled with sufficient sand such that it weighs a little more than the water it displaces when suspended in the tank- ie, does not float when the tank is full. a small <1mm hole in the top will allow for air expansion as temperature changes.

suspend this assembly in your water tank on the end of a short piece of #8 fencing wire that passes through the top of the tank (3/8" hole) and is attached to a weight sensor. the length of the pipe chosen needs to be sufficient such that the bottom end sits just below the level of your outlet pipe to gain a full range of readings from full to empty.

when the water tank is empty, the weight sensor will register the total weight of the pipe. when the water tank is full the weight sensor will register the total weight of the pipe minus the weight of the water is displaces. in between (from the level of the outlet pipe to full) the weight registered will vary linearly in relation to the water level.

if keen, you could even locate the weight sensor inside the top of the water tank too, with just electrical wires exiting the tank.


ebay sells, for instance, sensors here:
https://www.ebay.com/itm/164908306323


cheers,
rob   :-)
Edited 2021-08-20 18:14 by robert.rozee
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 08:22am 20 Aug 2021
Copy link to clipboard 
Print this post

Another approach is a small pipe the height of the tank sealed at the top with a pressure sensor. Carefully lower the pipe into the tank and secure. The pressure will then be a direct measure of the height of the water.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 08:47am 20 Aug 2021
Copy link to clipboard 
Print this post

The system of using an echo sensor in a pipe is one that I've come across quite a bit. You do need quite a wide pipe though as there are stray echoes from the walls. It's also a bit temperature sensitive as the speed of sound in air varies with temperature.

Air pressure systems, as Peter suggested, can work but are temperature sensitive and non-linear.

You can get liquid pressure transducers that are teed into the outgoing pipe. You calibrate these with the surface area of the tank and liquid density and they give you the volume of liquid in the tank directly.

Temperature sensitivity and linearity problems can be sorted out in software, but you need to be aware of them and be prepared to calibrate the system. If the tank is sealed you need two pressure sensors, one at the bottom and one at the top and subtract them as the top may not be at atmospheric pressure.

I don't know if this is a potable water tank, but if it is you have to take that into account. Anything that might come into contact with the water has to be made of suitable materials.

Non-potable (and some potable) systems can use stainless steel probes to get High High, High, Low and Low Low signals if exact measurement isn't necessary. It's a far cheaper way to do things. :)
Edited 2021-08-20 18:50 by Mixtel90
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
ajkw
Senior Member

Joined: 29/06/2011
Location: Australia
Posts: 290
Posted: 10:14am 20 Aug 2021
Copy link to clipboard 
Print this post

How deep is the tank?  In my camper trailer which has a 90L tank that is 600mm high I went with one of these from KUS (see below).  Available from most boat shops.  I looked at some ultrasonic sensors but discovered some obstacles, well in my application anyway.  

These senders are 240-33ohm with 21 steps and so gives about a 3L resolution, was easy to interface with a analogue pin on the MuP Mite.  Thanks Mick.  There is a pic below with the OLED screen I used.  The tank level is bottom left.

Cheers
Anthony.

Image belongs too
https://kus-usa.com/products/liquid-level-sender/


MuP MM with OLED Screen

 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 09:54pm 20 Aug 2021
Copy link to clipboard 
Print this post

Rob's pipe and scale is a good idea worth looking into.
The tanks, in my case are ~2400mm high 20000L potable.
One concrete and the others poly.

The ultrasonic method works well most of the time.
I had considered pressure gauges but concerned about long term durability.

The problem is something I play with every year or two when the urge to experiment needs tending to.

Jim
VK7JH
MMedit
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2640
Posted: 01:31am 21 Aug 2021
Copy link to clipboard 
Print this post

"Another approach is a small pipe the height of the tank sealed at the top with a pressure sensor. Carefully lower the pipe into the tank and secure. The pressure will then be a direct measure of the height of the water."
This method is used in dishwashers and washing machines and is reliable and accurate in the short term. I used it many years ago for my water tank (no reticulated water here so knowing how much is in the tank matters) but found that the air is slowly absorbed into the water, reducing the accuracy. After a few weeks it reads empty when full. A fish tank bubbler can be attached and run for sufficient time to completely refill the tube (bubbling out the bottom) before taking a reading. Advantages of this are it is linear and unaffected by temperature.
In my current house I just use a sight tube.
 
Solar Mike
Guru

Joined: 08/02/2015
Location: New Zealand
Posts: 1163
Posted: 02:11am 21 Aug 2021
Copy link to clipboard 
Print this post

Over 30 years ago a friend on a remote farm used a magnet encapsulated inside a ping pong ball, this floated inside a length of vertical rigid plastic plumbing pipe on the outside of the tank. An array of tiny glass reed switches were glued to the tube; these switched on off as the magnet floated past.
Probably still working...

Cheers
Mike
 
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 871
Posted: 06:25am 21 Aug 2021
Copy link to clipboard 
Print this post

Hi folks,
Some really good suggestions - keep them coming.

To answer some of your queries:
- potable water
- just on 2m deep/high tanks (there will be two, 5000 litres each).

Elsewhere I have a VDO diesel fuel gauge sender that consists of a float that makes contact across two resistive wires - quite accurate but only 600mm range - I need 2000.

The tanks will also have (bought) mechanical gauges but they will require me to wander outside to read them. I was looking forward to a setup like TassyJim's that also measures the water In and Out of the tank, rainfall etc.

Cheers,

Andrew
 
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 871
Posted: 11:10pm 05 Sep 2021
Copy link to clipboard 
Print this post

Hello all,

(Here is a link to another forum discussing sensors in tubes)


My SR04M-2 sensors arrived:



1) What are the 'RST' and 'SWIM' either side of the four main pins (J1) (I couldn't get the RST to reset - how should it work?).


I knocked up the following code (based on BigMik's)

dim integer TrigPin=15
dim integer EchoPin=16
Dim Float Depth

Do
 Depth = DISTANCE(TrigPin, EchoPin)
 Print Depth
 pause 2000
Loop While Inkey$ = ""


I'm using MMBasic 5.05.04 on a MM170. I've left the two pads just left of J1 disconnected - is that correct?

With the Trigger and Echo pins connected as above the LED on the unit flashes when the MM sends a trigger but the response is '-2' (the not connected or fault message).
BUT if I disconnect Trigger I get accurate distance measurements every 2000ms and the LED flashes quickly continuously.

2) What is happening?

Cheers, Andrew
Edited 2021-09-06 10:26 by Andrew_G
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 12:27am 06 Sep 2021
Copy link to clipboard 
Print this post

Have you got a link to the module you purchased?
It looks different to mine.
I will see if I can locate mine but the office is being all packed away to allow for repaint and new carpet so it is hard to find things. Harder than usual...

Jim
VK7JH
MMedit
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 1003
Posted: 12:30am 06 Sep 2021
Copy link to clipboard 
Print this post

I use SR04 which just has trig and echo. The one you have seems to have a few modes. See here for details of a similar one. Looks like you need to set it mode via a resistor.

Regards
Gerry
Latest F4 Latest H7 FotS
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 12:33am 06 Sep 2021
Copy link to clipboard 
Print this post

This link might help:
https://bitbucket.org/teckel12/arduino-new-ping/issues/40/aj-sr04m-board

https://tutorials.probots.co.in/communicating-with-a-waterproof-ultrasonic-sensor-aj-sr04m-jsn-sr04t/
Edited 2021-09-06 10:45 by TassyJim
VK7JH
MMedit
 
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 871
Posted: 12:45am 06 Sep 2021
Copy link to clipboard 
Print this post

Jim,
This  is the module I bought - it differs from what arrived (which have the RST and SWIM) and whatever else.
On one site I looked at they spoke about the newer modules needing a longer trigger to work properly - could this be an issue?

Is there a way of doing it without the DISTANCE command?

Cheers,

Andrew
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 12:47am 06 Sep 2021
Copy link to clipboard 
Print this post

You should be able to get it into serial mode which looks interesting.

see the second link I added to my previous post.
Edited 2021-09-06 10:48 by TassyJim
VK7JH
MMedit
 
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 871
Posted: 01:01am 06 Sep 2021
Copy link to clipboard 
Print this post

Gerry,
Thanks and yes there is a temptation to try the other modes but they seem to have a different mode of operation which may not work with Peter's CFUNCTION?

and Jim,
Thanks too, the article you link to is one of the ones talking about a longer trigger time - but the other respondents seem to dismiss it?

Is it easy to change Peter's CFUNCTION to change the time?

Andrew

Edit: Thanks Jim I'd missed your additional link.
Edited 2021-09-06 11:14 by Andrew_G
 
SimpleSafeName

Guru

Joined: 28/07/2019
Location: United States
Posts: 351
Posted: 05:17am 08 Sep 2021
Copy link to clipboard 
Print this post

  phil99 said  "Another approach is a small pipe the height of the tank sealed at the top with a pressure sensor. Carefully lower the pipe into the tank and secure. The pressure will then be a direct measure of the height of the water."
This method is used in dishwashers and washing machines and is reliable and accurate in the short term.


Yup. Although bubblers work fine. By running air through the tube you force the water down the tube until it reaches the end and bubbles out the end. A pressure transducer in the line will give you the PSI required to force the air out.

The downside is that you will need an air supply. No one says that you have to run it 24/7 though. And I'm not sure that I would want to drink something that came out of an air compressor...


If it were me, I would use one of these:

https://www.ebay.com/itm/283996510576?hash=item421f82d970:g:CewAAOSwX59fTjIH

Select the .2 MPA (unless you can find a .1MPA, or even a .05MPA sensor) version (good for 800 inches of water column) and read it with a 'mite. Mount it near the bottom of your tank.

Specs on it are pretty darn good for a $20 device.

If you can't pop a hole near the bottom of the tank, then maybe this is the way to go:

https://www.ebay.com/itm/Fuel-Tank-Level-Sending-Unit-6-or-12-Volt-Mounting-Gasket-float-GAS-Petrol-/332304450464

Just keep the resistor part out of the water.



These are some of the ones that I have used in different plants, not homebrew solutions.


Sonic sensors:

Banner makes a nice one, good for intrinsically safe areas.

Watch the length of the pipe that you mount it into, the head transmits in a cone and hitting the walls will throw you off.

Foaming and/or agitated liquids will also cause problems.


TDR (Time Domain Radar): Junk. Avoid it.


Electrodes: Works great, but mind that you do not become one with the circuit. Probably illegal (or sternly frowned upon) these days.


Pressure sensor (mounted near the bottom of the tank): Works great.


Load cells: Worked fine for measuring the resin in a tank holding 130,000 pounds of the foul goo. Whatever you do, don't smack them or you might de-bond the strain gauge. And don't let water creep into the load cell (usually up the cable from the junction box) or it's toast.
 
Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 871
Posted: 06:32am 08 Sep 2021
Copy link to clipboard 
Print this post

Hi SimpleSafe . . .,
Thanks for that. I am having trouble with the link to the first ebay item - is the link above correct?

Cheers,

Andrew
 
     Page 1 of 2    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025