raspi-sump logo

Fork Star Issue Watch

Donate | FAQ | Change Log | Installation Manual

Raspi-Sump is a sump pit water level monitoring system using a Raspberry Pi, an HC-SR04 Ultrasonic Sensor and written in Python. It monitors the water level in your sump pit and alerts you if the water level is getting too high, possibly indicating a sump pump problem. The source code is available on GitHub.

example raspi chart

Sign up for Raspi-Sump notifications

If you would like notifications on changes, bugs and security issues regarding Raspi-Sump, send me an email at Notifications asking to subscribe to updates.

I will always bcc you on the email so that your info is not visible to other users. I would never share your email address with anyone.....period.

Raspi-Sump FAQ

See the most frequently asked questions about the Raspi-Sump Project.

Raspi-Sump on Discord

Join the Raspi-Sump Discord group. We have a small group of people that are usually on. It's a good place to get support and discuss other ways to use the application.

If you are interested contact me for an invite link. You need to have a Discord account to join.

Tested Software Versions

Raspi-Sump is tested on the following versions of Raspberry Pi OS with Python3.
  • Raspberry Pi OS 11 (Bullseye) ***Recommended
  • Raspbian OS 10 (Buster)
  • Raspbian OS 9 (Stretch) ***Support ends June 30, 2022

    Install Raspi-Sump

    Installation Manual (pdf)

    Full Installation Instructions on Github


    - RaspberryPi (Any model)
    - Raspberry Pi OS (Bullseye) or Raspbian OS (Buster or Stretch)
    - Python 3
    - RPi.GPIO module for Raspberry Pi (automatically installed)
    - hcsr04sensor module (automatically installed)
    - Matplotlib is required if you want to graph output of the csv file.

    Current Features

    - Packaged install with PIP.
    - pre defined interval monitoring of sump pit water level.(time interval is configurable)
    - Error handling to compensate for fringe readings.
    - Readings logged to csv file.
    - Automated SMS Email Alerts if water depth exceeds a predifined level in the sump pit.
    - Chart of current sump activity (seen above).
    - Monitor the raspi-sump process and if it is stopped automatically restart it. (if running raspi-sump as a continuous process)
    - Configure variables for your sump pump and alerts in a seperate configuration file. (raspisump.conf)
    - Choose between metric or imperial measurements.
    - create charts for viewing today's waterlevel and past days waterlevels on the local webserver of your Raspberry Pi
    - Rate limit SMS Email Alerts
    - Set alerts to alert you on low water (or other liquid) levels
    - User configurable SMS Email Heartbeat Alerts to ensure alerts are working properly. (Off by default)
    - On demand email testing using the emailtest command

    Sump Pit Setup

    - 4 wires connected from HC-SR04 sensor to the RaspberryPi
    - Sensor mounted on sliding wood platform

    Pin Setup HC-SR04 to RaspberryPi

    - VCC to 5V
    - Ground to ground
    - Trig to GPIO 17
    - Echo to GPIO 27 (with voltage divider)

    Use any available GPIO pins for Trig and Echo. 17 and 27 shown as an example only. Simply identify your pins in raspisump.conf.

    raspberry pi diagram

    Voltage Divider

    It is essential to add a voltage divider on the wire connecting the Echo pin on the sensor, to the the GPIO pin on the pi. The sensor sends a 5V current through the wire and the GPIO pin is only rated for 3.3V. Not using a voltage divider can damage your Raspberry Pi. I used a 470 Ohm and a 1K Ohm resistor with the 1K connecting Echo and Ground. Voltage is actually a touch higher at 3.4V but I believe it to be within a tolerable level.

    The following image illustrates very well how the voltage divider works.

    voltage divider wiring

    The 470 Ohm resister is on top and the 1K resistor is on the bot tom. The wires to the right go to the Pi and the ones to the left go to the sensor. The orange wire is the Echo wire and you can see it is connected right at the center of the two connected resistors. The yellow wire goes to Ground on the Pi. There are plenty of diagrams that you can find explaining voltage dividers but this picture provided by github user @rhiller was very helpful in seeing it in practice. Thanks to @rhiller for taking the time to answer many questions. He also has a sump pump monitoring project called pi-distance on Github that you can check out.

    Sensor Installation

    HC-SR04 sensor mounted to plastic bracket on wood strapping. HC-SR04 User Manual
    A JSN-SR04T sensor can also be used. JSN-SR04T User Manual

    Here is a view of a JSN-SR04T sensor that GitHub user rfeng74 contributed. Raspi-Sump will also use this waterproof sensor if your conditions are a little more damp.

    View of the Open Sump Pit

    Finished View with Raspberry Pi on the Wall

    Raspi-Sump reporting time and level (cm) in real time every 60 seconds

    Raspi-Sump SMS Email Alert

    2014 Linux Journal Article

    In the early days of Raspi-Sump I wrote an article for Linux Journal which is still posted. There have been many changes to the program since then but it does give some background on the methodology and reason for it.

    Raspi-Sump in the October 2014 Embedded Issue of LinuxJournal

    Solved Issues

    Get the source on GitHub.

    Alternatively, download the archive. Raspisump Tarball Downloads

    Copyright © 2023 Al Audet

    MIT License