Basic Wetness Sensor

So I’ve had the idea for a while to try and automate the growing of plants so I need to be able to tell if something’s wet or not. Here’s a video:

Basically the hookup process is that of a regular analog sensor with this in it’s place. There’s a 10k pullup resistor as the voltage divider.

Here’s the source for the Arduino.

C

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

intwrite1;

intwriteval;

voidsetup(){

Serial.begin(9600);

pinMode(3,OUTPUT);

}

voidloop(){

Serial.println(analogRead(0));

write1=map(analogRead(0),0,1023,0,100);

writeval=map(write1,0,100,0,1023);

analogWrite(3,writeval);

delay(100);

}

That’s pretty complex but I was trying to make the light changes more drastic so it would show up in the video better.

Here are some pictures of the build process:

Thanks for reading!

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone, but proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.