Solved Issues

Problem: Bad readings when water level is low.

Main issue is that the HC-SR04 sonar field is a little wide. Since I have a backup pump the pit is a little crowded. If I move it too far right, it picks up the sump ball and gives strange readings.
If I move it too far to the left it picks up a 2x4 on the pit wall when the water is below the 2x4.

What ends up happening is illustrated by the circle on the following graph. The line should be going on a downward trajectory but instead the sensor is bouncing off other items in the sump pit until it starts passing the 52 cm level. The vertical line represents when my pump emptied the pit. As you can see my pump emptied the pit 8 times on June 19th. That's alot of water.

sump pit graphic

I think I can address the issue in a couple of ways. First I can move the sonar closer to the water to limit the field. Also forcing the sensor to go through PVC tubing may focus the beam.
Ultimately it is giving me accurate readings when the water goes above the 2x4, which is really what I want to be monitoring. I will post the results of my attempts to fix this when I have some time.

Solved: Add a piece of plywood to the far sump pit wall and move sensor closer away from pump.