Solid State Optical Sump Pump Controller

6.6K7113

Intro: Solid State Optical Sump Pump Controller

Recently I found out my dad had an inconvenient situation with the sump pump in his basement. The sump pump sits at the bottom of a four foot deep well and is activated by a small float that moves up and down. The float is connected to a mechanical switch on the pump housing.

During the wet season, the pump turns on and off about once a minute and the switch contact lasts only about a year before succumbing to mechanical failure. When it does, my dad has to undo the outlet hose, hoist the pump out of the well and replace it with a spare pump he keeps around for the task. Then, he replaces the switch contactor on the broken pump so he can have it ready for next year. This costs about $40 a year, not to mention the labor involved in swapping out the pumps and replacing the contactor each time.

To solve the problem, I set out to design a solid state optical sump pump controller that has no moving parts to wear down. My idea was to bypass the mechanical float on the pump itself and to instead make a new float that would mount to the side of the well. This would consist of a plastic bottle and a dowel rod. The dowel rod would move up and down and trigger two optical sensors mounted on the side of the well. I would then build a circuit to turn the pump on and off using a solid state relay. Because this would be contactless and have no electromechanical parts, it would never fail due to wear.

STEP 1: Making the Optical Water Level Sensor

The water level sensor consists of a shaft with a central hole slightly larger than the dowel rod. When mounted to the side of the well using the attachment bracket, it allows the float and dowel rod to slide freely up and down along with the water level in the well.

At two points along this shaft are positioned photointerrupters. These devices consist of a infrared light source and a light detector. When the dowel rod slides into the groove in the photointerrupter, it interrupts the light beam, turning off the current through the light detector. The photointerrupter sit well above the water level and are not intended to get wet.

I chose to make the water level sensor shaft out of 3D printed segments so that I could easily adjust the length by adding segments as needed. Each segment has a central cutout for inserting a photointerrupter, but only two of the segments will have one.

I also made a bracket for attaching the sensor to the side of the well.

Autodesk Fusion 360 Design

STEP 2: Wiring and Operation of the Water Level Sensor

Along the sensor bar, there will be photointerrupters that will be blocked by the dowel rod when the water reaches the low and high point. One side of each photointerrupter contains an LED light source. Both of these will be wired from 5V, in series with a current limiting resistor (shown in the schematic), down through a common ground.

The side of the photointerrupter with a dot contains a light sensitive transistor. The signal lines go to the leads nearest the dot, while the opposite leads are wired to a common ground.

The control logic will pull the two signal lines up to 5V while the phototransistor is in shadow, but if light falls on the transistor, it will conduct and bring the signal line to 0V; therefore, when the dowel rod is present, the signal line will read 5V, while when it is absent, it will read 0V.

I used an ITR9608-F photointerrupter because it has a 5mm gap, which is just wide enough to let my dowel rod through.

STEP 3: Making a Float With an Adjustable Rod

For the float, I used a small plastic bottle and the dowel rod. I wanted the length of the rod to be adjustable, so I drilled a hole on the bottle cap to allow me to insert the rod partially into the bottle.

I then designed a twist-lock mechanism that allows me to secure the dowel rod at any desired height. The mechanism consists of a threaded cap and a hexagonal nut with small teeth that bite down into the dowel rod to secure it in place.

The ability to adjust the rod in this manner gave me a few inches of up and down adjustment, which makes adjusting the float easier.

Autodesk Fusion 360 Design

STEP 4: Option 1: TTL Control Circuit

I chose to use a 7400-series TTL integrated circuit as the heart for my controller. While less used today, 7400-series integrated circuits were popular in the 80s and each chip contain one or more digital logic building blocks that can be wired together to form a digital circuit.

For my circuit, I used a 7400 chip, which contains four NAND gates. One of the NAND gate is used to combine the LO_WATER and HI_WATER signals, two of these NAND gates are wired together to make a NAND-gate latch, while the remaining is wired as an inverting-buffer.

My circuit also contains an indicator light (LED1), two current limiting resistors (R1 for the photointerrupter LEDs , R4 for the indicator LED) and two pull-up resistors (R2 and R3) for the HI_WATER and LO_WATER signals.

One the right side of the schematics is the solid state relay (T1) and the sump pump motor (M1). The solid state relay requires about 10mA of current on the control line. The TTL chip can only source about 400 µA, but it can sink up to 16mA. So I have connected the positive control terminal of the relay to 5V and I am using an inverted buffer to pull the negative terminal down to 0V, allowing the chip to sink rather than source current.

I assembled my circuit on a protoboard using hookup wire. As you can see, soldering up the circuit required quite a bit of work!

STEP 5: Option 2: Using an Arduino As the Control Circuit

Unlike TTL integrated circuits, which must be wired up to make a specific logic function, an Arduino is a general purpose computer whose behavior can be programmed by software. While the TTL 7400 integrated circuit has a grand total of four logic gates, the Atmel microcontroller at the heart of the Arduino contains millions of logic gates!

