Sump Pump Monitoring System


#1

Hi all,

A friend of mine is looking to build a monitoring system for a sump pump. Can you folks give suggestions?

Here is his idea:

So I need some hardware hacking advice, and I was hoping you could help. I think I can figure out what I need about Arduino software, and further up the stack, but I really don’t have the first clue about basic electronics hardware, other than basic polarity, voltage, amperage, induction behaviour, half-forgotten-grade-11-physics kinda stuff.

The problem:

Last week, when I was driving on a long trip, I got a text from my house indicating that my sump pump (for storm water) had failed in some way - this means my house could flood within hours. I had to drive down to where there was decent cell reception and deploy a squad of troubleshooters to solve the problem. Even when I was down to where there was connectivity, I had no visibility into what the problem might be, I just had to send my plumbers over, who were not able to immediately diagnose the problem. The alarm eventually resolved itself, and when I get home tonight I’ll be able to troubleshoot it from there.

The context:

The sump pump controller unit controls 2 pumps (by switching 110v circuits to them on) and is informed by 3 floats (also 110v circuits, closed when the float is floating, open when it is hanging). The wires for these circuits are simple conductors running from the controller unit underground about 50 feet in a conduit to the 14-foot-deep sump in our front driveway.

There are 3 floats, and they are, from bottom to top: a stop float, a start float, and an alarm float. When the water level rises high enough to float first the stop float, and then the start float, a pump is activated; the start float turns off as the water lowers, and the stop float eventually turns off as well, which turns off the pump that was running. The water rises again, until the stop float and the start float are both floating - at which point, the other pump runs, until the stop float stops floating - and the cycle continues, alternating pumps each time. If the start float does not float (fails, or gets tangled) or the pump that is being powered fails, then the water will float the stop, start, and finally the alarm float - when the alarm float activates, the controller turns on both pumps and sends the alarm to the ADT household alarm system, which has an ethernet bridge to a free monitoring site, which texts my phone and the phones of a few friends close by who can come fix things if I happen to be out of cell range or dead or something.

The plan:

  1. For each of these 5 conductors, I want to put a clamp-type induction sensor around the conductor, and plug it into an Arduino board.
  2. I’ll write a simple Arduino program to continuously poll the sensors, writing a stream of data to an SD card (using an SD shield), and sending the data up in chunks to cloud storage somewhere (using an Ethernet Shield).
  3. I’ll write a web app somewhere (probably with javascript, blech) to consume the stream of data and graph both pumps turning on and turning off, as well as the floats going up and down, over time. Plus hopefully a live-animation page that shows an actual visualization of the sump floats and pumps, reconstructing reality in a moving image (well, not completely… without an actual water-level sensor (different project) I can’t correctly show the water rising and falling in the sump pit). For extra credit, I may implement some stuff to tell when the pumps start drawing more or less amperage than they historically have, indicating that possibly they are heading for failure.

Hardware:

SJE-Rhombus dual pump controller panel: this is the installed unit that controls the pumps.
Arduino Uno board: I already have this, an OSEPP Uno R3 Plus, whatever that means.
Ethernet shield: I already have this, it appears to plug directly into the arduino board and pass the inputs through
SD shield: I don’t have this, I’ll probably pick up one of these: https://www.sparkfun.com/products/12761 and https://www.sparkfun.com/products/11417
Induction sensor: I’m thinking: https://www.sparkfun.com/products/11005. I’ll need 5 of them.
Prototype breadboard: https://www.sparkfun.com/products/7914 and https://www.sparkfun.com/products/12043

Questions:

  • Any suggested changes? I’m not married to any of this and I could easily be making poor choices.
  • The induction sensor ends in a 3.5mm audio jack - I guess the thing to do is cut, strip, and plug into a breadboard, and then jumper that lead into an input on the arduino… possibly with a resistor along the way. Can I just take this wire (whatever gauge it is) and jam it into a breadboard rig? How would someone who knows how to do this, do this?
  • I know the induction sensor should work on the 1hp pumps when they’re drawing amperage… but I wonder if I’ll get any significant response from the floats, considering the load there is probably minimal, just enough to judge connectivity. the pump load could in principle be running through the float circuits, but I know that in some cases the floats are on, but no amperage is being drawn, because no pump is running - for instance when the stop float is floating but before the start float is floating, no pump is running, but the float is up. So the circuit could be connected, but no significant amperage is going through - is there another, much lower-power induction sensor I might need in order to detect current in this case? I guess I’ll use a tester to figure out what comes out of the induction probe when it is clamped around the different wires.
  • There’s an alternative to the induction sensors; I could wire the 120v conductors going into the sump pump controller to a set of dry contacts (an optical relay of some sort?). There are several downsides to this - on the pump circuits, I wouldn’t have the benefit of knowing how much power is being drawn; later on I hope to use this value vs historical values to determine when a pump may be going bad. Also, my insurance may be voided by messing directly with the wiring - a touchless solution is preferable.

