Measuring water in a water tank - Page 1
Forum section: electronics / projects

author: ilium007
author_rank: Frequent Contributor
timestamp: January 06, 2013, 03:01:36 am
content: Hi - I have been on this little project for a few years on and off with no success. I would like to measure water in my 25,000l water tanks at home and use the data to track water usage, quantity and also possible to switch on some transfer pumps.I have looked at commercial pressure transducers - these are prohibitively expensive (I have 5 tanks to measure)I have looked at homebrew pressure differential projects - the sensors available will not allow water to come in contact with the pressure sensor surface.I have looked at capacitance sensors but these seem to be quite susceptible to temperature as well and may not be accurate enough for my needs.I have purchased a Maxbotix sensor that uses ultrasonic waves to sense objects - I have played around with this a lot on the Arduino platform and it could be useable but I dont yet know how accurate it will be, the results are very dependent on temperature. 1cm in my tanks equates to about 70l of water. This would be about the accuracy I am after.The only thing left to look into is a hall effect based sensor array with a floating magnetic device. I am thinking I could have a tubular pole inside the tank (approx 2m high) with a bunch of hall effect sensors placed equally inside. as the float moves up the pole various sensors will be triggered and I can interpret on the arduino. I dont know how I would get a string of them interconnected, I dont know how I would interface xx number of sensors top the arduino (limitied input pins) and I dont know how far to space the sensors apart so that the magnet does not interfere with the sensor above and below. I know that I can not have a sensor for every 1cm of water depth so I would need some way of interpreting the magnet sitting between two sensors.Any thoughts on how to measure water in a tank would be greatly appreciated.

author: 8086
author_rank: Super Contributor
timestamp: January 06, 2013, 03:28:17 am
content: Perhaps sonar? Affixed to the inside of the top of the tank? Will reflect off the water and the delay will give you the level.

author: UPI
author_rank: Regular Contributor
timestamp: January 06, 2013, 03:38:31 am
content: An auto-retracting reel of fishing line (just enough tension to remove string slack) with a float at the end monitored with an encoder on the reel.

author: ilium007
author_rank: Frequent Contributor
timestamp: January 06, 2013, 03:54:35 am
content: Quote from: 8086 on January 06, 2013, 03:28:17 amYes - this is the Maxbotix sensor that I have trialed. One of the biggest issues with this approach is that the speed of sound varies with temperature and inside a water tank it could be 35 - 40 degrees during the day (the air gap between the top of the water and the top of the inside of the tank) and down as low as 15 degrees of a night time.

author: ilium007
author_rank: Frequent Contributor
timestamp: January 06, 2013, 03:57:04 am
content: Quote from: UPI on January 06, 2013, 03:38:31 amI had thought of this one as well but moved away from the idea of mechanical devices that could fail. I had thought of a loop of wire on two pulleys turning a rotary encoder. Even reusing a commercially available water tank gauge (the one with the float indicator on the outside of the tank) by putting a rotary encoder on the pulley - someone said to me that this combination of mechanical devices was a bad idea.

author: 8086
author_rank: Super Contributor
timestamp: January 06, 2013, 04:02:48 am
content: Quote from: ilium007 on January 06, 2013, 03:54:35 amOh. I must have skipped over that part of your post.Could you have a simple temperature sensor in there too, and compensate?

author: ilium007
author_rank: Frequent Contributor
timestamp: January 06, 2013, 04:04:58 am
content: Quote from: 8086 on January 06, 2013, 04:02:48 amI do have a temp sensor but here is the problem.... where do you put it inside the tank (between the sensor and water) so that when the tank is filling the sensor is not under water ?

author: UPI
author_rank: Regular Contributor
timestamp: January 06, 2013, 04:12:16 am
content: Quote from: ilium007 on January 06, 2013, 03:57:04 amHow would you feel about a motor lowering a continuity sensor into the tank?

author: 8086
author_rank: Super Contributor
timestamp: January 06, 2013, 04:15:13 am
content: Quote from: ilium007 on January 06, 2013, 04:04:58 amDepends just how much the temperature difference between top and bottom of the tank is an issue. I would expect the air temperature to be uniform enough at any given time to be able to make a fairly accurate temp compensated measurement. So it would appear your options would be to either have it at the top (with the transducer), or on a float.

author: ilium007
author_rank: Frequent Contributor
timestamp: January 06, 2013, 04:17:07 am
content: Quote from: UPI on January 06, 2013, 04:12:16 amThats back to a mechanical based measuring approach. What I would l really love to do is investigate this hall effect idea further. Nothing to break / go wrong. My idea is that I should get a predictable fall off of voltage through the sensor as the magnet moves closer and farther away from the sensor, thus when a magnet is right near a sensor it will allow, say, a full 5V, as the magnet moves further from one sensor the voltage will drop but then start rising on the next sensor until it is at 5V and the other sensor is at 0v. Thats the idea anyway !

author: ilium007
author_rank: Frequent Contributor
timestamp: January 06, 2013, 04:18:13 am
content: QuoteNow thats an idea !

author: Jimmy
author_rank: Regular Contributor
timestamp: January 06, 2013, 04:33:31 am
content: http://www.jaycar.com.au/productView.asp?ID=XC0331&utm_source=FPXC0331&utm_medium=WEB&utm_campaign=FPCHack the wireless signal

author: ilium007
author_rank: Frequent Contributor
timestamp: January 06, 2013, 04:38:12 am
content: Are you serious !!!! When did these come into stock !!

author: chickenHeadKnob
author_rank: Super Contributor
timestamp: January 06, 2013, 04:44:06 am
content: Quote from: ilium007 on January 06, 2013, 03:01:36 amOK what I have to offer is somewhat physically similar to your hall sensor string but much simpler and cheaper. A pipe or tube constrains a float to only vertical travel. Float supports a precisely notched ruler, or plastic stick with reflective and dark bands like a ruler, but I think notches are easier. I would make it out of acrylic or aluminum. At the top, in free air, the ruler ticks would be read by optical interrupter. Two or more interrupters and corresponding index holes in the stick let you do limit detect or you can calibrate once and hope your micro never loses count. Disadvantage is that you have to accommodate vertical travel of the ruler above the tank when it is full. Easy to get 1 to 5 mm accuracy.

