raspi-sump logo

Fork Star Issue Watch

View Today's Water Level

Donate | FAQ

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.

End of Life Support - Raspbian Wheezy/Jessie and Python 2

Support for Python 2 ended on January 1, 2020. I will no longer be testing Raspi-Sump against version 2 of Python. If you are still using Python 2 please upgrade to version 3. To upgrade Raspi-Sump to use Python 3 do the following;
sudo pip uninstall raspisump
sudo pip3 install --no-binary :all: raspisump
sudo apt install python3-matplotlib
Your configuration file will be preserved during the upgrade and you will not lose any of your old csv readings. However it is always a good idea to backup your /home/pi/raspi-sump directory just in case.

  • Support for Raspbian Wheezy ended on January 1, 2020. There are no repository packages for Matplolib on Python 3 in Wheezy and using pip to install it on that platform involves too much black magic.
  • Support for Raspbian Jessie will end on June 30th, 2020.
  • Support for Raspbian Stretch will be provided until June 2022.

    All future versions of Raspi-Sump will only be tested on Stretch and the latest version which is Buster.

    Install Raspi-Sump

    Full Installation Instructions on Github

    Requirements

    - RaspberryPi (Any model)
    - Python 3
    - RPi.GPIO module for Raspberry Pi (automatically installed)
    - hcsr04sensor module (automatically installed)
    - Matplotlib and Numpy 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)

    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 © 2021 Al Audet

    MIT License