Posts: 1
Joined: Mon Apr 29, 2019 9:14 pm

Sump pump alarm

Mon Apr 29, 2019 9:29 pm

Hey everyone, Im going to start off by saying that I am completely new to this honestly I have never programmed before. I have a project in mind that I would like to do but I need some assistance. I would like to make a monitoring and alarm system for the sump pump in my house. Here is what I would like it to do. 1. Send a text message and or an email to me when the water becomes to high. and 2. set off an audible alarm in the basement (which is a 24v general alarm horn strobe) also when the water becomes to high. Any advice on how to go about doing this would be greatly appreciated!

Posts: 26
Joined: Sat Apr 13, 2019 12:32 pm

Re: Sump pump alarm

Tue Apr 30, 2019 8:38 am


If you want to water measure water level you can use an ultrasonic sensor
and for the alarm a motor driver. Motor driver is used for controlling heavy load items other than leds
And you can use ssmtp to send email

How to use Ultrasonic ... mputing/14
How to use SSMTP ... end-emails
How to use Motor Driver ... spberry-pi

You can use python to code this, python is easier to learn

Posts: 9749
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Sump pump alarm

Tue Apr 30, 2019 10:35 am


For water level detection you could use a simple float switch if all you need is to detect when the water level has reached a set level, simple and reliable.

example ... SweWVXe8GI

This can be connected to the pi gpio the same as any other switch, I suggest you look a the physical computing pages on the raspberry pi web site ... -computing

You can also send email directly from python using smtplib and a gmail account. ( I would suggest you set up a new account just for the pi to use as you will need to enable less secure apps on the account ) ... ng-python/

example of code to send simple alert mail.

Code: Select all

import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email import encoders

email_user = ""
email_password = "password"
email_send = ""

subject = "Temperature alert"

msg = MIMEMultipart()
msg["From"] = email_user
msg["To"] = email_send
msg["Subject"] = subject

body = "Warning high temp"

text = msg.as_string()
server = smtplib.SMTP("",587)


As for the siren/strobe you could use a simple relay driven from the pi gpio using a transistor which would switch the 24v to your siren/strobe.

We want information… information… information no help
The use of crystal balls & mind reading are not supported


Re: Sump pump alarm

Tue Apr 30, 2019 10:48 am

You may want to keep a simple alarm as well as the all singing and dancing computerised one - rather embarrassing to explain to the insurance company that a program bug led to the claim as the alarm failed :lol:

The advantage of the ultrasonic one is that you could send a regular mail / message saying the level of the water compared to the simple low / high from the float and that would tell you the system is still working.

Obviously you could do both as a double check.

Yes I hate flooding :lol:

User avatar
Posts: 91
Joined: Tue Jan 08, 2019 7:44 pm

Re: Sump pump alarm

Thu May 02, 2019 3:51 pm

I have been thinking about a project along the same lines. A couple of things I have thought about you may also want to consider.

One reason a sump will fill too high is because of a power outage and no way to run the sump pump. This would mean without extra battery power for various components (Pi itself, your router, etc.) sending an email will be impossible. I have Verizon FIOS which has a battery back up. So in my case I was thinking a small UPS to power the router and then a battery pack for the Pi. With those three still running I could have the Pi not only still be able to send an email due to high water from a power outage, but even better the Pi could be set up to detect the power outage directly and send an email before the water gets too high. For example when no one is home and I am at work, I would know the power cut out and could run home to get out the portable generator.

At to water height measurements, there are a lot of ways to go about it. Float switches, ultrasonic sensors, capacitive sensors, or even home made detectors (foil wrapped ping pong balls in a tube the float up and touch two contacts shorting them for example). Since sumps are wet environments, anything going into it should be very tolerant of being wet. So for example, if you use float switches, a lot of them are designed to be inserted into the sides of containers where the wire side is on the outside and do not get wet. If you want to use those in a sump, typically you have to put the whole switch down into the well to mount it which means the wire side will be in a wet environment. So be sure the float switch is fully water proof including the wire insulation itself. Some wires may have a insulation that is prone to absorbing moisture (nylon for example) or you will have to add additional water proofing yourself (water proof heat shrink tubing and maybe a glob of RTV (silicone) to the back of the switch).

What ever you choose, go redundant with at least two in case your main "high" sensor fails you will want a second one (maybe a bit higher in the sump) as a backup. On a related note, besides the sump not working and flooding your basement, I have had standard sump pump's float switches get stuck ON so when the sump drains, the pump just keeps running. While usually not an issue since the water coming into the sump keeps the pump wet so it doesn't kill itself, hours of a 1/3 or 1/2 HP motor running continuously will run up your electric bill. So consider either another switch to detect low water or maybe a way to monitor the pump's current directly so it can detect failure to turn off.

Return to “Automation, sensing and robotics”