Using an Arduino to implement this sump pump controller is like asking a chess grandmaster to play Tic-Tac-Toe, but the Arduino makes the circuit far simpler, with fewer components and interconnections. Although I did not use an Arduino for my setup, I verified that it worked as expected on a breadboard (pictured).

Aside from the Arudino, the only parts needed are a 100Ω current limiting resistor (R1), the two photointerrupters (O1 and O2) and the solid state relay (T1). The pull up resistors on the LO_WATER and HI_WATER lines are provided internally by the Arduino's digital input and a single digital output provides enough current to control the solid state relay.

The following Arduino sketch will turn the sump pump on when the water in the well is above the low and high water level and turn it off when the water in the well is below the low water level:

#define LO_WATER 10
#define HI_WATER 11
#define PUMP_SSR 12
void setup() {
  pinMode(LO_WATER, INPUT_PULLUP);
  pinMode(HI_WATER, INPUT_PULLUP);
  pinMode(PUMP_SSR, OUTPUT);
  pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
  if(!digitalRead(LO_WATER)) {
    // Turn off the sump pump when water is below the low water level
    digitalWrite(LED_BUILTIN, LOW);
    digitalWrite(PUMP_SSR, LOW);  
  }
  if(digitalRead(LO_WATER) && digitalRead(HI_WATER)) {
    // Turn on the sump pump when water is above the low and high water level
    digitalWrite(LED_BUILTIN, HIGH);
    digitalWrite(PUMP_SSR, HIGH);  
  }
  delay(1000); // wait for a second
}

STEP 6: Obtaining and Wiring Up the Solid State Relay

This step requires you to work with AC line voltage. If you are not qualified for this work, I recommend leaving this part up to a licensed electrician.

For controlling the sump pump, I bought a Schneider Electric SSM1A112BD Solid State Relay from Grainger. This relay takes in a control signal of 4V to 32V DC, which allows it to be driven by the 5V signals from either my TTL-based controller or an Arduino.

This solid state relay can switch up to 12 amps at 280V AC, which is sufficient for the sump pump my dad was using. I wired the relay in series to a power cord and an outlet box so my dad could plug in the sump pump into the relay.

The controller circuit provides a 5V control voltage for the relay so it can switch the pump on and off.

The relay can be mounted to the wall using a DIN rail, or using a small 3D printed bracket.

12 Comments

I had a situation a few years ago when the main drain for the house blocked up, and raw sewage would come up right in the basement drain. Had to use a pump to evacuate out to the street until it could be resolved, which took weeks. Mechanical float controls would get jammed up by toilet paper and corresponding debris, so I had to do something similar, except using a simple conductivity sensor with two wire sensor. One wire sets up the low level pump turn on point, and the second higher positioned wire determines the cutoff. This allows the necessary hysteresis for turn on and turn off, otherwise the pump would just kick back on when the outlet pipe drained back down.
All that's needed is the Arduino and a solid state relay that can drive the pump.
I had to keep the pump in a wire cage to separate it from the toilet paper, which clogged up the pump inlet.
The Arduino can sense ground switched water contact easily and reliably with the water acting as the ground.
Ewww! That sounds like a nasty thing you had to deal with! I made an earlier Instructable where I used an ESP32's capacitive sensing mode to sense water directly, as you described. I didn't know an Arduino was sensitive enough to do this, I may have to give that a shot.
It was the grossest thing imaginable to be sure!
The electronic sensor with the Arduino worked perfectly, as the input impedance of the Arduino is high. You can add filtering with repeated readings to get rid of glitches.
It just needs two inputs to determine when to switch the pump on or off, with the logic state of the high sensor and low sensor .
When both inputs are low, it indicates the water is contacting both high and sensors, so it should switch on the pump. It'd remain on until both inputs go high, indicating the sump is cleared. It remains off even after recontacting the lower sensor, until someone flushes again, and fills it up to the high sensor again 🤢
I just used galvanized guy wire for the water probes, inserted in plastic straws to isolate them from touching the sides of the muck pit. Pull the wires up and down as necessary to adjust for the desired turn on and off levels-
This tutor is for advanced ones!
I've learned some new things. Thank you.
You're welcome! Glad you enjoyed it!
Great job on this! I know a lady who has a sump pump in a small pit in her basement so I can relate to the need for this. You get bonus points for actually coming up with a better way to solve a problem. Many projects on this site are just decorations and serve no real purpose... this is not one of them.
Thank you for your kind words!
Nice work. Out of interest what type of filament did you use for the printed parts?
Just generic PLA. The printer was an SynDaver Axi.
Good work! I don't have your sort of skills so in that situation I added a second float switch on a longer leash so that the sump fills up a lot deeper and then empties to the bottom and therefore it cycles less. Over time I also realised that the pump was only on 10% of the time even in the wettest winter so I swapped over to a pump a quarter of the size. The second pump was so quiet that I wished I had done it ages ago.