Maker.io main logo

Sump Pump Fault Monitor and Alerting

2021-03-27 | By Andy

License: General Public License Raspberry Pi

Overview

The project uses a low-cost USB energy sensor along with a Raspberry Pi to detect and monitor abnormal operation of a sump pump.  The intent is to provide an indication of when preventative maintenance is needed before your basement floods. A water alarm can detect high water levels after the fact but monitoring the sump pump motor itself can detect changes in motor operation, one-way valves, and blocked or broken discharge pipes. Installation of the power monitor is very simple and straight forward.

I found that under normal operation the motor power consumption is very constant. Likewise the pump motor runtime was very constant being the time it takes for the water level in the basin to be pumped out. Frequency of sump operation was highly variable being governed by water flowing into the basin, but actual sump operation time was always very consistent.

Conditions that could cause an abnormal power indications that sumpMaster would detect include:

  • Frozen discharge/drain pipe (detection of abnormal power)
  • Motor / impeller damage (detection of abnormal power)
  • Motor starter capacitor (detection of abnormal run time)
  • Water level switch stuck on (detection of abnormal run time)
  • Check valve malfunction (detection of abnormal run time)

There are two algorithms to generate alerts. One is statistical based and self learns. The other algorithm option is based on entering the horsepower size of the pump motor. Alerts can be sent to your email or as an SMS to your phone. SumpMaster tracks energy used from the sump pump and reports:

Period stats:

  •  number of cycles
  •  min run time
  •  max run time
  •  total run time
  •  power

Per on cycle:

  • run time
  • standard deviation of runtime
  • average power
  • standard deviation power

Data Logging (time series of records) can be to any of the following :

  • Comma Separated Variable (CSV)
  • MQTT (publish / subscribe message queue)
  • influxDB
  • SQL (multiple variations to be added)
  • Future options: IFTT, PubNub, Twilio, Cellular, APRS 

 Required hardware

  • PZEM-016 / 017
  • RPi Zero, RPi3 or RPi4

Hardware setup

The PZEM-016 includes instructions. Basically the split core current transformer (CT) is clipped around the neutral wire. The PZEM module draws power from the line and will either need to be wired to an 110, 115, 120, or 240 VAC (80 – 260 VAC range) to measure the line voltage. The PZEM communicates over a single low-voltage twisted pair to a USB-dongle using RS-485 so it can run up to 300 meters or roughly 1,000 feet. The USB dongle is plugged into a USB port on the RPi4 or RPi3, or via a USB cable on the RPI zero. If you are at all unsure of this consult an electrician for local electrical and building codes.

 Required software

Step 1: Setup the Raspberry Pi Operating System.

There are multiple excellent tutorials on installing the RPi operating system on an SD-card that you may want to consult that go into the specific steps. Here is the link to the  Raspberry Pi Operating System images: https://www.raspberrypi.org/software/operating-systems/

Before continuing make sure your operating system has been updated with the latest updates. 

Copy Code
    sudo apt-get update
sudo apt-get full-upgrade
sudo reboot now

Step 2: Download sumpMaster software

To get a copy of the source files type in the following git command assuming you have already installed git:

Copy Code
git clone https://github.com/BrucesHobbies/sumpMaster
sudo pip3 install pymodbus
sudo pip3 install matplotlib

Step 3: Configure sumpMaster software (optional)

To add additional PZEM modules, add a name to the channames list in sumpMaster.py.

Copy Code
chanNames = ["SumpPump"]
# chanNames = ["SumpPump", "Pump2", “Pump3”, “Pump4”] # Example with 4 pumps
chanPorts = ["/dev/ttyUSB0", "/dev/ttyUSB1","/dev/ttyUSB2", "/dev/ttyUSB3"] # One entry per chanName[]
chanAddrs = [0x01, 0x01, 0x01, 0x01] # One entry per chanName[]
chanOnThresholds = [5, 5, 5, 5] # Watts, with one entry per chanName[]

The source code is 100% Python.  To disable or enable status messages and alerts modify these lines:

Copy Code
statusMsgEnabled = 1                              # non zero enables sending of email / SMS text messages
statusMsgHHMM = [12, 0] # Status message time to send [hh, mm]

alertMsgEnabled = 0 # non zero enables sending of email / SMS text messages
runTimeAlert = [30*60] * len(chanNames) # Run time to trigger email / SMS text - seconds
minIntervalBtwEmails = [2*3600] * len(chanNames) # Wait this long before sending another email - seconds

 Final step: Run the program

Copy Code
python3 sumpMaster.py
 

On first time startup the sumpMaster will ask if you want to enter an email address or phone number for alerts and status messages. You can skip this step and come back to this step by deleting the emailCfg.json file.

 To update the sump pump monitoring algorithm, see the comments in algsump.py.

 

TechForum

Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.

Visit TechForum