Looking for a level sensor in a very dirty liquid

Hi all,

I have in mind to monitor the level of the liquid in a skimmer cup. For those that are not familiar with a skimmer used in saltwater aquariums, I attached a picture of mine. The liquid can vary from very fluid (water) to viscous (syrup), it is corrosive containing salt and other dissolved organic mater. I guess that the electric conductivity is varying, too. In the picture the current level is between the red lines, where the max level can go up to the blue line

The variation in viscosity and the probability of normal sensors to get stuck gives me trouble in selection. If possible I would like to monitor the level, not only min max points.

Any help is appreciated.

What kind of resolution are you looking for?

I'd make a multilevel detection board. If you need, say, 20 levels, stick copper tape on the side of the tank in 10 level and a much larger piece of copper tape from top to bottom of the tank. Then use capSense library. Estimate 1/2 between the levels of copper tape using the readings from sensors under water level.

The plastic tank will act as a dielectic to the conductive liquid. There should be very little capacitance measured from the copper tape above the level of saltwater.

Thank you for answer. Definitely something to look into.

Do you envision this on the inside of the tank (cup)? Or outside? If inside, I am wondering if the splashing of the liquid and dirt would affect the readings at various levels.

It looks that it needs one pin for each level, right? Unfortunately I only have one pin in my books for this application. I am wondering if using the same principle, and find something to convert these levels into analog voltage. Somehow energizing transistors and building up voltage at output ..... just thinking loud here.

Probably I would need a resolution of 10-12 levels.

Thanks a lot

use a pipe with a cork that floats and put a ping distance sensor above it.
You might need some calibration as the speed of sound might be slightly different due to high humidity right above the water level.

I suppose you could make something for the inside. Etch a PCB but then it'll have to be well coated with some kind of permanent conformal coating.

I was picturing sticking copper tape on the outside of the tank.

robtillaart:
use a pipe with a cork that floats and put a ping distance sensor above it.
You might need some calibration as the speed of sound might be slightly different due to high humidity right above the water level.

Indeed something to think about. I am afraid that the nature of the liquid would get the cork float stuck in one position.

polymorph:
I suppose you could make something for the inside. Etch a PCB but then it'll have to be well coated with some kind of permanent conformal coating.

I was picturing sticking copper tape on the outside of the tank.

Certainly I would like it outside if possible.

Going from the cap idea, I found few links. They use strips outside the container and measure the varying capacitive value. Thoughts?

http://soulysolar.mudventions.com/?p=681

I think you can do this with a single I/O pin and a vertical strip of copper tape or aluminum foil on the outside of the tank, if you can also make a connection to the liquid inside. This forms a capacitor, the value of which depends on the liquid level. Here is an old article from Nuts&Volts showing how well the technique works: http://mechanical.poly.edu/faculty/vkapila/ME3484/Readings/NV27-Measuring%20Water%20Level.pdf

Edit: here is an example that requires no external electronics http://playground.arduino.cc/Main/CapacitanceMeasurement

jremington:
I think you can do this with a single I/O pin and a vertical strip of copper tape or aluminum foil on the outside of the tank, if you can also make a connection to the liquid inside. This forms a capacitor, the value of which depends on the liquid level. Here is an old article from Nuts&Volts showing how well the technique works: http://mechanical.poly.edu/faculty/vkapila/ME3484/Readings/NV27-Measuring%20Water%20Level.pdf

Edit: here is an example that requires no external electronics Arduino Playground - HomePage

Link on the playground to the sketch seems broken.

Yeah, the link is broken.

I was reading on the other link. Looks easy and within my capabilities :). Arduino also has the pulseIn() function, which can be easy implemented in my overall project.
http://mechanical.poly.edu/faculty/vkapila/ME3484/Readings/NV27-Measuring%20Water%20Level.pdf

Before that link was broken, there appear to have been problems with the approach, as discussed here:
http://forum.arduino.cc/index.php/topic,151733.0.html

