Pump Control: Part 2

In a previous post (Proof of Concept: Automated Pump Control ) we discussed how a pair of aquarium pumps are to be used to move the water in our ebb-and-flow Aquaponics system.  This week more components arrived including our temperature sensors and a relay board.  The proof of concept for the pump control worked well so it was time to add in the relay board.  Initially, all that was done was to hook up the control side of the relay (the coil) in series with an LED to ensure that each relay was working properly.  The next step was to attach a load, a Red LED in this case, to the controlled side of the relay.  The logic is quite simple, when the DPST switch is in position 1, the first relay coil is energized (Green LED is ON) and the action of the relay is to close its NORMALLY OPEN contacts, thus lighting the Red LEDWhen the DPST switch is moved to position 2, the first relay is de-energized (both its Green and Red LED’s are turned OFF), and the second relay is turned ON, demonstrated by the second Green and Red LED’s being ON as well.

It stands to reason that we cannot have a person standing by the Aquarium at all times, waiting for a pump to fail (when it may work fine the entire time.)  The next part of our control system design involves removing our simple “spoof” switch and replacing it with some form of sensor that detects when a given pump is operating.  As I said, ultimately there will be an in-line flow sensor attached to each pump that will provide a signal that correlates to how much water is moving through it.  All we will have to do is determine a minimum threshold and enter that into the program.  If the flow sensor signal falls BELOW the minimum threshold, the Arduino controller will assume that  the pump has failed and will place the second pump in operation, looking for a proper signal from its flow sensor.  It is important to note that we could do this with  a flow switch instead of a dynamic sensor, but, in the event we decide to do something that requires input based on AMOUNT of water flow, we would need a sensor.  Might as well start there.  If we determine that a switch is more effective, we can always add it later and it will require a minimum amount of program re-writing.


Normal state of operation: Pump 1 relay enregized (Green LED) Relay 1 Load energized (Red LED)


The DPST switch is set to "spoof" the controller, making itthink that PUMP 1 has failed, and having it mode RELAY 2 ON, shown my the RED / GREEN LED on the right
Now that we have a good basis for controlling our two pumps, we need to build a control circuit that SENSES.  Because we didn’t have our flow sensors in-hand, we used a simple potentiometer; a variable resistor to act as our changing sensor value.   The Arduino is capable of reading a changing 5VDC signal and converting it to a digital signal, a number from 0 to 1023.  We talked about needing a threshold value earlier.  For this proof-of concept we chose a value of 500.  When the potentiometer is above the “500” threshold, PUMP 1 remains on, additionally, the program was written to print “PUMP 1 ON” and PUMP 2 OFF” on the computer screen.  As we turn the knob on the potentiometer, the number the Arduino sees, falls below the 500 mark.  The program was written, telling the controller to turn OFF the PUMP 1 relay to turn ON the PUMP 2 relay.  Again, in this state, “PUMP 1 FAIL” is printed on the screen along with “PUMP 2 ON”.
If you’ve read this far and have a  decent comprehension of what we are trying to do, you may be wondering, “Why does this matter at all?”  Redundancy is used throughout our daily lives in our technologically advanced society.  If you’ve ever flown on a commercial airliner or been in a building when the power goes out, you have probably experienced this type of electronic control without even knowing it.  Aircraft are required to have backup systems for every flight-critical system on board.  In some cases it is a manual system the can be used by the pilots, in other cases, a sensor causes a master controller to switch from using a faulty component to using a good one.  At times, aside from a light, bell, or annunciation on a screen, the pilot would never know the hand-over even took place.   In another example, you have probably seen those large black boxes that computers are plugged into in an office building.  These are basically batteries with intelligent control.  When the controller senses that there is a power failure in the building, it automatically switches to its internal battery, allowing the computer, etc. to keep operating, al least until someone can shut it down properly.   In our Aquaponics system, if the water stops flowing, the plants will soon die.  If the water stops flowing, the grow bed, plants, bacteria, and worms can no longer filter the dirty water and the fish will die.  For this reason, we need relatively fail-proof system to ensure that both our plants and fish stay happy and healthy.