author: ilium007
author_rank: Frequent Contributor
timestamp: January 06, 2013, 04:45:39 am
content: Quote from: chickenHeadKnob on January 06, 2013, 04:44:06 amNice idea - I will look into that further.

author: NiHaoMike
author_rank: Super Contributor
timestamp: January 06, 2013, 05:01:37 am
content: Maybe use some waterproof wire (a piece backed onto itself and then lowered vertically into the tank) and sense the capacitance between it and the tank?Or use sonar from the bottomside along with a temperature sensor. Water conducts (and stores) heat very well so there shouldn't be very much of a temperature difference between the top and bottom of the water.There are also infrared distance sensors available.Or couple a speaker and microphone to the top of the tank and measure the resonant frequency of the airspace.If a low resolution digital readout is fine, you could attach some heaters (metal cased power resistors work great) and temperature sensors (common NTCs work fine) to several levels on the outside of the tank. (Immersing them inside the tank also works, but waterproofing it requires more work.) First do a temperature readout without the heaters, then switch the heaters on for some time (say a few minutes), then take another readout. The parts of the tank that are covered by water would not change temperature very much, while the parts that are not covered would get significantly hotter. (I remember reading about a car that used a PTC to signal a light when the oil level is starting to run low.)

author: SeanB
author_rank: Super Contributor
timestamp: January 06, 2013, 05:28:18 am
content: 5 washing machine pressure sensors ( the newer ones used in digitally controlled machines) and have the 4069 oscillator next to it in the box at the top of the tank. Feed the square wave back to the central point using Cat5 cable, 2 pairs for power and 1 pair for a differential signal, easy enough to arrange with 5 spare oscillators. 2 in parallel as bus drivers works for each line via a 100R resistor. Then you measure frequency and convert it to level. They are pretty consistent and ultra cheap, especially if you go out on scrap day or to the scrappie and ask for 5 machines as they come in.Oscillator is part of the schematic, even gives the values and the frequency ranges.

author: ilium007
author_rank: Frequent Contributor
timestamp: January 06, 2013, 05:51:17 am
content: Quote from: SeanB on January 06, 2013, 05:28:18 amI wish I know what an oscillator did ! But I dont ! Was there supposed to be a schematic linked ? Also, what effect does temperature have on an oscillator ?

author: ilium007
author_rank: Frequent Contributor
timestamp: January 06, 2013, 06:53:17 am
content: Quote from: wilfred on January 06, 2013, 06:47:01 am10% is 2500l that is less than the amount I need between calling the water man (we dont have town water) and running out of water. The other reason to measure water level is to pump out of a 5000l sump tank into the 25000 tanks during rain sessions. I want to be able to measure the water level in this tank accurately so that I can estimate the rate of water coming down out of the sky.And I want to do it electronically because this is a hobby and a hobby is about learning stuff. I could go and poke a stick in the tank every day but where is the fun in that ??

author: ilium007
author_rank: Frequent Contributor
timestamp: January 06, 2013, 07:03:31 am
content: So how about something like:With a decent rotary encoder mounted up the top:Then all I need is code the arduino to suit.

author: firewalker
author_rank: Super Contributor
timestamp: January 06, 2013, 07:56:22 am
content: Years ago I had use a multi turn top. I had mounted a pulley and awith string and a floating weight on the other end. It was working quite nicely.Alexander.

author: Kremmen
author_rank: Super Contributor
timestamp: January 06, 2013, 10:50:09 am
content: One traditional method, much used in the industry, is to measure the fluid column pressure using a simple air pipe. Just run a hose or tube to the bottom of the tank - open from the bottom, sealed from the top. Attach one of thesehttp://www.digikey.com/product-search/en/sensors-transducers/pressure/1966259?k=pressure%20sensorto the sealed top and process the result as you need.No moving parts, measures anything from pure water to septic waste, virtually foolproof. The only precaution would be to have some kind of air valve, maybe a car tire type, for flushing the pipe in case of a leak.

author: ilium007
author_rank: Frequent Contributor
timestamp: January 06, 2013, 10:51:59 am
content: Quote from: Kremmen on January 06, 2013, 10:50:09 amI had considered this as well, but the major drawback is during the day, when the sun heats the air in the pipe, the air expands and exerts pressure on the sensor causing inaccurate readings.A real differential pressure sensor such as this:sells for approx $500 US - way out of my budget considering I have 5 tanks to do.

author: peter.mitchell
author_rank: Super Contributor
timestamp: January 06, 2013, 10:58:36 am
content: Quote from: ilium007 on January 06, 2013, 10:51:59 amdon't put the pipe in the sun?

author: Kremmen
author_rank: Super Contributor
timestamp: January 06, 2013, 10:59:20 am
content: OK. the pipe is open from the bottom so any expanding air will escape and the reading won't change because of that. But the situation changes when the system cools down and the air contracts. Then you do get a measuremnent error because the pipe is not completely air filled any more. What they do in this case is to set up a bubbler that slowly pushes air into the pipe, letting it escape from the bottom. That way the system is not dependent on temp variations. Could still be the cheapest solution provided you can find a suitable pump... If the accuracy is sufficient, i would say this merits serious consideration due to its simplicity. There must be a reason why it is/was so common in the industry.P.S. why would you want to use an expensive pressure transmitter like the image you attached? That is not comparable to the other solutions where you would be building the system yourself. The sensor components i linked are just a few bucks a piece.

author: ilium007
author_rank: Frequent Contributor
timestamp: January 06, 2013, 11:01:15 am
content: Quote from: peter.mitchell on January 06, 2013, 10:58:36 amMuch appreciated - replace the word "sun" with QLD summertime ambient temperature.

