Control PWM motor running time with millis

slipstick:
There may be other problems but it looks like one is that every time you come through loop() if the conditions for switching the pump on are still true you switch it on again and reset pumpStartTime.

Try checking whether the pump is already on before you switch it on. Then you will only reset pumpStartTime when it actually needed starting not every time round the loop().

Steve

I see your point, but i'm aiming to only check the moisture in he soil once every 2-4 hour, and i dont want the pump to be running for the entire time.