view all posts by Eric Allman

An Arduino-Based Sump Monitor (Part 1: Hardware)

Eric Allman Posted by Eric Allman | Wed, 03 Jul 2013
see the original posting from Stochastic Ideations

We have a below-grade basement. We have a sump, but we’ve had problems with the pumps, or more precisely, the pump switches. Note the use of the plural: several years ago we installed a second pump on a separate switch, but we have still had both of them fail.

So, I decided to build a monitor for the sump to measure both the height of the water in the sump and when (and if!) the pumps turn on. This needs to be able to send us alerts when something goes wrong, and may give us an idea of whether our sumps should be upgraded to something higher power.

Many of the ideas (and a substantial part of the design) was stolen from http://pscmpf.blogspot.com/2007/12/sump-pump-monitor.html (which I will in the future just call “pscmpf", since I can’t find the poster’s actual name). However, that posting left out a fair number of details which I’m hoping to include here, and in any case I’ve added some of my own twists — notably the inclusion of an Arduino.

This posting is fairly long, so I’ve broken it into two parts. This one discusses the hardware. The software will be in a separate post.

Overview

Like pscmpf, I’m measuring two things: the level of the water in the sump and when (and if) the two pumps run. The two pumps are at different levels in the sump, with the lower pump being the primary and the upper pump being a backup. They each have their own switch. One is a fairly standard float switch, but these tend to be unreliable — in particular, they can float into a position where they get trapped in the off position. The other is a LevelGuard solid state switch, which is quite expensive but is claimed to be reliable. Unfortunately the one I bought failed (resulting in my most recent basement flood; the backup switch also failed), but I do have to say that the company contacted me, explained that they had updated the design, and sent me a new one. I haven’t had that one long enough to be certain of its reliability, but I’m hopeful.

The basic design has the two types of sensors (sump level and pump status) feeding into some custom built circuitry that then feed into an Arduino Ethernet to do initial processing. The Arduino runs a small server using a bare-bones custom protocol. Additional software on my FreeBSD box talks with that server and issues alerts as necessary, e.g., by email. The Arduino also has a few local indicators including LEDs for all of the sensors and an audio alert to complain if the level gets too high.

The special purpose circuitry was assembled on a piece of perf board. It would have been more elegant to build a circuit board, and after some of the problems I had building it there were a couple of times I wish I had. However, it did work after a few botched starts.

The Sump Level Monitor Hardware

The sump level monitor uses six simple conduction sensors to measure the water level. This uses a piece of plastic pipe with eight stainless steel bolts as terminals, placed at approximately 4, 5, 8, 12, 16, 19, 22, and 26 inches from the bottom of the pipe, wired up to some spare Cat 5 cable. These were chosen to measure “interesting” levels. In particular, the lowest one (4) is ground, 5 is below the bottom of the bottom pump range (hence it should be on unless water evaporates), 8 is near the bottom of the range of the bottom pump, 12 is near the top of that range (so although it’s not necessarily a disaster if it is underwater, it means the pump probably isn’t keeping up), 16 is between the two pump ranges, and so forth. The terminal at 19 inches is another ground wire, since the resistance of clean water is quite high — although sump water probably isn’t all that clean.

I did have one substantial difference versus psmcpf: he ran his wires down the inside of the pipe, insulated each of the terminals, and capped the bottom end of the pipe, i.e., there is no water in contact with the wires. That’s a much more elegant design, but I couldn’t figure out how to reach my fingers a foot and a half into a 2 inch pipe to do the wiring. As a result I just ran the wires down the outside of the pipe and didn’t bother capping it. If this fails over time I can always build a new one. That’s the easy part.

Each of the active contacts feeds into a simple transistor amplifier which I shameless copied from pscmpf. The schematic is on his page (redrawn here). I also included the LEDs as shown in his design so that I have some feedback above and beyond bits sent over the network connection, and besides, all projects are improved with blinking lights.

The Sump Pump Monitor Hardware

Much like psmcpf, I build a current monitor to see if the pumps were actually switching on. However, he built his sensor by winding some power wire around a bolt and then using a hall effect device. I had two spare Current Transformers (CTs) left over from a project to do house energy monitoring; they can be purchased from Brultech Research for about $5 each.

The CTs produce a current which you need to turn into a voltage. This is just a matter of putting a burden resistor (R3) across the CT, with the size of the resistor determining the output voltage. Since I’m feeding this into an Arduino that takes inputs from 0–5v, one side of the CT has to be pulled up to about half of the operation voltage using a couple of resistors (R1 and R2) as a voltage divider. Throw on an output resistor (R4) to limit current and a zener diode (D1) to keep from frying your Arduino (remember that starting up a pump induces a hell of a kick into the power line) and connect the whole thing to an analog input. There’s some software trickery required, but I’ll get to that when I discuss the software.

I also added two LEDs to indicate the state of the pumps. Unlike the level sensors, these are not driven directly from the circuit. After considerable experimentation I gave up on a design that would amplify the millivolt AC signals coming off of the CTs and then rectify them to drive a LED (on the other hand, I learned a fair bit about op-amps). Instead, the LEDs just hang off of two digital outputs from the Arduino. This also lets me use them to indicate other conditions under software control.

The Arduino Controller Hardware

There’s nothing particularly fancy about the Arduino hardware, other than needing ethernet. Rather than using a shield, I used an Arduino Ethernet. However, in order to mount the Arduino onto a perf board (used for the rest of the circuitry; see the next section), I had to desolder three of the four stackable headers and turn them upside down. Desoldering these was a bit of a challenge, but I eventually got it to work, amazingly without frying the board, using a combination of a solder sucker and braid. I was tempted to buy a desoldering station, but the price was prohibitive.

I only changed three of the four stackable headers in large part because my perf board has 0.1 inch (2.54mm) spacing, but one of the headers is offset by 0.05 inch. Conveniently I didn’t need that one to go to the circuit board, and in fact it’s convenient to have it in the usual orientation in order to do testing and to connect a piezo transducer to get some panic sounds in the event of troubles, such as the water level getting too high. This way it does something even if the host system isn’t listening to the box. Incidently, I hang the transducer between two data pins and use the toneAC2 library, rather than between one pin and ground. This gets me better volume.

Putting The Hardware Together

I built the custom circuitry on the perf board. It’s not super beautiful, but it does work. My biggest problem was that I initially had some heat shrink tubing that needed a lot of heat, enough so that it melted the insulation on some of the wires, so I had to deassemble it and rebuild with better heat shrink tubing. Fortunately this wasn’t as painful as I first expected. (The first picture shows the mostly assembled unit in the box, without the piezo transducer installed or external connections. The second one shows the complete unit from the wiring side, after replacing the melted wires.)

The major challenges in putting the whole thing together were mechanical. I bought a project box from Jameco (stock number 141841) for about $10, which was just about the right size. The mounting screws on the bottom were self-tapping, so I just tapped the mounts to 4/40 and screwed in some nylon standoffs to give a bit of extra room under the board. More nylon hardware is used to secure the Arduino to the perf board, and then the whole unit is screwed into the box. Of course, the box had to be modified to give access to the ethernet and power jacks; this was pretty easy using a jewelers saw and some small files, but it would have been a nightmare without the saw (a gift from my grandfather, who was a jeweler).

This kind of wraps it up for the hardware. As of this moment, the hardware isn’t installed, but I’ll update this post with pictures of the final installation when it is done. The software description will be coming in another post.


see the original posting from Stochastic Ideations

Back to top