author: ilium007
author_rank: Frequent Contributor
timestamp: January 06, 2013, 11:04:27 am
content: Quote from: Kremmen on January 06, 2013, 10:59:20 amThe bubbler method is another industry standard measurement technique but that I have researched, but I did not want the complexity and failure point of a pump in the mix.

author: Kremmen
author_rank: Super Contributor
timestamp: January 06, 2013, 11:07:30 am
content: OK, just a suggestion. Hope you find a solution that works for you.

author: ilium007
author_rank: Frequent Contributor
timestamp: January 06, 2013, 11:09:04 am
content: Quote from: Kremmen on January 06, 2013, 11:07:30 amNo probs - I appreciate the input ! I have looked at doing this for about 2 years and cannot come up with a reliable inexpensive method. The best would be a submersible temp compensated differential pressure transducer but these run at about $500 AUS.

author: ftransform
author_rank: Frequent Contributor
timestamp: January 06, 2013, 11:14:11 am
content: I think a magnetic float in a PVC pipe with a bunch of hall effect sensors could be really cheap and reliable.

author: ilium007
author_rank: Frequent Contributor
timestamp: January 06, 2013, 11:15:38 am
content: Quote from: ftransform on January 06, 2013, 11:14:11 amThat would be awesome and thats what brought me to the site to post - but I dont know how these would be strung together nor how to read multiple sensors to get an intermediate position reading.

author: ftransform
author_rank: Frequent Contributor
timestamp: January 06, 2013, 11:20:29 am
content: Quote from: ilium007 on January 06, 2013, 11:15:38 amme either lol I have hall effect sensors coming from hong kong for a similar application!]How are you going to fit this in your tank? Is this like a water tower tank? It sounds big.Are you a farmer?

author: ilium007
author_rank: Frequent Contributor
timestamp: January 06, 2013, 11:22:59 am
content: Quote from: ftransform on January 06, 2013, 11:20:29 am

author: mamalala
author_rank: Unknown
timestamp: January 06, 2013, 11:37:48 am
content: Two isolated metal strips or rods, parallel aligned and at a fixed distance, form a capacitor. Water between them will change the capacitance. Use a fixed frequency oscillator and a MC1496. Split up the osc output, one going directly into the 1496, the other through a L/C network for phase shifting, then into the other input of the 1496. The C in that network includes the sensor. At the 1496's output you then get a voltage that corresponds to the amount the phase is shifted. Read that with a decent ADC.No movable parts, continuous output.Greetings,Chris

author: ilium007
author_rank: Frequent Contributor
timestamp: January 06, 2013, 11:40:35 am
content: Quote from: mamalala on January 06, 2013, 11:37:48 amI did see a design for a capacitance based gauge based on an insulated wire and the result of his testign that it was inaccurate at low levels in the tank. Do you know of any sampel circuits I could study as I do like the idea of a capacitance based gauge - but again, I know nothing about oscillators

author: johnwa
author_rank: Frequent Contributor
timestamp: January 06, 2013, 11:57:56 am
content: I have been working on a similar setup for a while now. My first attempt was with a capacitive sensor, using the circuit from here:http://njhurst.com/electronics/watersensor/. This however had some serious drift issues, and I also found that it was susceptible to radio interference - possibly because I did not have the circuit close enough to the sensor.I therefore decided to use a pressure based approach. This was the same method used in a Silicon Chip project a few years ago. They used this sensor:http://au.element14.com/jsp/search/productdetail.jsp?sku=1608910, which I also elected to use. I see Farnell also have some cheaper sensors, which may be suitable. The Silicon Chip article suggested two sensing methods: using an air-filled dip tube (which will have issues with temperature compensation), or submerging the entire sensor assembly in the tank. The second method will have greater accuracy, but requires extra work in waterproofing the sensor.Instead of these methods, I decided to mount the sensor externally, connected through a sensing port at the bottom of the tank. This gives a proper pressure reading without needing to waterproof the sensor. Note that the outlet used should be dedicated to the sensor, as any inflow or outflow through the port used will upset the reading.While the datasheet for the sensor says that it is only suitable for sensing air, the sensor die is potted in silicone, so I can't see how clean water would damage it. I left a small amount of air in the pipe to isolate the sensor from the water, though this may dissolve eventually. This small volume of air should not affect accuracy with temperature variations, provided that there is a reasonable length of pipe running horizontally out of the sensor.My installation has only been running for a couple of weeks though, so I cannot comment on the long-term reliability of this arrangement.One other good level sensing solution is a magnetostrictive linear position sensor, with a toroidal floating magnet around the sensing rod. Unfortunately, these are quite expensive.

author: ilium007
author_rank: Frequent Contributor
timestamp: January 06, 2013, 12:02:01 pm
content: That is the exact capacitance sensor I was referring to above. I also pawed over the silicon chip design as well as the freetronics design. I still dont like the idea of water coming in contact with the sensor and will be interested to see how yours turns out. Is your build on a blog ?? I am certain I have seen your username elsewhere - I commented on a blog about a year ago where a guy was building exactly what you describe.This is the site with the silicon chip version but a little modified:http://kayno.net/2010/02/11/wireless-picaxe-based-water-tank-level-sensor/

author: mamalala
author_rank: Unknown
timestamp: January 06, 2013, 12:12:16 pm
content: Quote from: ilium007 on January 06, 2013, 11:40:35 amAttached are three circuit snippets that should give you the idea. I can't really give out the complete thing, or too many details about this specific one, since it is part of a project i did for a customer.In sens_1 you see the sensor circuitry. At the top right a sine-wave is fed in. It goes through R6/C15 and leaves there as CARRIER signal. But it also goes through the L/C circuitry into the OpAmp IC2 to generate the SIGNAL output. SENS_T and SENS_B are the two metal strips that form a capacitor. Feeding a voltage into TUNE allows to offset/calibrate the output signal. The adjustable capacitor in the middle-right of the circuit is to adjust it's center frequency. The sensing element is, as said, just two metal strips in parallel, with a gap between them.In sens_2 you can see the sinewave generation. The osc is just a regular oscillator, you feed it +5V and it generates a square-wave output of the fiven frequency. This gets filtered in this snippet through the L/C, to form a sine-wave, and amplified by the OpAmp.the part sens_3 is the actual signal measurement. the two signals, carrier and signal, from the osc and L/C circuitry enter the MC1496. That chip in turn generates a proportional output at OUT- and OUT+. Feed that into another OpAmp circuit to lowpass filter it and to get an unbalanced output signal that you can feed into a ADC.Of course the values in the given snippets, especially the filter and L/C part, are pretty much useless for you, since your sensor element would be much longer. But the general idea is the same. All it does to modifiy the signal through the L/C circuit, which is detuned by the variable sensor capacity. The MC then detect that difference and generates an output voltage.Greetings,Chris

