I have made a circuit which controls 12v led from ESP8266. Led is being switched from IRFZ44N Mosfet. To convert logic from 3.3v to 5v, I used 2N2222 transistor. So my overall circuit looks like this:-
This circuit is working fine except on writing ESP pin HIGH, led turns off and on writing gpio LOW, led turns on. This is problematic because on resetting ESP, led stays on until code reaches the turning gpio HIGH. Please suggest me a solution for this. I know its a dumb question but I can no where find related question, that's why I asked a fresh one.
Best Answer
You can add another transistor as an inverter.
Also, for IRFZ44, as opposed to IRLZ44, you should have the pullup to +12.
simulate this circuit – Schematic created using CircuitLab