I want to use an ESP 8266 to trigger on/off a water pump.
The pins on the ESP 8266 output only 3.3v, but I need 5V for the pump.
I want to use the same power source for the pump and the ESP 8266 so I was thinking to use a transistor to toggle the 5V, but I never used it before and I am not sure how to wire it.
I'm using a TIP120
The emitter is connected to the common ground (missing the connection in my screen shot, but it's there)
I added a diode indeed.
I figured it is not the best mosfet for the application, but that was the only one I had on hand.
I'm not sure what I changed, but it's working fine now.
The TIP120 is not a mosfet, its a power darlington transistor.
2200Ω base resistor will give around 2mA into the base, which with a quoted gain of 1000 will control a current of up to 2A. But for switching you need to saturate the device so I'd go for about 10mA of base curent and a resisitro of say 270 ohm.
You will not get it working unless the motor power supply gnd and the controller gnd are connected together.
That way you will have a path for the base current to flow from 8266 through the TIP120 and BACK to the 8266, to complete a circuit.
ah. well it's not optimal, but at least it's working for now. I will replace the resistor though.
Would you have a suggestion for a Mosfet replacement ?
Nice chart however many of them will not work very well with any 3V3 processor. Look at the Vgs and use the ones that show 2.5 or less for your ESP devices. If this were a 5V micro they all would be OK. The output of the ESP port will probably 3V3, to far away from 5V to properly enhance them. Note: you can derate them as they will partially turn on. I suggest you mark the 3V3 compatible ones with a different color.