author: mamalala
author_rank: Unknown
timestamp: January 06, 2013, 12:16:56 pm
content: Forgot to add:You can put the two metal strips inside a metal tube (that tube of course open at both ends) and connect it to GND, to give a better shielding against external RF/noise. Just make sure that you have a rather big diameter tube. The sensor strips should have more distance to the tube wall than to each other.Greetings,ChrisEDIT: And the wavelength of the operating frequency should be much longer than the length of the sensor strips.

author: ilium007
author_rank: Frequent Contributor
timestamp: January 06, 2013, 12:23:01 pm
content: Thanks for the extensive reply. I will start studying those circuits but I think it is above my level of knowledge. I have never done any signal generation / interpretation so this is a whole new league for me.

author: mamalala
author_rank: Unknown
timestamp: January 06, 2013, 12:26:42 pm
content: Quote from: ilium007 on January 06, 2013, 12:23:01 pmWell, knowledge can be extendedThat circuit is very stable and gives repeatable readings/results. It is originally used in test equipment to test material samples, that requires a rather high accuracy and sensitivity.Greetings,Chris

author: ilium007
author_rank: Frequent Contributor
timestamp: January 06, 2013, 12:30:00 pm
content: Quote from: mamalala on January 06, 2013, 12:26:42 pmMuch appreciated.

author: johnwa
author_rank: Frequent Contributor
timestamp: January 06, 2013, 12:37:05 pm
content: Quote from: ilium007 on January 06, 2013, 12:02:01 pmHi ilium007, I don't have anything on the web at the moment, though I am working on getting a site together. I hadn't seen that guy's implementation, though it is basically exactly the same as what I have done. Note that the sensor is teed off from the tank outlet in the photo, this may cause fluctuations in the reading when water is being drawn off, though I don't know how bad this would be. For my installation, I made up a barbed fitting with an O-ring and an M6 thread, and drilled and tapped a hole for it in the wall of the plastic tank. I have another concrete tank that I want to monitor, I am planning to put a tee in the outlet, but feed some small (~3-5mm) metal pipe through the tee, through the valve, and about 500mm into the tank, to avoid the high velocity flow at the outlet.In theory the sensor shouldn't get wet, but the air pocket that protects it will probably dissolve in the water eventually. I will have to post an update once it has been running for a while.Temperature stability looks good so far, there have been some quite hot days the past week, and the reading is within a couple of percent of where it was originally. (see graph)

author: ilium007
author_rank: Frequent Contributor
timestamp: January 06, 2013, 12:46:23 pm
content: Quote from: johnwa on January 06, 2013, 12:37:05 pmOk - that looks promising ! Looks like you are in QLD as well ! I am still keen to look at this floating magnetic / hall effect array though. Given your efforts do you agree that information on doing this in the net as very hard to find ??!!**edit given your username and time difference I assume you are in WA !

author: phatcenter77
author_rank: Newbie
timestamp: January 07, 2013, 03:50:04 am
content: First, place a conductor at the lowest point in the tank, anything really would work, but if it's corrosion resistant even better. Then drop a "strip" of conductors spaced at a distance that will provide you the resolution required. I imagine this as something as simple as a bundle of wires with each conductor exposed at the distance noted above, see ascii drawing below:l l l l l l l ll l l l l l l ll l l l l l ll l l l ll l llYou can then measure resistance from the conductor at the bottom to each of these exposed conductors hanging in the tank and determine where the water level is. This will not drift over temperature, and can even be fairly immune to environmental concerns if you scan the points and look for a sharp change in whatever you measure. This could be very cheap and use a few muxes or something else clever to allow enough measurement heights to provide plenty water volume resolution.I hope this makes sense and helps.

author: ilium007
author_rank: Frequent Contributor
timestamp: January 07, 2013, 06:40:46 am
content: Sorry but that won't work long term - amongst a few reasons the fact that electrolysis exists will preclude this design. But thanks for the reply.

