Control a submersible pump with ESP8266

I've got the following pump which i would like to control from my ESP8266 FireBeetle.

This pump is driven by a 12V power supply connected to the wall, and as you can see on the product page, the cable is split to allow to attach the cable to a middlecontrol.

I was thinking about of using one of my TIP120 transistor that i have to be able to turn the pump on and off.

I tried some connection schema based on other schematics i've seen online,but it doesn't work at all. I'm pretty sure i'm missing something.

(Instead of the motor on the schematics, it's the pump)

Either the pump isn't turned on at all, or the .ino-file wont even be uploaded at all.
Any ideas on how it should be connected?

void setup() {
  pinMode(2, OUTPUT);
  

}

void loop() {
  
  digitalWrite(2, HIGH);       
  delay(3000);                  
  digitalWrite(2, LOW);       
  delay(3000); 
  
}

You have it wired as a high side switch, won't work. Connect 12+ to pump +, pump - to collector (TIP120 pin 2), emitter (pin 3) to 12V ground, base (pin 1) to Arduino pin 2 thru a 1k resistor, Arduino GND to 12V ground.
If not working or running too slow try dropping base resistor to 680 Ohms, do not connect directly from Arduino pin to base.

FredScuttle:
You have it wired as a high side switch, won't work. Connect 12+ to pump +, pump - to collector (TIP120 pin 2), emitter (pin 3) to 12V ground, base (pin 1) to Arduino pin 2 thru a 1k resistor, Arduino GND to 12V ground.

Now from my understanding of reading this, does the following schematics seem correct?

I see you mention Arduino, but I was thinking of not including a Arduino in this project, and only use my ESP8266. Is this possible?

Thanks.

Thats more like it, if 3.3V does not give enough base current to saturate the TIP120 lower the resistor gradually, measure the Voltage across the TIP120 emitter to collector with pump running, if more than a couple of volts you may need more base current but be careful.

FredScuttle:
Thats more like it, if 3.3V does not give enough base current to saturate the TIP120 lower the resistor gradually, measure the Voltage across the TIP120 emitter to collector with pump running, if more than a couple of volts you may need more base current but be careful.

Is there any specification saying how much current a transistor base requires to handle a certain voltage across the emitter to collector?

Also, why exactly do i need a resistance in the first place between the gpio and the transistor?

Base current is (3.3volt logic - ~1.3volt BE junction) = ~2volt / 1000ohm = 2mA.
A TIP12x darlington saturates with 1:250 base:collector current.
So 1k is fine for a TIP12x that only has to switch 0.5A with 3.3volt logic.

What worries me is the LED in that diagram.
Every time the pump turns off, the LED will get zapped (reverse) with the back-emf of the pump.
A (1N4004) diode is needed across that load, to kill back-emf.
Cathode (ring) to +12volt.

390ohm is a lot of LED current. Increase resistor value to >= 1k.
Leo..

Also, why exactly do i need a resistance in the first place between the gpio and the transistor?

Because the base to emmiter is, in effect a diode (2 for darlington) to ground. When the base voltage rises above the forward voltage of the diode(s) they start to conduct, As the voltage rises they conduct more just like a regular diode. That can cause the base current to shoot up and without current limit (the resistor) the current can be over the 40mA absolute max of the output connected to the base. Bye bye output pin.

FredScuttle:
Thats more like it, if 3.3V does not give enough base current to saturate the TIP120 lower the resistor gradually, measure the Voltage across the TIP120 emitter to collector with pump running, if more than a couple of volts you may need more base current but be careful.

I just reconnected everything after the schematics you explained and it works!

Mind explaining why my initial schematic didn't work?