Your thoughts?


#2

The only thing I can think to add would be some way to actually measure the water level in the tank independent of the float sensors… I know they use ultrasonic sensors in industrial settings. Wonder what you can do with the cheap ultrasonic sensors like these:
https://www.aliexpress.com/item/K02-integrated-ultrasonic-ranging-module-parking-sensor-waterproof-ultrasonic-sensor-module/32763160997.html

Then you would know exactly what was happening…


#3

As we’ve been discussing in Slack lately, this seems like a good use of InfluxDB for storing the data, and Grafana for the pretty pretty graphs. Arduino can also write the data pretty easily over ethernet to Influx. No JS necessary.

Are the long cable runs shielded? They should be, particularly if sump pumps are hanging around.

Other than that, a schematic or diagram of some sort would make the questions and description of the setup more clear. It’s like posting a programming question and not showing your code :slight_smile:


#4

Hi all, my friend has been working steadfastly at getting his project. Here are his responses to the previous comments:

The only thing I can think to add would be some way to actually measure the water level in the tank independent of the float sensors… I know they use ultrasonic sensors in industrial settings. Wonder what you can do with the cheap ultrasonic sensors like these:
https://www.aliexpress.com/item/K02-integrated-ultrasonic-ranging-module-parking-sensor-waterproof-ultrasonic-sensor-module/32763160997.html

Then you would know exactly what was happening…

I’ve thought about measuring water level, and it’s a project I want to do at some point. It’s not top-of-list though, because it won’t tell me why the water is not being pumped. The floats alone will tell me the water is rising. It would, however serve as a useful backup alarm, and ultimately it is one of the variables I want to track, if only because it will make the sump-pump animation cooler and more accurate :-).

As we’ve been discussing in Slack lately, this seems like a good use of InfluxDB for storing the data, and Grafana for the pretty pretty graphs. Arduino can also write the data pretty easily over ethernet to Influx. No JS necessary.

I’ll take a look at those things - sounds like a better option than what I was thinking.

Are the long cable runs shielded? They should be, particularly if sump pumps are hanging around.

Well, the conductors from the sump controller to the sumps and floats goes through 3/4-inch underground conduit, for probably 50 feet or so. The conductors are about 15 #14 single, solid-conductor wires that are spec’d for running through water (a requirement apparently when you run through outside buried conduit; they made my electricians pull the cheaper wires and replace them). I don’t know if that means they’re shielded or not. Probably not. Once the wires emerge from the conduit into the mechanical room, they are separated as they are wired into the various parts of the controller box.

Other than that, a schematic or diagram of some sort would make the questions and description of the setup more clear. It’s like posting a programming question and not showing your code :slight_smile:

I can do that. Attached is the diagram from the manual for the sump pump, for this particular configuration. I’ll have to put together some more useful diagrams about how it all is wired together.

More to follow


#5

Here’s a shot of the breadboarded rig:

From my friend:

I’ll have something prettier to show once I’ve got my perfboard and soldered up two monitoring circuits instead of just 1 (coming from Adafruit tomorrow). I’ve also ordered an Ethernet/SD shield and a real-time-clock, so I can start on the logging part.

It will be interesting to see what the startup spike looks like. And in the long term, what kind of maths have to be applied to the data in order to truly detect what an out-of-spec amperage draw looks like.

Here’s a code snippet on how the current sensor is read:

#include "EmonLib.h"                   // Include Emon Library
EnergyMonitor emon1;                   // Create an instance
 
void setup()
{  
  Serial.begin(9600);

  // Current: input pin, calibration.  Calibration was 60 as recommended in the example, but that
  // gave me about half of expected values (as measured by a clamp current sensor).
  // Some pages on the web recommended 111 as the calibration constant, which gives me something
  // closer to measured value - 73 mA looks like, for the LED light I'm using.  The off-state value
  // is more like 40 mA, I assume just noise, possibly it could be eliminated.  In any event, the
  // currents I'm interested in measuring will be for serious pumps, so I expect the value will be
  // much, much more than an ambient value of 40 mA (more like 10,000mA), so I don't think it should
  // be a problem.  That said, I'll have to recalibrate when I measure the pumps.
  // Next steps:
  // 1.  Solder wire back on
  // 2.  Try this out on the actual pumps when they run, see what values I get
  // 3.  Get another CT sensor from Lee's, Solder up a couple of sensors on a real board, 
  //     write 2-sensor version of code, test in mech room again.
  // 4.  Find a nice box and properly mount the components in it.
  // 5.  Get Netorking/SD card and start sending values to the cloud.
  
  emon1.current(4, 111);             
}
 
