Hi,
I'm trying to get the garduino moisture sensor to work, however, I've been running into a few problems.
I'm using a modified code in which temperature and light are omitted.
//define analog inputs to which we have connected our sensors
int moistureSensor = 0;
//define digital outputs to which we have connecte our relays (water)
int waterPump = 7;
//define variables to store moisture
int moisture_val;
//setup a variable to store seconds since arduino switched on
float start_time;
float seconds_elapsed;
float seconds_elapsed_total;
float seconds_for_this_cycle;
void setup() {
//open serial port
Serial.begin(9600);
//set the water, light, and temperature pins as outputs that are turned off
pinMode (waterPump, OUTPUT);
digitalWrite (waterPump, LOW);
}
void loop() {
// read the value from the moisture-sensing probes, print it to screen, and wait a second
moisture_val = analogRead(moistureSensor);
Serial.print("moisture sensor reads ");
Serial.println( moisture_val );
delay(1000);
//turn water on when soil is dry, and delay until soil is wet (line 41)
if (moisture_val < 850)
{
digitalWrite(waterPump, HIGH);
}
while (moisture_val < 850)
{
delay(10000);
}
digitalWrite(waterPump, LOW);
}
However, once hooked up, and plugged in, the serial monitor is showing me "moisture sensor reads 1023" repeatedly. This is much too high as, the sensor probes are not even touching.
Does anyone know what the problem could be?
Thanks in advance,