Pump Shaft Monitor: Introduction
We live on the side of a hill where rainwater runs down into our garden, gathering at the lowest point to make a “sumpy” patch. The soil has a high clay content, so the runoff is efficient. We also have a cellar. (You can see where this is going already, right?) We have a shaft next to the house that contains a pump to clear out water draining into the sumpy area. A couple of months ago I took the lid off the shaft and found the pump under two metres of water, not running. Opening up the stairs down to the cellar revealed half a metre of water down there... Not good.
The pump we use is a cheap submersible pump, the kind you’d use for emptying a swimming pool or something similar. We only rent the house, so I’m not keen on installing a “proper” shaft pump (for ten times the price), but we need something to make the pump more reliable. The main problem with these cheap pumps is the float switch that switches them on and off. The current pump is the second one we’ve had. I replaced the original one after finding it running dry at the bottom of the shaft, with the float switch stuck on. The new one fails sometimes in the opposite direction, with the float switch not switching on!
I’ve messed around with the float switch cable and have it in what seems like a reliable configuration now, but I’m still a little paranoid about it. The problem is compounded by the pump shaft having the world’s heaviest manhole cover on it. For two people with the right tools, it’s not a big deal, but levering it up with a pickaxe on your own is a bit of a job.
This led me to thinking that it might be a fun project to make some kind of system to monitor the water depth and pump status in this shaft. A little bit of electronics, a little bit of embedded software, some server-side software, to end up with a “Thing on the Internet”. “ToI” is right, isn’t it? It’s what all the cool kids are doing!
The main requirements for this thing are something like:
Measure water depth in the shaft: the easiest way to do this is probably with a simple ultrasonic sensor (I’m going to try using this one from DFRobot).
Render the water depth measurements somewhere: just measuring the water depth isn’t so useful if I can’t see the measurements anywhere! That means some sort of connectivity to somewhere, some sort of data storage, some sort of dashboard to view the data, and so on.
Monitor pump status: I want to be able to see if the pump is running without pulling the cover off the shaft. That information should be displayed in the same place as the water depth measurements.
Control the pump: I want to run things in two different modes, one where the pump switches on and off using the float switch, so I can collect some data about water depths, on/off times, and so on, and another mode where the float switch is permanently “on” and power to the pump is controlled by the software on the pump monitor.
The idea here is to get a clear view of the behaviour of the pump and the water depth in the shaft, to have some mechanism of alerting me if the water depth is rising too much without the pump running, and eventually to do away with the unreliable float switch and to control the pump based on the water depth measurements.
Seems reasonably clear.
I came up with a rough system design that looked like this:
The water depth is measured using an ultrasonic sensor (I don’t know yet how well this will work in the shaft, but it seems to be a thing that other people have done, so it has a good chance of working). The pump status is determined by sensing the current in the power cable going to the pump (not completely trivial to do, as we’ll see), and there’s a solid-state relay (SSR) for switching the pump on and off when the float switch is pinned on.
I was originally (optimistically) planning to use an Adruino with a Wi-Fi connection to communicate from the shaft, but Wi-Fi connectivity from in the shaft just isn’t going to work. I tested an Arduino from the back of the house to our wireless router (at the front of the house) and it just about worked, but the shaft has some Faraday cage characterstics to it: rebar in the shaft walls, thick metal and concrete cover, so no hope at all.
There are a few bits to all this, so there are going to be several articles about it. I’ve got some prototype hardware built, some of which works... and some doesn’t... and I need to understand why.
The following articles will be about some of these topics:
Pump current sensing approach and simulations.
Interface PCB schematic, layout and assembly.
Interface PCB testing (SSR driver and current sensing).
Temperature/humidity sensor software.
Ultrasonic sensor software and testing.
Fixing the pump current sensing (doesn’t work properly yet!).
Integrated Raspberry Pi software.
Server-side software: either simple custom code, or something using one of the many IoT platforms out there, plus a dashboard built with something like Grafana.
Switching from the Raspberry Pi to a small MCU solution.