Arduino Rain/Moisture Sensor

September 9, 2009

Here is a quick and easy rain/moisture sensor made for the Arduino using just a 10k resistor, and two track from a strip board.

In the sketch below it is programmed to light up the built-in LED on pin 13 when wet.




/* 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


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);


3 Responses to “Arduino Rain/Moisture Sensor”

  1. emilio said

    interesting! I would like to link it to my roof window that has an electric engine (and make it close as it starts raining). Any suggestion?

  2. I am extremely impressed with your writing skills and also with the layout on your weblog.
    Is this a paid theme or did you customize it yourself?
    Either way keep up the nice quality writing, it’s rare to see a great blog like this one these days.

  3. thank you bro…. it works perfect 😉

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: