Pages: [1]   Go Down
Author Topic: water leak sensor  (Read 13898 times)
0 Members and 2 Guests are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 18
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm building a little submarine and I was thinking how I can make a simple water leak detector. I'm thinking about 2 striped cables close to each other and when they short cut because the water it send the arduino the information. The problem is I don't have any electronic skills to do this circuit. Can anybody point me how can I make this?
Tx
Logged

UK
Offline Offline
God Member
*****
Karma: 0
Posts: 529
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Its just the same as a Rain sensor smiley

you seem to have it worked out, but here is an example using two strips of copper (a couple of tracks from some strip-board would be perfect, but  as you say you could use stripped wire, or anything conductive.)
Logged

UK
Offline Offline
God Member
*****
Karma: 0
Posts: 529
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok sounds like a really fun project so i just went and made one (thought it may help if your not used to reading schematics)

[size=18]DRY[/size]


[size=18]WET[/size]

And just to set you off in the right direction here is the code to light up pin 13 when it detects water
Code:
/* Flood Sensor
 
 This sketch will light up the LED on Pin 13, when water (anything conductive) bridges the gap in the sensor.
  
   created 02/09/09
   by n00b
 

 */
 
 const int floodSensors = 2;     // the number of the Flood Sensor pin
 const int ledPin =  13;      // the number of the LED pin

 // variables will change:
 int floodSensorState = 0;         // variable for reading the floodSensors status

 void setup() {
   // initialize the LED pin as an output:
   pinMode(ledPin, OUTPUT);      
   // initialize the flood Sensor pin as an input:
   pinMode(floodSensors, INPUT);    
 }

 void loop(){
   // read the state of the flood Sensor value:
   floodSensorState = digitalRead(floodSensors);

   // check if the flood Sensor is wet.
   // if it is, the floodSensorState is HIGH:
   if (floodSensorState == HIGH) {    
     // turn LED on:    
     digitalWrite(ledPin, LOW);  
   }
   else {
     // turn LED off:
     digitalWrite(ledPin, HIGH);
   }
 }
 
« Last Edit: September 02, 2009, 08:22:04 am by n00b » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 17
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This doesn't work for me. Using a Duemilanove mega 328.

The only way I can get a positive reading is to short the leads together.

Come to think of it, if the resistance of water is meg ohms, how will this low a resistance be able to pull the input pin to a low when 10K is holding it high? I don't see why this would ever work....?
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17292
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
This doesn't work for me.

You may have to play with the resistor value, say 100k, 1 meg, etc. Also as an experiment you might try shaking some salt into the water plate and see what happens. Also maybe trying to use a analog input pin where there doesn't have to be such a large change of reading Vs a digital input pin. You could then analyze the analog input value between wet and dry values to determine the best threshold value to use in the switching logic.

Lefty
« Last Edit: October 22, 2010, 04:00:13 pm by retrolefty » Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 300
Posts: 26218
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It will work much better if your sub operates in salt water.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

North Carolina, USA
Offline Offline
Full Member
***
Karma: 1
Posts: 137
:O Arduino!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

if it isn't in salt water, you could always include a small payload of salt scattered around the bottom   ;D
Logged

Pages: [1]   Go Up
Jump to: