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.

Sign up for Raspi-Sump notifications

If you would like notifications on changes, bugs, security issues regarding Raspi-Sump feel free to 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.

Alternatively, you can follow me on Twitter and I will tweet any changes there as well.

Pin Setup HC-SR04 to RaspberryPi

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.

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.