Electronic – Switching 3.5W heater with an ESP8266

esp8266powerresistorsswitchestransistors

I'd like to control a 3.5W heater using an ESP8266 GPIO pin, but I'm both a complete beginner and I'm unsure about the best setup to use.

I'm powering the circuit at 5v, which includes a nodemcu (with it's own 3.3v regulator) and the heater (an 8ohm resistor) which I'm using in a feedback loop and which I'd like to switch at a frequency of at most 1hz. I was hoping to avoid a relay for this reason, and use an NPN transistor to control the heater:

schematic

simulate this circuit – Schematic created using CircuitLab

I never had to switch that much power before, so I've got some questions related to both transistors and the circuit in general. The ESP8266 GPIO output pins are at 3.3v and can source at most 12mA. Can I actually use a 2N2222A BJT in this situation? The 2N2222A is rated for a total power dissipation of 500mW, which I understand I'm going to exceed in this configuration.

Do I have to use a power transistor/mosfet? In this case, what would you suggest that could be easily put into saturation just by what's provided by the GPIO pin?

To actually power the circuit I'm using a regular 5v/1.5A switched power supply. Do I also need to worry about voltage drops that could be caused by switching on the heater in this scenario?

Best Answer

For switching "heavier" loads you definitely need a MOSFET, for example IRLZ44N. 3,3V from GPIO is more than enough to turn it fully on.

When it comes to power supply: your resistor will consume 0,625A (I=U/R = 5 V / 8 Ohm), ESP will consume next to nothing, so a 1,5A power supply is enough.