Relay code loop issues

Hi, I'm working on my first project with a relay and I'm stumped :confused: on why the first pass through my code is successful but the subsequent trips through the loop do not repeat the results.
The project is a simple plant watering device with soil moisture sensor and 12 volt pump attached to a relay shield. The moisture sensor is working great and I've done many trials to ensure the code picks up the various water levels.
I now have the code turning on the pump when the soil is dry for 10,000 ms, turning it off then checking the soil water level again as it repeats the loop. The first pass detects the soil as dry, pumps the water, turns off the pump and then detects the soil as still dry. However, it does not turn the pump on again. My multi-meter shows the 1st pass sends 12v to the pump but subsequent passes do not, even though the relay shield clicks and lights up to signify that it is getting the HIGH command to switch and pass the 12 v through to the pump.
Am I missing something obvious?

int watertime = 10000; // how long to water in miliseconds
int waittime = 3600000; // how long to wait between watering
int pumpControl = 5;

void setup()
{
Serial.begin(9600);
pinMode(pumpControl,OUTPUT);
pinMode(A0, INPUT);
}

void loop()
{
  int SensorValue = analogRead(A0); //take a sample
  Serial.print(SensorValue); Serial.print(" - ");
  
  if(SensorValue >= 1000) {
   Serial.println("Sensor is not in the Soil or DISCONNECTED");
   digitalWrite(pumpControl,LOW);
   Serial.println("Pump Off");
  }
  if(SensorValue < 1000 && SensorValue >= 600) { 
   Serial.println("Soil is DRY");
   digitalWrite(pumpControl,HIGH);
   Serial.println("Watering");
   delay(watertime);
   digitalWrite(pumpControl,LOW);
   Serial.println("Pause to check water level");
  }
  if(SensorValue < 600 && SensorValue >= 370) {
   Serial.println("Soil is HUMID"); 
   digitalWrite(pumpControl,LOW);
   Serial.println("Pump off, plant is watered!");
  }
  if(SensorValue < 370) {
   Serial.println("Sensor in WATER");
   digitalWrite(pumpControl,LOW);
   Serial.println("Soil is too wet, Pump off.");
  }
  delay(50);
}

the "int" data type only gets as big as 32,767
try using "long" for waittime

But I don't see you even using waittime in the code so it won't change anything other than being proper for that part.

Looks correct to me, but variable waittime is going to get you into trouble if you ever use it.

Looks correct to me as wel; I would use unsigned longs for watertime and waittime :wink:

Your relay shield is clicking, so 12V should go to the pump; but a multimeter will not be able to measure quickly enough if the code at high speeds toggles between on and off.

Maybe a power issue; does your arduino go through reset cycles? Add a Serial.println("Starting") in setup() to check or observer the pin13 led (three quick flashes indicate a reset). Although this would not explain why the first cycle is OK.

Can you show a schematic (a photo / scan of a handdrawn one is fine)? Usually relay boards have a jumper; it's my understanding that it needs to be removed; I don't have a relay board so can't say for sure.