Powering 12V LED Strip from 3.3V ESP32 with PWM

ledled stripmicrocontrollermosfet

I'm developing an automation board and want the facility to PWM dim a strip of LEDs up to 5-10 amps @12 V.

These are plain 2 wire LED strips, positive and negative, nothing special.

My esp32 will be powered via a buck converter from a variable input and I will also have a regulator to level out the 12 V supply.

I have seen projects using the TIP120 for this but I'm not too comfortable with it being at max capacity so I'm leaning toward a MOSFET. Any suggestions on the best way to power the MOSFET through PWM with 3.3 V logic?

Best Answer

I suggest using a N-channel MOSFET, connected between GND and the "-" of the LED.

There are 3 things to check when choosing the N-channel MOSFET :

  • that it is fully turned on with only 3.3V (this will eliminate many mosfets) : look for those with a low threshold voltage (well under 3.3V), and then check on the curves if it is really turned completly on at 3.3V
  • check that with 3.3V on the gate, the mosfet can carry enough current for your application
  • check that the mosfet can handle the heat without extra heatsink (or plan to add the heatsink, but be carefull that even that might not be enough). As a rule of the thumb, the bigger the current rating, the less risk of overheating

schematic

simulate this circuit – Schematic created using CircuitLab

Note that you will need the R1 resistor to limit current in your LEDs (excepted if they are already "12V LEDs", in which case they have it probably already included).

Optionnaly, you might want to add a resistor (something like 10k) between gate (ie the pin of the mosfet connected to PWM) and ground to make sure the mosfet is turned off when the esp32 is off (or resseting).

If you choose a really huge N-channel MOSFET, you might need to add a resistor in series between PWM and the gate to limit the current when switching the mosfet (huge N-mos have non negligible capacitance between gate and ground), but it you can avoid it, it's best (adding it makes the mosfet switching slower, therefore increasing the heat produced in it)