Arduino stops working correctly as soon as a DC motor is connect

Yes, and when motors start moving, they briefly draw up to 10X the normal running current, often several Amperes (the start/stall current).

I have little doubt that the breadboard has been damaged, so move your motor circuitry to a solderable protoboard like this one, or use a motor driver with screw terminals for the motor and motor power supply.

0.68uF is fine but must go across the pump terminals.
Also put the pump in water

Ohhh right, many thanks.
I actually have a smaller solderable protoboard but I didn't really wanted to solder anything before being sure that It works.

Since your circuit doesn't work, you have nothing to lose by soldering the motor and motor power wires.

The solderless breadboard is fine for testing, no need to solder.
Just add the cap and put the pump in water

I followed your advice, and while the original issue seems to have disappeared, a new problem has emerged—or perhaps an existing one was just uncovered. The Arduino now appears to be restarting roughly every minute. I added a print statement in the setup() function to confirm my suspicion, and sure enough, it keeps getting called, which indicates the Arduino is resetting. That doesn't really make sense, right? It seems like it's losing and regaining power. But why would that be happening?

Well now we need to see your code.
In the IDE click on Edit then click on Copy for Forum, then come back here and just do a simple paste.

But why would that be happening?

Are you powering the Arduino via USB?

const int sensorpin = A0;
const int sensorpower = 8;
const int pumppin = 11;

const int thresh = 300; // Threshold: above this value means the soil is dry
const unsigned long maxPumpTime = 60000;         // Max pump time: 60 seconds
const unsigned long readingInterval = 5000;   // Interval between soil checks: 1 hour (5 seconds for testing)
const unsigned long pumpReadingInterval = 2000;  // Interval between readings during pump: 2 seconds

bool pumpOn = false;

unsigned long lastSoilCheck = 0;
unsigned long pumpStartTime = 0;
unsigned long lastPumpReading = 0;

void setup() {
  pinMode(sensorpower, OUTPUT);
  pinMode(pumppin, OUTPUT);

  Serial.begin(9600);
  digitalWrite(pumppin, LOW); // Pump starts OFF
  Serial.println("System initialized");
}

void loop() {
  unsigned long now = millis();

  // Periodic soil check every 1 hour (if pump is not running)
  if (!pumpOn && (now - lastSoilCheck >= readingInterval)) {
    int sensorValue = readSoilSensor();
    lastSoilCheck = now;

    if (sensorValue > thresh) {
      startPump(now);
    }
  }

  // While pump is running, check soil every 2 seconds
  if (pumpOn) {
    if (now - lastPumpReading >= pumpReadingInterval) {
      lastPumpReading = now;
      int sensorValue = readSoilSensor();

      // Stop pump if soil is wet or time exceeded
      if (sensorValue <= thresh) {
        Serial.println("Soil is wet - turning pump OFF");
        stopPump();
      } else if (now - pumpStartTime >= maxPumpTime) {
        Serial.println("Max pump time reached - turning pump OFF");
        stopPump();
      }
    }
  }
}

int readSoilSensor() {
  digitalWrite(sensorpower, HIGH);
  delay(200); // Allow sensor to stabilize
  int value = analogRead(sensorpin);
  digitalWrite(sensorpower, LOW);
  Serial.print("Soil reading: ");
  Serial.println(value);
  return value;
}

void startPump(unsigned long currentTime) {
  pumpOn = true;
  pumpStartTime = currentTime;
  lastPumpReading = currentTime;

  digitalWrite(pumppin, HIGH);
  Serial.println("Pump ON - soil is dry");
}

void stopPump() {
  pumpOn = false;
  digitalWrite(pumppin, LOW);
  Serial.println("Pump OFF");
}


yes I am, from my PC

Not sure what's happening to cause this problem.
Try powering the soil moisture sensor from 5V and not from an I/O pin.

Do you have the pump in water?

I've tested the pump in water beforehand and it was working well. Since I don't really like having water close to the Arduino, I was testing it dry. I didn't think that would affect the pump's behavior, but I tried it again in water and it's running perfectly. I really don't know why that is, but thank you! Can I just ask one or two more things I'd like to add to my system for you to take a look at?

Those pumps use the water as a lubricant and to cool the motor. Without the water the pump may sieze up and stop working but if you have a separate supply for the pump it should not affect the Uno.

Ask any questions you like.

1.Now, I'm supplying the pump with and external source because I was unsure that the arduino could suply the pump with enough current, so my question would be if I shoud keep the external source that is currently on and power the arduino with the same source through the VCC pin or if could suply the pump from the 5V pin of the arduino and just power the arduino with the "normal power supply"
2. I would like to add a DHT11 to read the temperature and moisture of the air and have an LCD to show all of that (I've already got both )and this is the schematic for it. Is it correct? I'm asking this because I want to design a custom PCB to solder all in without having the cables lying around.

You must supply the pump with an external supply.
If you power the Uno from the same supply it must be a well regulated 5V supply and you should connect a 0.1uF and 100uF capacitor directly between Vcc and GND. Do not connect anything to the USB.

Is it correct?

Have no idea because it just shows a bunch of connectors.

I highly recommend you prototype everything first before you make a PCB

There are many tutorials available for connecting LCD and DHT

Connect the 0.1 uF and 100 uF to filter the low and high frequencies I suppose? And while that I cant connect the usb because I can damage the PC right? (thats what i read i think)

What do you mean by prototype?

That is usually a bad idea with water pumps. Many are designed so that water is a lubricant and in some cases the coolant as well.

I knew that if I left it running too long that it might burn but I would never have thought that it could affect the functionality of the arduino...

Hmm. Observation. You say you have a problem about every minute; I glanced at your code, you have:

const unsigned long maxPumpTime = 60000; // Max pump time: 60 seconds

I'm not a big fan of coincidences, I'd be looking much more closely at your code.

shoudn't I was well put some resistances to make sure that the arduino doesn't get too much current flowing in?