Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By ArnieO
#16550 If you have a high enough voltage available you can drive the MOSFET from and ESP GPIO using a basic low power NPN transistor (2N2222 or similar) and two resistors.
User avatar
By eriksl
#16765 Otherwise the "neatest" way to drive a mosfet, is using a mosfet driver. They have some nice benefits: input can be anything TTL/CMOS/3.3V, it has a built-in schmitt-trigger for fast state transitions (less heat and power dissipation in the mosfet!) and it can drive a wide range of mosfets, so you can focus on power/output requirements when selecting the mosfet. It also has a charge pump to "pump" the mosfet "open" very quickly (which is desirable, especially for PWM operation).

Anyway, does the esp8266 have totem-pole outputs, like I am used to on other microcontrollers? I.e. is it sourcing current in high state and sinking current in low state? This is necessary if you want to drive a mosfet successfully. Otherwise the charge built up on the gate won't flow away on "low" and the mosfet remains in conducting state.

Also always included a resistor between microcontroller output and mosfet if not using a mosfet driver, something between 20 - 100 Ohms will be OK. Lower is better because of faster transitions, but also increases the risk of damaging the mosfet.
User avatar
By plggy
#16842 Tried the circuit with the suggested MOSFET and seems to be working - well except for resetting after 5 secs of pwm, but I believe I saw another thread on that.
I'll also look into a MOSFET driver. Sounds helpful.
Thanks for helping and educating a noob!
User avatar
By eriksl
#16865 I'd recommend this one (using it myself):

http://www.irf.com/product-info/datashe ... ir4426.pdf

The ir4426 and ir4427 are more or less the same parts, inverting and non-inverting. If you use this, it almost can't go wrong. The also supply and extra level of isolation so the power to your motor (probably >> 3.3V) won't end up on the ESP8266 by accident.