What?

This is a box that controls three water pumps. Two of them are well pumps and the other is a pressure pump.

Why?

When I moved here the water system consisted of two wells, a storage tank, and a pressure tank. The wells were tuned on and off by pressure switches, and they just pumped directly into the pressure tank. The storage tank could only be used by changing some valves around to pump water into it, and then that water could be gravity fed to some faucets that were separate from the house plumbing (at rather low pressure), or it could be drained into a well when the water table is low so that the well pump can be used to pump it back up under pressure to feed the house. Besides being cumbersome manually operating that system, it's inefficient - after using all that energy to pump water out of the well into the storage tank, it then let the water all the way down into the well only to be pumped up again. And it runs the well pump more than necessary - it's a lot easier to replace a worn out pump mounted on the ground than a pump at the bottom of a well.

I redid the plumbing, adding a separate pressure pump on the surface. Now, the wells always pump into the storage tank, and the pressure pump takes water out of the sotrage tank and pumps it into the pressure tank. But the pressure pump is an additional high current load, and prior to adding that I've drawn too much current and tripped the main breakers on the house. At the same time as redoing the plumbing, I decided to put in a controller that would only run one of the three pumps at a time. In this way I would be reducing the peak current requirement, since before two pumps could run simultaneously (and could potentially be starting simultaneously, but since they were on separate pressure switches that was unlikely).

How?

Here's what I ended up with. The controller is based on a Microchip PIC16C74. It has a 2x20 character LCD module from Optrex and a couple of buttons for configuration. It also has a piezo speaker that beeps if there's any type of alarm. It has a serial port through which it continuously sends out status information to whatever is plugged into it. There's a small EEPROM to store configuration and alarm state during power outages. It's powered by a small off-the-shelf switcher. It uses +5, +12, and -12. The +-12 are because I happened to have some relays with 24V coils, and +5 +-12 power supplies are more common than +5 +24 ones. I didn't feel like building the power supply, or any part of it.

I put four level switches in the storage tank. The top one isn't actually used (it's output is displayed, but is otherwise ignored). It tells me that the tank has more water in it than I'll put in there from the wells. I get some water from a spring part of the time, so this is a normal condition. There's an overflow on the tank to dump the excess water. If that was not the case, that sensor could trigger an alarm. As it is, it could potentially be used to help decide when to run some type of irrigation system, when to change the water in a hot tub, when to pour water into the wells to try to recharge the ground water, or something along those lines. The next two switches are used to decide to start adding water to the tank, and when to stop. The bottom switch is just a little above the pipe that draws water out of the tank - it is used to prevent the pressure pump from being run dry.

There are three relays to control the pumps. There's a current transformer on each going back to the controller, directly into the ADC inputs on the PIC (RMS calculations are done in software), to monitor how much current the pumps are drawing. Too little current would indicate that the pump is dry, or turned off if the current is really small. Too much current indicates that it's stalled. Too little or too much current for the pressure pump are both alarm conditions. These are alarm conditions for the well pumps as well, unless the current is really small. That is a normal condition, as they have their own boxes that won't let them run when the wells don't have enough water in them. The alarms cause the controller to not attempt to run the associated pump again until the error has been reset.

Finally, there's a pressure sensor (on the pressurized side of the system of course). This just puts out 1-5V corresponding to pressure from 0-100psi, and goes straight into an ADC input on the PIC. It's used to decide when to turn the pressure pump on and off. If the pressure goes over a fixed threshold this is also an alarm that causes all of the pumps to shut off until manually reset. If this happens it probably means that the valves are not in the right state for the mode the controller is in; there are also mechanical pressure relief valves at the outputs of the pumps where they can not be cut off by a valve, to make sure the whole thing won't explode.

Miscellaneous Details

The firmware gives the pressure pump priority over the well pumps, unless the storage tank level drops below the bottom level switch. When the well pumps are running, it simply flips back and forth between the two wells about every fifteen minutes. It starts with whichever well pump was not being used the last time it stopped filling the tank. Whenever it turns a pump off, it has a short delay before it will turn another pump on, to give the relay contacts plenty of time to open (pumps take a lot of starting current; I don't want that occuring while another pump is still running).

It also uses the absense of current to the selected well pump as a cue to switch to the other well, since that means the selected one isn't running (which means it's dry, manually turned off, or broken). It starts with a minimum time between switches of five seconds. Each time it switches pumps at the minimum time, it increases the minimum by fifteen seconds, until it reaches the normal switching time of fifteen minutes. Each time it switches at more than the current minimum, it subtracts fifteen seconds from the minimum until it's back down to five seconds. This is to keep it from wearing out the relays or anything in the well pump boxes when neither well pump is producing water.

The trip points for alarms from the current sensors are all hard coded in the firmware, so I'd probably have to change those if I ever switched to a different size pump. The pressure set points are soft configurable. I did the plumbing so that I can change to having the wells pump directly into the pressure tank, rather than the storage tank, by changing some valves. This way the storage tank could be taken out of service for maintenance without cutting off my water. The controller can be switched to a mode where it uses pressure rather than level switches to control the well pumps, and leaves the pressure pump off, to support this configuration.

There's a driver on the board intended to control an LED type backlight on the LCD. The firmware never turns this on because the LCD panel I ended up with doesn't have one. If it did, I would have turned it on whenever one of the two user control buttons was pressed, and off maybe 30 seconds after the last button push.

Ultimate Details

Finally, here's a schematic. I don't have a version of the firmware on this site that matches the rest of this description due to a drive failure; I haven't had a chance to retrieve a copy from backup. So until I do, here's an old version of the code. It works but does not pay attention to the pump currents, it does not allow you to set the pressure setpoints (they are hardcoded at 30 and 50psi), and it does not have the no storage tank mode. Oh, and I don't think this version has the overpressure alarm either. Disclaimer: If you decide to use any of the information presented here, it's your responsibility to insure that you do so safely and in accordance with any applicable codes. If you want additional information, modifications, etc., here's what to do.

allanh@kallisti.com