author: phatcenter77
author_rank: Newbie
timestamp: January 07, 2013, 06:59:08 am
content: I disagree that electrolysis will be a large factor. With low voltage, low duty cycle (measurement to take much less than a second repeated every hour, and proper material choice it becomes a non-issue over any projected lifetime. What other shortcomings do you see, because I believe this to be one of the only suggestions that meets all original criteria laid out and does not require a mechanical system. With regards to KISS I don't think it gets any better. I understand if it won't work for your specific use, but I'd like to know for my own knowledge.I do, however, really like the one linked to above much more...Quote from: ilium007 on January 07, 2013, 06:40:46 am

author: ilium007
author_rank: Frequent Contributor
timestamp: January 07, 2013, 07:29:36 am
content: Quote from: phatcenter77 on January 07, 2013, 06:59:08 amMy requirement is as much academic learning as it is getting a result. The fact that electrolysis is an issue precludes it form my options. On your point above - I believe that if you use AC the electrolysis issue goes away.

author: ilium007
author_rank: Frequent Contributor
timestamp: January 07, 2013, 07:43:04 am
content: So back to the ultrasonic method....This is the Maxbotix ultrasonic sensor I am going to trial. It is water resistant and is design especially to filter out small objects in the path of the beam:The idea is as follows:150mm PVC pipe on outside of tank connected at the bottom - this will reflect the true level of water but wont have all the turbulence of the water inside the tanks during a bit downpour. I want to test if the beam width at the bottom will be obstructed by the diameter of the PVC pipe. Maxbotix cant tell me so it is up to me to test !I would be happy for any criticism or otherwise !

author: Kremmen
author_rank: Super Contributor
timestamp: January 07, 2013, 09:35:15 am
content: Actually not a bad idea at all. Regarding sound propagation, only one potential issue comes to mind: multiple signal paths caused by reflections from the pipe sidewalls. That can cause the echo to spread in time so that a naive detection may give inaccurate readings. Having said that, it however should be the case that the direct reflection from the water surface should be the shortest path and arrive first. Surely it can be made to work with a bit of labbing.BTW the sensor looks interesting. Does DK or Mouser source them? I might be interested myself in that case.

author: ilium007
author_rank: Frequent Contributor
timestamp: January 07, 2013, 09:36:44 am
content: Quote from: Kremmen on January 07, 2013, 09:35:15 amI'm not sure - I got mine direct from Maxbotix:http://maxbotix.com/and they sent it to me in Australia.

author: Kremmen
author_rank: Super Contributor
timestamp: January 07, 2013, 09:49:15 am
content: OK, i'll look into it.One more thing that occurs to me: take care not to use too high repetition rate with the sound pulses in order to avoid reverb echoes from ruining the result. This is something you can see in boat fishfinders that are very familiar to me and i am sure many others here as well. When you run in shallow water you can see ghosts of the true bottom repeated on the display. This is due to multiple reflections between the bottom and the boat hull. So either let them die out or use some damper material to absorb the sound energy. Probably the first one is easier since the water level won't change in a hurry, right?P.S. Turns out Maxbotix even has a local distributor in Finland. Thanks.

author: ilium007
author_rank: Frequent Contributor
timestamp: January 07, 2013, 09:51:20 am
content: Quote from: Kremmen on January 07, 2013, 09:49:15 amOk - will keep it in mind. The unit I had doing my original Arduino integration and testing didnt seem to have any issues. Maxbotix have software on the sensor that does a large amount of filtering. I was sending out 50 pulses, getting the results, bubble sorting them and them pulling out the median value all within a second or less ! It was always very accurate.

author: ilium007
author_rank: Frequent Contributor
timestamp: January 07, 2013, 10:00:03 am
content: This is what is giving me hope !http://maxbotix.com/articles/050.htm

author: Kremmen
author_rank: Super Contributor
timestamp: January 07, 2013, 10:24:54 am
content: Yes, those things seem to be just the ticket, as they are made from this specific application in mind. Even the "raw" readings were really beautiful proving that there must be some serious signal conditioning going on already in the sensor unit itself. They have their price but it is most probably worth it going that way.

author: ilium007
author_rank: Frequent Contributor
timestamp: January 07, 2013, 10:26:42 am
content: Quote from: Kremmen on January 07, 2013, 10:24:54 amYes !! Pretty cool hey ?? Resolution down to 1mm ! I am soldering up the headers on mine now - might make the trek out to the water tank if I can get the LCD coded up tonight. So far I have got range data coming in via serial:

author: ilium007
author_rank: Frequent Contributor
timestamp: January 07, 2013, 11:56:56 am
content: This thing is amazing !! In 180us (yes, microseconds) I take 9 ultrasonic distance readings, sort them, find the median and output to an LCD !

author: johnwa
author_rank: Frequent Contributor
timestamp: January 07, 2013, 12:30:02 pm
content: Quote from: ilium007 on January 06, 2013, 12:46:23 pmI am actually in vic - I don't think I could take the heat up north, it is bad enough here, 38C today!There seems to be a fair bit of info out there on level sensing, you just need to know where to look. I hadn't done much research on the pressure sensors, as I had already got the article from SC.The hall effect sensors are another valid possibility. I was thinking of doing something based on reed switches at one point, as I already had a bag full of them.Your ultrasonic solution looks quite impressive!

author: ilium007
author_rank: Frequent Contributor
timestamp: January 07, 2013, 01:31:51 pm
content: Ok - so here is progress so far. I am able to read serial data from the sensor and output on the LCD that will sit with the arduino out on the tank (undercover):http://youtu.be/xZNCOu554SoNext steps are to sort out the code a little, and then get some outputs happening depending on water level. ie. turn on / off pumps. I will need to build a 10A MOSFET / SSD switch with opto-isolation from the 5V microcontroller. The Arduino is ethernet connected and the intention is to have the Arduino subscribe to an MQ server and it will send messages onto the MQ, I will then have the pump Ardunio subscribe to the MQ and it will turn on/off based on the messages that it receives. I have already prototyped this and it works perfectly.

author: jerry507
author_rank: Regular Contributor
timestamp: January 07, 2013, 03:50:17 pm
content: If you wouldn't mind, could you please tell us a bit more about your water setup? I'm stuck in the city so water service is simply a pipe running to my house. Why do you need all this tank storage? Do they fill up from rain or only from water deliveries? Etc etc etc. A really cool project, but also a really cool backstory I'm sure.

author: MaxBotixInc
author_rank: Newbie
timestamp: January 07, 2013, 11:02:01 pm
content: Hello,This is Scott Wielenberg from MaxBotix Inc. I have seen your forum post and have noticed that you are looking for a sensor to monitor the level of a tank. I have also seen that you are looking for a sensor with temperature compensation. You may wish to consider testing one of our new HRXL-MaxSonar-WR sensors with an external HR-MaxTemp connected to the sensor.The recommended sensor for tank level measurement is the MB7369 or MB7389. Both sensors feature a Most-Likely filter that ranges to the target with the largest ultrasonic reflection and ignores smaller targets such as wires or pipes. These sensors both have a maximum range of 5 meters and a 1 mm resolution and accuracy. The difference between these sensors is the serial output. The MB7369 has a RS232 seral data output, whereas the MB7389 has a TTL serial data output. Both sensors have an Analog Voltage output and a Pulse Width output.Our HRXL-MaxSonar-WR sensors have been proven to work extremely well in tanks. We have done our own tank level measurement test that can be seen herehttp://maxbotix.com/articles/050.htm.Please let me know if you have any questions by emailing me at scott@maxbotix.com.Best regards,Scott WielenbergTechnical Support & Salesof MaxBotix Inc.Phone: (218) 454-0766Fax: (218) 454-0768Email: scott@maxbotix.comWeb:www.maxbotix.comFollow us on Facebook at:http://www.facebook.com/pages/MaxBotix-Inc/125159384204938Technical support and sales are subject tothe terms and conditions listed on ourwebsite athttp://www.maxbotix.com/MaxBotix,MaxSonar,EZ0, EZ1, EZ2, EZ3, EZ4, AE0, AE1,AE2, AE3, AE4, WR1, WRA1, and WRLA1 aretrademarks of MaxBotix Inc.

author: ilium007
author_rank: Frequent Contributor
timestamp: January 07, 2013, 11:18:02 pm
content: If you were to read the post you will see I bought one of your MB7389 sensors.

author: IanB
author_rank: Super Contributor
timestamp: January 07, 2013, 11:21:28 pm
content: Coming late to the thread, but I should mention that in industry it is almost universal to measure liquid level in a tank using a differential pressure transducer. It just involves drilling a hole in the tank wall near the bottom and installing the pressure transducer in the opening created. If the liquid is corrosive or otherwise incompatible with the sensor, a protective diaphragm is placed between the sensor element and the liquid.Compared to other options it has the advantage of simplicity and having essentially no moving parts. I know you ruled it out earlier on, but I suggest it might be worth revisiting.

author: ilium007
author_rank: Frequent Contributor
timestamp: January 07, 2013, 11:29:24 pm
content: This has already been discussed. The cheapest diff press sensor in Australia is $575. I agree that a 4-20ma sensor would be best but I have 5 of these tanks to monitor.

author: Mosaic
author_rank: Regular Contributor
timestamp: January 07, 2013, 11:37:36 pm
content: Hi, I thought I'd share this as I did post a solution (on ETO) for something similar.http://www.electro-tech-online.com/microcontrollers/131535-mpx2100d-mcu-water-level-measuring-project.html

author: IanB
author_rank: Super Contributor
timestamp: January 07, 2013, 11:41:11 pm
content: Quote from: ilium007 on January 07, 2013, 11:29:24 pmThat's crazy money, but I'm thinking it should be possible to home brew something based on the same principle at lower cost than that.

author: ilium007
author_rank: Frequent Contributor
timestamp: January 07, 2013, 11:47:13 pm
content: Quote from: IanB on January 07, 2013, 11:41:11 pmThats what I thought but I have spent a lot of time looking into something else ! The Maxbotix sensor is the cheapest alternative. One would think it was not so hard to measure water !

author: ilium007
author_rank: Frequent Contributor
timestamp: January 07, 2013, 11:48:05 pm
content: Quote from: MaxBotixInc on January 07, 2013, 11:02:01 pmI will also point out that I approached you guys with all of my questions and drawings etc for some assistance in the application of the sensor and was simply told to buy osne and see. Thats what I am doing here.

author: Mosaic
author_rank: Regular Contributor
timestamp: January 07, 2013, 11:51:50 pm
content: Hi OP:How about a clear tubing water column with a coloured float connected to the outlet of the tank and matching the height of the tank?

author: ilium007
author_rank: Frequent Contributor
timestamp: January 08, 2013, 12:12:26 am
content: Quote from: Mosaic on January 07, 2013, 11:51:50 pmUmmmmm...I am trying to electronically measure water in a tank to interface with a micro controller to turn stuff on and off..... so the plastic tubing fits in where ?

author: Mosaic
author_rank: Regular Contributor
timestamp: January 08, 2013, 12:18:46 am
content: Well as u have a moving float u can sense it optically or electromagnetically (if it has a bit of ferrous metal in it).

author: ilium007
author_rank: Frequent Contributor
timestamp: January 08, 2013, 12:20:52 am
content: Quote from: Mosaic on January 08, 2013, 12:18:46 amAlready been discussed in this thread. I need/want 1cm resolution (70l of water in my tanks) so to do this with Hall Effect sensors would seem quite difficult.

author: mamalala
author_rank: Unknown
timestamp: January 08, 2013, 12:22:29 am
content: Quote from: ilium007 on January 07, 2013, 11:29:24 pmHave you checked the MPX sensors from Freescale?Greetings,Chris

author: ilium007
author_rank: Frequent Contributor
timestamp: January 08, 2013, 12:34:24 am
content: Quote from: mamalala on January 08, 2013, 12:22:29 amYeah - couldn't find one with a waterproof membrane on the sensor face. If I did go down this path I would want a 4-20ma sensor as well so that I could change the architecture of the design a little bit. With 4-20ma sensors you dont get voltage drop on long cable runs from sensor to micro controller.These are the Australian sensors that I have considered but the cost is just too high when I have a number of tanks to measure:http://anadexlabs.com.au/shop/catalog/Water-depth-probes-orderby0-p-1-c-272.html

author: mamalala
author_rank: Unknown
timestamp: January 08, 2013, 12:45:04 am
content: Quote from: ilium007 on January 08, 2013, 12:34:24 amHmm, are you sure? For example, look at the MPX5700A, this is an absolute sensor in the unibody package. If you look in the datasheet for that sensor:http://cache.freescale.com/files/sensors/doc/data_sheet/MPX5700.pdf?pspll=1On page 4 you can see the construction of that unibody package. The pressure side is internally covered in a silicone coating. P2 is not coated, but for the absolute sensor you can glue that onto a metal sheet to seal it off, for example.Other unibody sensors are constructed the same, IIRC. It's not that complicated to attach some simple circuitry that in turn will give you a 4-20 mA output. Or you put a small µC locally and give it a RS485 interface. You can then cover that circuitry in silicone as well to seal it all.Just an idea.... Since samples are available, i think it's worth a try.Greetings,ChrisEdit: I picked the 5700A rather randomly. Dunno what pressure range to expect in your tanks.

author: ilium007
author_rank: Frequent Contributor
timestamp: January 08, 2013, 12:46:26 am
content: Quote from: mamalala on January 08, 2013, 12:45:04 amYes !!! I would love to give this a try. I will look at that datasheet tonight.

author: mamalala
author_rank: Unknown
timestamp: January 08, 2013, 02:02:03 am
content: Forgot to mention, you might also want to check out the sensors from Measurement Specialities, for example the MS5541C or similar:http://www.meas-spec.com/product/t_product.aspx?id=5035That particular one is from 0 to 14 bar pressure, and has a 16 bit digital output.Greetings,Chris

author: Mosaic
author_rank: Regular Contributor
timestamp: January 08, 2013, 02:02:38 am
content: Ok, @ a 1cm resolution that's about a 0.1KPa pressure differential.This:http://www.newark.com/freescale-semiconductor/mpx4250ap/ic-pressure-sensor-20-to-250kpa/dp/07F9899?in_merch=Popular%20ProductsSupplies 20mV per KPa or .2mV per 0.1KPa.It can be used but you will need a decent instrumentation opamp for perhaps a x25 gain to feed into your ADC. Thus a 10bit ADC with oversampling to give 12 bit results using a 4.096V LM4040 precision Vref can work.@ 5mV per 1cm head (0.1KPa) after 25x amplification will resolve to an ADC result of 5*4096/4096 using 12 bit sampling = 5. Thus every 1cm head change delivers a change of 5 in your adc result.On the matter of isolating the sensor, I suggest using a 50 mL syringe with the plastic shaft of the plunger removed leaving just the rubber diaphragm on a plastic stub. Push the plunger remnant fully in. Then seal the sensor inside the syringe rear chamber using a silicone plug (leaving a decent air chamber for the sensor), bringing the wires thru the silicone. Attach the syringe/sensor chamber to the tank supply with appropriate tubing and silicone in place. Be sure to lubricate the syringe inner chamber with some silicone lubricant....the potable, unflavoured kind!EDIT:Actually if u use a bigger syringe it will be better as frictional forces would be negated by the square area of the plunger, also a bigger syringe will allow u to house the entire circuit with the sensor mounted on a PCB INSIDE the sealed air chamber. This means that u can make the MCu provide a 4-20mA output (buffered of course) based on its sampling of the pressure. Alternatively u can transmit the signal using RS232 with the MCu USART!To mitigate temperature (ambient) related air expansion, perhaps dumping the whole sealed assembly into the water tank would be best. Water doesn't change temperature quickly! Or include a thermistor on the PCB for the PIC to do temp compensated pressure. Be sure to assemble in a coldish/dry atmosphere and include a bit of silica gel with the pcb to prevent condensation if temperatures drop.These 2 links can help u do the communications or even a network for all 5 sensors:http://www.romanblack.com/blacknet/blacknet.htmhttp://www.romanblack.com/bitbangserial.htm

author: bfritz
author_rank: Regular Contributor
timestamp: January 08, 2013, 05:39:56 am
content: Quote from: ilium007 on January 06, 2013, 03:54:35 amWhy not use a second Maxbotix sensor, measuring a known distance. This distance can be horizontal at the top of the tank. Then just figure the factor to scale the sensor measuring the known distance to the correct value, then apply that factor to the result from the other sensor.

author: ilium007
author_rank: Frequent Contributor
timestamp: January 08, 2013, 07:32:33 am
content: Quote from: bfritz on January 08, 2013, 05:39:56 amThat's is a good idea - I hadn't thought of doing that. But....do you work for Maxbotix

author: mjrandle
author_rank: Contributor
timestamp: January 09, 2013, 09:31:13 am
content: Long time lurker, first time poster! I have a Maxbotix MB7380 ultrasonic sensor installed in the top of my 3000 L tank - which I understand is the standard version of your sensor, i.e. without filter to ignore small objects. The tank is above ground and about 2 m tall. The sensor (pulse width output) is wired up to a Freetronics Etherten so I can check tank level via internet. I'm in Brisbane and it's been pretty hot today, but I found that the tank level only varied by 1% between 5:00 am and 1:00 pm. My tank is only 0.9 m wide so I was pleased to see Maxbotix introduce these narrow beam sensors. I used a short length of 90 mm PVC pipe to raise sensor to maintain minimum 300 mm sensor distance. Let me know if you have any questions.Cheers,Mike

author: Strada916
author_rank: Frequent Contributor
timestamp: January 09, 2013, 11:22:47 am
content: This is no good??http://archive.siliconchip.com.au/cms/A_109529/article.htmlSounds like you are looking for something that does not exist. maybe make some compremises. You'll find pressure difference sensors the cheapest and one of the more reliable tank measuring systems. 1% is 25000L is only 2500L. A family of five can run a house on that for aleast 3 days more if your tight. Surely it does not take 3 days to get water in?Sorry if I have offended.Strada916

author: ilium007
author_rank: Frequent Contributor
timestamp: January 09, 2013, 11:26:41 am
content: Quote from: mjrandle on January 09, 2013, 09:31:13 amHi Mike - I am Brisbane as well ! I would love some more info on your setup. I am prototyping on an EtherTen as well. I am having some issues sorting out the timing on the MB7389. There are two modes of operation - free run and triggered. Freerun is more accurate but I only want it running when I drive pin 4 high. I then have (I think) 148ms to get the serial buffer and process it. I take 5 readings into an array, bubble sort them and grab the median value. I am using serial output because it is dead simple to transmit using an XBee mesh network.

author: ilium007
author_rank: Frequent Contributor
timestamp: January 09, 2013, 11:27:43 am
content: Quote from: Strada916 on January 09, 2013, 11:22:47 amNope - for other reasons discussed in this thread.

author: ptricks
author_rank: Frequent Contributor
timestamp: January 09, 2013, 12:32:13 pm
content: I needed to measure water levels in a tank but I had to do it non-contact with the water. After thinking about it a long time I came up with the idea to use LED with a phototransistor. The led and sensor are placed into two tubes side by side pointed at the water surface. As the water lowers the reflected light decreases and is easily measured. This only works in if the water is in a dark place, otherwise you have to change the length of the tubes that hold the sensor to block all the ambient light.An interesting side effect I found while doing this was it also makes for a great seismometer . While experimenting with the water and sensor setup I kept getting odd noise patterns , I though it was wiring at first then noticed it was the water picking up vibrations , it was sensitive enough that with a large amount of water being used it could pick up vibrations from a train on the tracks 2 miles away.

author: ilium007
author_rank: Frequent Contributor
timestamp: January 09, 2013, 12:57:41 pm
content: Quote from: ptricks on January 09, 2013, 12:32:13 pmWow - that is a really cool design ! Can you share the electronics design?

author: MaxBotixInc
author_rank: Newbie
timestamp: January 09, 2013, 03:28:36 pm
content: @ilium007Hello, this is Scott from MaxBotix Inc. I'm glad to support you. All MaxBotix Inc., employees are legally required to clarify their name and affiliation with MaxBotix Inc., in forum posts. I have provided some additional information below in response to your comments. I hope this information helps clarify any misunderstandings that may have took place.I apologize as I did not see you have purchased the MB7389. I had skimmed the forum post due to the length and did not see that.The MB7389 sensor can be mounted directly in the top of your tank and measure the distance to the water level. Our MB7389 sensors have been implemented successfully in many tank applications. With that being said, some customers have had to work through technical challenges related to ultrasonic sensors and the mounting of the sensor and/or other factors. As a result, we know our sensors work well in tanks and bins, however, testing the sensors is always required to ensure there are no technical considerations that need to be accounted for. We are always available and happy to support our customers through this process.What may have caused us to ask for diagrams of your application, is that we have not tested the MB7389 sensor in a 150mm diameter pipe for operation or accuracy. Our engineering team did a couple of brief tests in a 5cm diameter pipe. This was done for comparison to a sensor we had programmed and calibrated for use in a 5cm diameter pipe. We are always glad to support customers the best we can and many times, the more information we can gather about an application, the better support we are able to provide and make appropriate recommendations.If you have any specific questions, I am pleased to help any way I can. Please email me at scott@maxbotix.com.Best regards,Scott WielenbergTechnical Support & Salesof MaxBotix Inc.Phone: (218) 454-0766Fax: (218) 454-0768Email: scott@maxbotix.comWeb:www.maxbotix.comFollow us on Facebook at:http://www.facebook.com/pages/MaxBotix-Inc/125159384204938Technical support and sales are subject tothe terms and conditions listed on ourwebsite athttp://www.maxbotix.com/MaxBotix,MaxSonar,EZ0, EZ1, EZ2, EZ3, EZ4, AE0, AE1,AE2, AE3, AE4, WR1, WRA1, and WRLA1 aretrademarks of MaxBotix Inc.

author: mjrandle
author_rank: Contributor
timestamp: January 09, 2013, 11:49:01 pm
content: I don't have any experience with the serial output mode, but I found the pulse width method to be very simple (I'm not a software guy). I'm hoping to setup an Xbee mesh network in the coming months.I've attached a photo of the sensor, all of the PVC fittings were purchased at Bunnings (tank outlet, push on cap/plug and push on cap). Sensor is mounted using Maxbotix bulkhead nut. If I didn't have to raise sensor slightly, I would have likely used a Clipsal 240/16/1 junction box to cover solder terminals.Cheers,Mike

