Water detector system


#1

As discussed on the development call today. I have made a water detector system for my OpenROV.

Have installed water detector in both battery housings and one in the electronic housing. If there is any water leak, Led connected outside of one of the battery housing will flash. Number of flash depend on where the leak is. 5, 3 or 2 flash before a 2 sec delay.

Concept: A sensing wires is build into battery and electronic housing. When water enter it will create contact between GND (battery ground on battery housing and a separate GND wire on electronic housing) and sensing wire, Digital ports on Attiny 85 will change from status "HIGH" to Status "low" and the led will start to flash.

To make it simple (at least for me) I made a separate circuit for it. Used a Attiny 85 micro controller. As there is digital ports available on the controller board this circuit can be included here. And maybe displat a warning in the cockpit instead of the outside led.

Prototype circuit:


Schematic:


JP1:

1: 5V input, taken from J7 +V on the OpenROV 2.6 controller board.

2: GND, taken from J7 GND on the OpenROV 2.6 controller board.

3: GND to LED

4: 5V output to LED

5: input from water detector port battery housing

6: input from water detector starboard battery housing

7: input from water detector electronic housing.

8:Not connected

Water detector in the Battery housing: Arrow shows the sensing wire.


Sensor wire need to be on the low side of the housing to be able to detect water as soon as water enters the housing.

Sensing wire on low side of the electronic housing:


Arduino code for the Attiny 85:

const int sensorpin1 = 2; // Water #1 detector connected to pin 2
const int sensorpin2 = 3; // Water #2 detector connected to pin 3
const int sensorpin3 = 4; // Water #3 detector connected to pin 4
const int ledPin = 0; // Led connected to pin 0
int buttonState1 = 0;
int buttonState2 = 0;
int buttonState3 = 0;

void setup()
{
pinMode(ledPin, OUTPUT);
pinMode(sensorpin1, INPUT);
pinMode(sensorpin2, INPUT);
pinMode(sensorpin3, INPUT);
}
void loop()
{
buttonState1 = digitalRead(sensorpin1);
buttonState2 = digitalRead(sensorpin2);
buttonState3 = digitalRead(sensorpin3);

if (buttonState1 == LOW) // check if water detector pin i LOW. When water is detected pin will be LOW.
//10 M OHM resistor will keep pin HIGH when water is not present.
{
digitalWrite(ledPin, HIGH);
delay (500);
digitalWrite(ledPin, LOW);
delay (500);
digitalWrite(ledPin, HIGH);
delay (500);
digitalWrite(ledPin, LOW);
delay (500);
digitalWrite(ledPin, HIGH);
delay (500);
digitalWrite(ledPin, LOW);
delay (500);
digitalWrite(ledPin, HIGH);
delay (500);
digitalWrite(ledPin, LOW);
delay (500);
digitalWrite(ledPin, HIGH);
delay (500);
digitalWrite(ledPin, LOW);
delay (2000);
}

if (buttonState2 == LOW) // check if water detector pin i LOW. When water is detected pin will be LOW.
//10 M OHM resistor will keep pin HIGH when water is not present.
{
digitalWrite(ledPin, HIGH);
delay (500);
digitalWrite(ledPin, LOW);
delay (500);
digitalWrite(ledPin, HIGH);
delay (500);
digitalWrite(ledPin, LOW);
delay (500);
digitalWrite(ledPin, HIGH);
delay (500);
digitalWrite(ledPin, LOW);
delay (2000);
}

if (buttonState3 == LOW) // check if water detector pin i LOW. When water is detected pin will be LOW.
//10 M OHM resistor will keep pin HIGH when water is not present.
{
digitalWrite(ledPin, HIGH);
delay (500);
digitalWrite(ledPin, LOW);
delay (500);
digitalWrite(ledPin, HIGH);
delay (500);
digitalWrite(ledPin, LOW);
delay (2000);
}


else
{
digitalWrite(ledPin, LOW); // turn LED OFF:
}
}


#2

That's pretty cool. I like the ATTiny85 and keeping it out of the main arduino control loop.