It is pretty easy to measure small capacitances using an I/O pin and a resistor, but Arduino examples are hard to find. Here is one for a PIC using a timer and the on-chip comparator, that can implemented on an AVR Making a digital capacitance meter using microcontroller | Embedded Lab

Rather than try to connect to the liquid inside, you can put two strips of foil on the tank and measure the capacitance between them, as shown in the Nuts&Volts article. Another possibility that in addition solves the problem of external proximity effects (like someone's hand being near the tank) involves making a cylindrical capacitor out of some tubing and a central wire. That was recently discussed here: Capacitive liquid level sensor - Project Guidance - Arduino Forum

The reason I am not suggesting using the measure of capacitance as the measure of level is because you say that the water will have varying levels of contaminants.

I would -not- put anything in electrical contact with the liquid, it will corrode. It isn't necessary, anyway. Put a big sheet of copper foil on the bottom or the opposite side of the container and connect that to the Arduino's ground.

It seems to me that everyone makes this much more complex than it needs to be. This can be done without capSense, even.

Since this is an aquarium, am I correct in that the salt content and temperature is fairly constant?

If so, that 4060 circuit or this circuit with 555 timers would work:

The dielectric constant of water does change with temperature. If your water temp isn't changing much, no worries. With a very high value timing resistor, changes in conductivity due to changes in salt content won't matter as much, within a reasonable range.

Thank you folks for feedback.

Yes, you are right. The aquarium temperature is pretty constant and also measured by the same controller, so it can be used if needed. The collector cup is more at room temperature. If that would be the issue, I can add a temperature sensor nearby. The salt content in the aquarium is constant (for this purpose) and also evaluated by the controller with an EC probe. The salt in the collector cup is unknown. It does vary a lot, I guess.

Since both ideas have zero or near zero material costs, I am willing to test both of them:

  1. Using an I/O pin and a resistor. I still have to figure out the code on this one.
  2. Using 4060 circuit as shown in the Nuts & Volts article.

The main thing would be to make the capacitor. I am thinking that a dual strip capacitor (two vertical strips) would work better compared to one at the bottom and one vertical. I see it as two capacitors in series. If the liquid rises, both capacitors will vary, so there is going to be more overall change in capacity (better accuracy?). Just thinking loud.

All the metallic parts would be outside of the collector cup.

Strip width? One inch? One and a half? I have no clue. Probably the more the better.

I will leave improvements like human hand proximity at a later stage.

I have a concern with the capacitive methods, but not so big to stop me testing these two methods. When the container gets dirty, deposits of dirt (thickened liquid) are on the inside walls. The inside is also humid, so the response would probably be a cloud of values instead of a line or curve. Would measurement at two frequencies solve this or not? Will find out later :).

Yes, this will require a lot of experimentation to get working to your satisfaction, however if only about 10 liquid levels are needed, I would be surprised if it doesn't work. I would start with strips of self-adhesive copper tape, which you can get at stores that supply stained-glass artists. They run about 10 mm in width and are intended for solder connections.

Let us know how it goes! The topic of level sensing comes up often, so your contribution would be important.

Thank you Jremington. I will look into copper strips. Is good to know that others will benefit from this experiments. I will post everything, hardware, testing data, code, etc.

I already ordered couple 4060's. Unfortunately I have to put this project on hold due to the Holliday season. I'm going out of town. We'll continue after new year.

Cheers, Bogdan

By the general standards of "very dirty water", the water in an aquarium filter is not really "very dirty" at all.

One pin:

Vcc to resistor
Other end of resistor to Arduino and copper tape strip on the outside of the container

Change Arduino pin to Output, pull Low.
Change Arduino pin to Input, use method of your choice to measure time until voltage rises to 0.7 of Vcc.

Time will be proportional to capacitance and therefore water level.

Looks simple. Thanks

Looks like someone wrote a variation on capSense, called CapacitiveSensor. Does what I described but using the internal pullup resistor.

http://playground.arduino.cc/Code/CapacitiveSensor