Water Level w/ Probes and Pull Ups

Hi All,

I'm having a hard time with my project and am hoping I can get some guidance.
Here is what I am trying to do:

I have a sump pump in my basement and I'm building my own backup system. The system is comprised of a 12 volt battery, a relay, a small 12 volt pump and an Aduino. From the Arduino I have three 'probes' that extend down into the pump. These probes are just wires soldered to some small pipe clamps (for added weight). One probe is connected to ground, one is for a low water level and the other is the high water level. The plan is that when the water rises to the high water level, the pump will turn on and when the water goes below the low level, the pump shuts off. The programming seems to be fine because when the water hits the high mark, the pump turns on. The thing is that it doesn't stay on very long (sometimes a few seconds, other times 10-20 seconds). I am using pull up resistors for each water level probe. The code looks for the high water mark to be drawn to low then the pump turns on. The code then looks for the low water mark to draw back to HIGH to turn the pump off.

My guess as to what's going wrong could be the low water probe is maybe still 'floating' a bit even with the pull up on. Unfortunately my code requires a fully consistent draw to ground. If there is a 'blip' and the pin goes HIGH for even a millisecond the pump shuts off.

Any thoughts on how I can either fix this problem or troubleshoot further? Maybe a different approach?


Before anybody else says it:

Post your code

Post a schematic

Post a photo


I shall get right on that. I'm somewhat of a cowboy in terms of creating my projects and don't create nice looking schematics. Can you recommend good, free schematic design software?


LTSpice? Eagle? Diptrace? KiCAD?

Conductivity of water is variable, depends heavily on what contaminants are in it. Metals corrode when you run current through them in water.

Thanks for the software recommendations, I'll get on the schematic.

Yes I'm aware that metals will corrode over time. I'm prepared to deal with that using preventative maintenance. I will be converting to stainless steel if I can get this up and running.

The variability of the water is what concerns me. I thought that might be an issue. It is ground water with MANY minerals in it so I didn't think it would be an issue. It conducts very well. Is there any way to deal with the variability of the water 'circuit'?

What about a float switch?

Have you tested your idea yet on a scale relative to your project? I'd be worried that your resistance through the water is on the MOhm scale, and you'll have trouble dropping enough voltage to detect between 'open' and 'closed'

Also, stainless steel is at the very least terrible to solder to (It might be impossible, I've never tried), and it won't help you with stopping from corroding wires. Additionally, water can flow between the strands of your wires inside the jacket. You'll need to seal the water end of your wire completely, though that is easily done with epoxy.

Use a physical pull-up and experiment to find a good value (remember
the conductivity of water varies by many orders of magnitude depending
on the level of dissolved ions).

Use analogRead, not digitalRead, then you'll get numbers back which you can
use to help select good pull-up values.

Even stainless steel corrodes when in constant contact with water. Especially when supplying current through it.

I vote for a float switch, too.

Thanks to all of you for your ideas.
I will play around with analog read but am ordering a couple of small float switches as I might fall back on them if needed.

There are I believe there are magnetic float reed switches that can be installed on the inside of the tank. This of course assumes the tank is not ferromagnetic.

Which leads to the question: What is the tank made out of?

It's concrete

Hi, a photograph hand drawn circuit will be sufficient.
A float switch would be the better choice, or got to the pump shop and see if they sell the simple float on a rope switches that most sump pumps have.
The float is on a lanyard, as the sump fills the float rises until the lanyard pulls on it, this makes the float stand up in the water, turning a tilt switch on or off to indicate that it is at full level.
When the level is low enough the float lanyard no longer pulls on it so it floats on its side and indicates to turn pump off.
They are water proof, probably have two mercury tilt switches inside.

Tom..... :slight_smile:

It doesn't matter what the tank is made out of, as long as the magnet and detectors are not right next to it.

In any case, as TomGeorge points out, you can buy a fully enclosed sump pump switch.

Yup, I'm going to try the float switch idea

With a float switch and a little messing around with how long it takes your pump to move the water level, you might not even need a microcontroller. If the float switch triggered a monostable multivibrator timed to run for X seconds you might be good.

My uncle and I hooked up a sump pump in his basement. Float on a rod passing through a hole in a piece of wood to keep it going straight up and down. Toggle switch. Pipe clamps on the rod, as it rises with water, the lower pipe clamp clicks the toggle switch On. Stays on until the water drops low enough for the upper pipe clamp clicks the toggle switch Off.

Simple and reliable.

I imagine the sump pump with floating switch has some hysteresis built in, too.


Shipping time = Slow Boat from China. Find them from local vendor.

I use these in a saltwater aquarium: 1 to guard against aquarium overflow, and 2 each in tubs.

In the tubs, I attach 1 at the high water mark and 1 at the low water mark.

Keep in mind that I am filling tubs. The exact opposite of what you are doing.

When the lower switch trips down, I turn on the pump to fill the tub. When the top switch trips up, I turn off the pump.

In the Arduino, I turn on the internal pull-up resistors on the INPUT lines. I flip (if necessary) the float to be active LOW.

It’s a very simple sketch. When you get it all working, you can burn the sketch to a Pro Mini (< 3 bucks, ebay) and have a nifty little controller running your pump. Bragging rights to family, friends, and neighbors.

You can attach the float switches to a stick, wire, fireplace log, just as long as they can float freely without getting tangled by something. They last forever. I have had 5 of them in saltwater for about 8 years.

Luck, John

Using ultra-sonic sensor is more reliable. See what I have been doing lately:
------------------------- Added comment later -------
Pay attention on how I hand-made a card board tube to filter out sound reflection from the pump. The tube is essential to ensure the reflection comes from the water.

You could use an etape sensor from from milone (milonetech.com). They are easy to hook up to an arduino and are rated for water and/or chemical immersion. I'm using one in a water tank.

I just ordered 5 of the google-eye ultrasonic sensors for $6.70. About $1.30 each. You only need 1 per application. And it is much cooler than using float switches. It gives you enhanced bragging rights with family and friends.

'Way cool suggestion uzcaliber.