author: ilium007
author_rank: Frequent Contributor
timestamp: January 10, 2013, 08:23:02 am
content: Yeah - mine are on Xbees as it is really easy to get the serial signal transmitted. Going by the datasheet the serial output is most accurate a well. Last night I got my MQTT server running on the RaspberryPi as well so I now have measurements streaming to MQ.

author: ilium007
author_rank: Frequent Contributor
timestamp: January 11, 2013, 01:22:17 pm
content: So I thought I would give a quick update.I have mocked up the Arduino / RaspberryPi MQTT server.I have a bare raspberryPi (that I didnt have a use for) running the Mosquito MQTT server for the time being - it only draws a few watts and runs a Debian based Linux distro:I have my Arduino / MB7389 set up using the serial output as it is the most accurate (and quite easy to consume on the Arduino):So what happens:I send a message from my computer (over the data network) onto the MQTT queue that essentially says "turn on the sensor for tank1"The Arduino is an MQTT subscriber and is always listening for messages on a particular quque - when it receives a message a callback function is fired that interprets the command. If it is "command:range" it tells the MB7389 to take a reading.The Arduino sends pin4 high (it is usually tied to ground) and the MB7389 starts taking readings. The cycle time on the readings is about 148us and in this time I read the serial string it sends and extract the distance from the range reading (in mm) and store in an array. I take 9 readings and then send pin4 low again. I then discard the first 4 unfiltered results leaving me with an array 5 elements long. I bubble sort them from high to low and pull out the median value (hence the odd numbered array length).This reading is then packaged up into a MQTT message and sent back to the queue where it can be consumed by other program logic (this will be Python code) to, say, turn a pump on/off or send the reading to a database / internet cloud service (Pachube etc) so I can keep historical data on water usage.Video:

author: wigman27
author_rank: Regular Contributor
timestamp: August 28, 2014, 04:19:04 am
content: Hi all!I know this is a very old topic I am wondering of you have some example code?I am trying to do a very similar thing but unsure how to go about it.I am having a lot of trouble working out how everything fits together with MQTTWe are using a raspberry pi to serve a webpage that on load it sends the arduino a message over MQTT then the arduino reads values and sends it back to the pi which displays the results on the webpage but I just can figure out the best way to do it!Anyone that can help would be fantastic.ThanksLee