Electronic – Smallest water detector / switch

switchesunderwater

I am looking for a small simple switch. But it has certain restrictions because I want to use it for salt water aquarium and copper exposure is lethal to some fauna, as well as some plastics.

Looking around the internet i found floating switches, optical switches, rod inducting switches, a few diy projects switches i.e. a Sonar switch- very promising just with salt.. well salt accumulates in every place possible under the hood.

I might go with the sonar and a small arduino or attiny…

but I am wondering if it is possible to use a single wire to detect resistance change? or something clever like that. I only want to detect if the aquarium is about to overflow and shutdown pumps in case off emergency- so minimum copper exposure wont kill anything but flooding my wooden floor.. well the wife will kill me..

My aquarium (and most other Marine hobbyists will have these spec ranges)(only advanced people will go over or under these for other specific reasons)

  • Temp 22~26 Celsius (ME: 24oC)
  • Salinity 1.022 ~ 1.026 (ME: 1.026) (Specific Gravity)

But I would like to assume this works on Clean water too( as in Reverse Osmosis with no minerals or salt) The distance would be max 1 cm apart- no need to measure the entire tank.

Best Answer

There are clever techniques for sensing water with a microcontroller. I'm doing that with one of my projects right now. Sensing even distilled water is actually pretty easy with the right algorithm.

However, since this is just a basic failsafe switch, simple and dumb is better. I would use a float and a mechanical switch. Have the switch be normally closed and run all the power thru it. When the tank gets above the fault level, the switch opens and shuts off everything. Keep it simple.

If you really want to know about electronic water detection, I can get into more details, but it doesn't sound appropriate here. Something as simple as what Oli described can work, but has its problems. With a micro you can get more sophisticated to get around problem like noise and net DC current.

More on electronic water detection:

There are several problems with electronic water detection using resistance. This method can be made to work nicely and reliably with little effort, but you have to be aware of the issues and know that you have dealt with them. Issues include:

  1. Water bridge. This is usually due to dirt buildup on the surface of whatever is holding the two conductors and then that getting wet and retaining enough water to make a connection. Sometimes just dirt and humidity can do it. In extreme cases with ridiculously close sensors, you can even have capillary action forming a outright water bridge between the two sensors.

    The best way to deal with this is to make the surface creapage distance between the closest points of the two conductors long and of hydrophobic material. Keep in mind though that a dirt coating defeats a material's hydrophobic properties.

  2. Electrolysis. This doesn't necessarily hurt the sensor but but can cause problems with stuff that may be in the water. It also greatly accellerates electrode corrosion, which does hurt the sensor.

  3. Corrosion. Should be obvious, and salt water is particularly bad. Again, a net DC current can cause electrolysis, which can cause serious corrosion much quicker than otherwise.

  4. Battery effects. Even little asymmetries of the sensors can result in a average DC open circuit voltage between the sensors. The voltage will be low and the impedance high, but often these sensor circuits are designed to use µA and MΩ, so this can confuse a naively designed algorithm.

  5. Electrical noise. With MΩ impedances, all kinds of noise from nearby electrical devices can be picked up. Most of this can be dealt with by aggressive low pass filtering and realizing the noise will mostly be common mode. This is not hard to do, but simple knee jerk dumb approaches can have problems due to this.

One of my current projects includes sensing whether a hand held unit is immersed in water or not. This has to work with clean or dirty water, although it is not intended for salt water. The electrodes are about 1 inch apart and plated with something corrosion resistant. I don't know what exactly that is. These are the same electrodes used successfully on previous products and I have nothing to do with their design.

Each electrode can be either driven by a processor pin or its voltage read by the processor A/D while being passively pulled down with a appropriate resistance like 1 MΩ. I don't want to get into too much detail of this product, but basically the strategy is to use a 4-phase measurement. The voltage on each pin is measured with the other pin driven both high and low, with low pass filtering and sufficient settling time. To get a single metric of water detection, I take the two high measurements minus the two low measurements. Note that this cancels out any common mode signal and any steady differential mode signal.

In this case I have the advantage that the product is hand held and battery operated, so there is no net path to ground or elsewhere outside the unit. You can make this true in your case, which would be a good idea, if the microcontroller is running from a separate isolated supply. Basic safety should dictate this anyway.

In the product I mentioned, we consider water to be present when the resistance between the two electrodes is 3 MΩ or less. You should be able to use a significantly lower threshold since salt water is many times more conductive than the clean water we have to assume is our worst case.

Related Topic