void loop()
{
  double Irms = emon1.calcIrms(1480);  // Calculate Irms only
 
  Serial.print(Irms*230.0);         // Apparent power
  Serial.print(" ");
  Serial.println(Irms);          // Irms
}

#6

Next update:

From my friend:

I finally got my Adafruit DS3231 Precision RTC Breakout soldered up to my perma-proto board today. Works ok, but it’s a bit weird and not entirely to spec. Plus they mounted the battery on the damn thing in the most inconvenient place for replacing it, once the whole thing is in a project box. I’m wondering if, since I’m using an ethernet shield anyway, I wouldn’t have been better off just hitting an NTP server on startup and be done with it. Anyway.

Next part of the project is to prove the 110v relays I’ve got will work to sense the float open/close events. It’s pretty straightforward, the hard bit is after that, getting everything mounted properly in project and 110v junction boxes. Oh, and I guess I need to write the software, but that seems to be the easy bit.

Looking into I2C protocol stuff; I’m particularly interested in this: https://learn.sparkfun.com/tutorials/lidar-lite-v3-hookup-guide#hardware-assembly. It’s expensive at $130 or so, but it would give me a precise way of measuring the height of water in my sump, assuming that the signal isn’t completely lost in the 50 or so feet of probably-unshielded wire in the long conduit that goes back from the sump to the mechanical room. It’s questionable to me whether a 5V DC signal will even survive that distance. I suspect I’ll get serious voltage drop, even considering that it’s going over thick #14 wire capable of handling household 110V power. Worse, even if I wanted to boost the voltage on the way out to the LIDAR unit in the sump, I’d have to boost it again on the way back, since a similar voltage drop will occur on the way back.

The other thought I had for measuring height of water is, I could wire a whole other arduino to the LIDAR sensor and install it inside the sump, plug it in into the power outlet in the sump pit, and use an Ethernet-over-power adaptor to get the signal back to the mechanical room and then up to the cloud. The samples would be unsynchronized compared to the other sensors, but that shouldn’t be a big deal. I think this project is going to wait until I’m totally done with the other sensors, I can tell I could get totally buried in this.


#7

Follow up questions:

I have a couple of questions about relays before I go messing with my sump pump control box. I’m hoping you can answer them, or send them on to someone who can.

I’ve included a simple diagram of what I’m proposing to do. A few notes:

  • Apologies for not having good drawing tools for this.
  • The power source shown is meant to symbolize the AC, 110V, 2A household power circuit that is used to operate the floats connected to my sump pump panel
  • S1 is my float switch. As currently set up, it runs some existing circuitry in the sump control panel via some relays built into the control panel
  • RY1 is the relay that I want to add in, that will connect (and disconnect) a digital pin on the Arduino indiating the position of the sump float.
  • Positive input of RY1 is wired to the side of S1 that is only powered when the switch is closed. When the switch closes, the relay closes, so the output terminals of the relay complete the circuit between the digital input pin on the Arduino and arduino ground, which my arduino sketch detects when it samples.
  • Negative input of RY1 is wired to household ground
  • Essentially, the relay is wired in parallel to the existing control panel circuitry, so that it can (hopefully) never affect what’s going on in the panel.

Three questions:

  1. Guy at the electronics store said I should wire the negative input of the relay to ground. I was thinking, it’s a 110VAC household circuit - shouldn’t that be wired to the common terminal for the control panel rather than ground? At some level it makes no difference I guess, but it just seems weird to be wiring any component in a 110VAC circuit to ground.
  2. I’ve read online that one should run a diode across the input terminals of a relay to prevent power from running backwards when the relay clicks off, potentially toasting sensitive circuitry. Is this something I need to do in a 110VAC circuit? It bothers me slightly that the relay is on the same conductor as the sump-pump control panel components.
  3. Am I right in thinking that the resistance of a relay coil is designed to be high enough that it doesn’t draw a ton of power and particularly shouldn’t appreciably affect the power that the sump pump control panel could be drawing in paralell to the relay coil? I am 99% certain that the control panel only uses this circuit to close some relays of it’s own, but I’m worried about affecting the performance of the sump pump control panel.

PastedGraphic-2

Thanks!


#8

Google how to detect the presence of AC with an Arduino. I’m not going to get too deep into it, but an optocoupler and some other circuitry is the way to go, a relay (particularly as drawn) will cause a lot of issues.


#9

So you’d suggest something like this as a plug and play module?

http://learn.edwinrobotics.com/230v110v-ac-mains-detection-using-arduino-raspberry-pi-and-esp8266-thing/


#10

That’s not what I suggested, but honestly that’s not bad :slight_smile:


#11

A dead simple way of detecting AC is to just plug in a 5v dc adapter (USB charger or something) and check for 5v on that. Not the most efficient (vampire draw), but it certainly works.

The one you linked shows the full circuit if you want to do it that way, which also works very well, but you have to build it. (or order it)