Introduction: Water Sensor Power Shutoff
So this is a problem I have been trying to solve for a while now ,since we moved in we had problems with our washing machine drain overflowing. Its been snaked etc but with little kids in the house who knows whats going down the drains ! I looked everywhere for a device that would shut off power and stop the washing machine from draining into the drain but found nothing. There were devices that would shut off burst water pipes but nothing like this . So what we did was finally use all these arduinos I have sitting around . The parts list is pretty slim and you will spend the most on the PowerSwitch Tail II.
The case is a work in progress and can be made to fit your environment I am planning on using an Altoids tin and cutouts for the wires and switch to sit. The sensor will be attached to the PVC Drain at the top to catch any spillover.
Items Needed:
Arduino Uno
PowerSwitchTail II
Momentary push button switch (Radio Shack)
Moisture Sensor ( Used wRobot) http://www.amazon.com/gp/product/B00AFCNR3U/ref=oh...
Various wires
Step 1: Make the PowerSwitch Connections
Pin 1 on the PSTII goes to Pin 13
Pin 2 on the PSTII goes to GND
if i messed this up let me know !
Step 2: Moisture Sensor Connections
Out goes to A0
UCC goes to 5v
GND goes to Ground
Step 3: Reset Button Connections
Soldered two wires(poorly i might add ) to the pushbutton and wired one to GND and the other to the reset. This will enable me to reset the PSTII back to on without having to unplug arduino . Details in the code.
Step 4: Arudino Code
This code is pretty simple. 13 is the PSTII setup goes in and sets variables and sets the PSTII to on. The loop goes through and waits to read The Moisture Sensor . I have it flip off it reaches anything above zero. It then sets the PSTII to OFF. Reset button will turn the PSTII back on.
void setup() {
// initialize the digital pin as an output.
Serial.begin(9600);
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
Serial.println("Switch ON");
Serial.println("Setup has ended, entering loop()");
}
void loop()
{ Serial.print("Moisture Sensor Value:");
Serial.println(analogRead(0));
delay(2000);
if(analogRead(0) > 0)
{ digitalWrite(13, LOW); // turn the Powertail off
Serial.println("Switch OFF");
} }