ESP32 dimming white and RGB LED strip - MOSFET and level shifter question?


I'm planning to make a project using an ESP32 (or possibly an arduino) to control two LED strips.

The white LED strip in question uses a maximum of 80w for the length I would like. It's 12v (but I might end up going with another one that uses a bit more power and is 24v). I initially used a mechanical relay for the to control the LED to turn on/off with an arduino (the relay requires 5v signal). But I'd like to enable the dimming option and eventually use an ESP32 to control it.

What kind of mosfet should I be looking for? Something that I can solder on a PCB or have it automatically assembled (i.e surface mounted?). Do I need a single one or two to increase from 3.3 to 5v for the signal and then another one for the 12v/24v?

To recap:
A MOSFET that would allow me to control 12v or 24v LED for dimming using a 3.3v or 5v signal.

Unsure if the LED itself is required but here's a link to the ones I'm considering.
Hot Sale High CRI 90 Single Color Flexible COB LED Strip Lights
DC12/24V Single Row 600LEDs SMD5050 Optional Superbright 10mm Width Waterproof Flexible LED Strip Light 16.4ft Per Reel By Sale [FSLSR-12V-5050X600X10]

My other question is, this ESP32 will also control an addressable LED using FastLED. If I end up using the ESP32, then I'd need a level shifter. I read that I2C don't work and I should get 74HC04 or 74HCT14.
I've only seen ICs for these, the ones that are used for soldering onto a PCB. Is there a standalone one that I can use for testing until I go to the PCB production phase? I dunno what search terms to use?
Also, is there a better alternative than the level shifters I mentioned?

A logic level MOSFET for the required voltage and current.

Search yourself for "ESP32 level shifter".

74HCT04 or 74HCT14

They come in SMD or through-hole mount. Either way, they are ICs. :grin: Do not add any suffix to the part number when searching as that may lead you to the SMD version you do not want.

No. That is why these are suggested.

Probably a bad idea, as you will likely find "bidirectional level shifters" which are generally not at all suitable.

I did more research and here's what I found. There aren't a lot of MOSFETs that can handle the voltage/current I'm looking for if my control voltage is less than 5v (ESP32). I've seen people suggest a "gate driver IC".
I've also seen people recommend these two MOSFETs. FQP30N06L and IRLB8721PBF. Some people were even using them directly from the ESP32. While others said that this shouldn't work, and if it did, it wouldn't reach the maximum capacity of the MOSFET.

So now I have even more questions.
Let's discuss the MOSFETs first:
From the datasheet (more like the simplified data in digikey's table), I see some things that I'm not exactly 100% sure about. In layman's terms, without getting too much into details here's what I understand.
Vgs(th) (Max) @ Id: bare minimum voltage I can supply to barely open the gate.
Drive Voltage (Max Rds On, Min Rds On): the voltage I should be aiming for. There are two numbers here. I should aim to be in that range. The higher, the less resistance? So less heat, right?
Drain to Source Voltage (Vdss): the maximum voltage it can output.
Is that what I understand correct? I know it's simplified version of what is happening.

Onto the gate level:
Driven Configuration: unsure which type to go for here
Voltage - Supply: guessing this is the output, but it's range.
Logic Voltage - VIL, VIH: guessing this is the input, there are two numbers unsure why?

I've seen these two being recommended: MCP1407-E/P and MCP1404. They both have "Low-Side" as their Driven Configuration.

OH! I was missing the T, that's why I couldn't find it earlier. Thanks!

The word I was thinking of was "module" I was looking for an integrated thing with pin ins. Like I didn't want to bother with a breadboard for testing purposes haha.

Lastly, I found this list on the askelectronics subreddit.

  • 3.3V Logic-Level-Gate N-Chan Power-MOSFET:
  • : ~IRF3708 - don't drive gate above 12V on this part
  • 5V Logic-Level-Gate N-Chan Power-MOSFET: (choose one)
  • : IRLZ44N, ~FQP30N06L, ~IRL540N, ~IRL530N - older parts
  • : ~IRLB8314, ~IRLB8721, ~IRLB4132, ~IRLB8748, ~IRLB8743, ~IRLB3813, IRL2203, ~IRLB4030
  • 10V Standard-Gate N-Chan Power-MOSFET: (choose one)
  • : IRFZ44N (not same as IRLZ44N), IRF540N (not same as IRL540N) - older parts
  • 10V Standard-Gate P-Chan Power-MOSFET:
  • : IRF9540N - older part
  • MOSFET Gate Drivers: (choose one)
  • : ~MCP1404, ~MCP1407, ~IXDN602, TC4427A

Would it be fair to just get one of those Gate Drivers or something with a similar dataset (per what I asked about) and pair it with any of the MOSFETs to handle the PWM signal to the LEDs?

Also, essentially, can I not use 2 MOSFETs in series to do this? Assuming I found a MOSFET with a low voltage input for example? Or would that cause other issues?

Is a gate driver the same as voltage regulator?

It's kind of a level shifter, if the MOSFET requires higher gate voltage to turn on than the µC Vcc. Or if you build a high-side switch.

To make clear what you need:

  • which voltage (Vds)?
  • which current (Id)?

can drive up to 62A, that's way too much and requires a high gate voltage to turn on. Search for one that closer fits your current.

But it only requires 4.5 volts, no?

What's the HIGH voltage on ESP outputs?


So it will never reach 4.5V. That's why you need a driver or level shifter for that MOSFET.

While there are many modules available and "breakout" boards to make SMD chips accessible on breadboards, I do not recall one for so simple a function as mounting a single logic IC.

Has it occurred to you that if you use a 74HCT14 gate as a level shifter for the addressable LEDs, you could also use it to boost the logic level to 5 V to reliably drive a "logic level" FET?

I mentioned that in the post, that I couldn't find something that required lower than 4.5v anyway that would suit me. Unless, I'm searching wrong. I found two that people were recommending but they're now obsolete. As in, I'll probably need a driver either way.

It has occurred to me, that was gonna be my next question after you guys answered the other questions (didn't want to be flooding too many unrelated questions). I was going to ask if the level shifter can do the same job as the gate driver.

From the way I see it, a level shifter, a gate driver, a MOSFET, and a relay more or less do the same thing. All the other sources I found had people using a gate driver followed by a MOSFET, so I assumed that maybe there's a certain characteristic that I'm missing.

In this case, can I use that same level shifter to power the MOSFET and to control the addressable LED? The point that I thought might cause issue is that the level shifter is for data signals, which tend to have lower current, and maybe the MOSFET requires a higher current to open the gate?

The purpose-designed FET drivers are capable of driving some serious current into the FET, however The 74HC(T) logic chips are not entirely trivial in their capability. Their ratings (25 mA) are somewhat more than the ESP (12 mA) and less than the ATmega (35 mA), so if an Arduino can successfully PWM the logic-level FET, then the 74HC(T) should be able to.

It may actually be appropriate to use a series resistor (220 Ohms) to limit the actual current drawn by the FET gate as it charges.

What about SI2302DS, IRF7401, BS107/108, IRF3708, AOC2414...

I see. Sorry, this might sound like a stupid question, would putting the resistor in and also the 74HC(T) slow down the PWM so that it won't work with dimming? I'm not really sure if this causes a latency in the signal or not.

SI2302DS: discontinued, also current at 2.5 is a bit too low. I'd rather go with something 5A just in case.
IRF7401: barely fits the bill since it's 2.7v (I read somewhere that when the signal is connected it often drops down to 2.8v) So still should open up the gate.
BS107/108: There's a BS107something something on digikey, but that's a higher voltage.
IRF3708: That's the one I mentioned earlier. It fits the bill perfectly, but it's been discontinued. The alternatives suggested by digikey require a higher trigger voltage.
AOC2414: 8v source only. So less than the 12v required. Also obsolete.

I'll look more into IRF7401. That seems the best one. That being said, if I can use the level shifter to trigger the mosfet, then might as well use it. I only need one channel for the addressable LED and 1 channel for the MOSFET (dimmable LED). And the level shifter has 6. So might as well combine them.

Thank you both for the suggestions. This was definitely super helpful!

Given a gate capacitance of 1.6 nF (IRF7401), the time constant of this with a 220 Ohm resistor is about 2 µs, so unless you propose to use a PWM frequency in the tens of kHz, this is not going to affect anything.

Not sure what you mean by "barely fits the bill". The IRF7401 has a minimum VGS(th) of 0.7 V and is fully specified at 2.7 V so should operate perfectly at 3.3. V logic levels. That is, without a level converter.

But for the 74HCT14/ 04 you use two at a time - to invert twice.

Sorry, I'm gonna ask more questions. That's what I had asked about earlier, but I guess nobody answered, so I was unsure.

So what's the difference between the two values of drive voltage? If V_GS is what opens the gate?


Why do I need to invert twice?

Lastly, I'm better off using IRF7401 instead of a level shifter plus a higher rated MOSFET, right? I'll need the level shifter regardless anyway, just the connection won't go through it. Like less dependant components etc.

I do apologize for asking stupid/silly questions. I'm really grateful that you have the patience to help me out.

If you refer to the clip I gave,

It gives you the maximum - this is to say, worst case values for RDS(ON) at two voltages, 2.7 V which your 3.3 V logic should be able to produce quite reliably, and 4.5 V which similarly your 5 V logic should be able to produce reliably. No minimum value is given as you never care if it is working better than that. :grin:

At those currents specified, this tells you that the dissipation in the chip for 3.3 V logic fully on at 3.5 A should be no more than 370 mW which should be very reasonable. Whether that would suit your 80 W LED strip at 12 V drawing 6.6 Amps (which is just within the ratings of the IRF7401) is another matter as the power dissipation varies as the square of the voltage so that would be 1½ Watts and require a heatsink.

Unfortunately you probably should not use it to drive the 24 V LED strip version - which would require only 3.5 A and the dissipation would be OK - as it is only rated to 20 V.

Mind you, it would actually work for a 24 V LED strip as the LED strip does not conduct at all until at least 16 V or so, so the FET would never see anywhere near 20 V! But it just does not sound like good design. :roll_eyes:

Well while it could with some difficulty be re-written to suit, the FastLED code that drives the addressable LED strips requires the data not to be inverted, so using hex inverters as level converters - which is the most sensible as they are cheap and the most reliably available - you have to feed the output of the first into a second to get the original polarity of data.

Similarly while you can (easily) alter your PWM code to exchange the ON and OFF levels, you will probably find it easier to keep in mind if you just use two inverters. Note that in either case, the output of the ESP to each of the inverter pairs should have a 10k (or 47k) pull-down to keep the corresponding LED system switched OFF while the processor boots.

So if you use the IRF7401 and are using a 74HCT14 level converter, you might as well use it to drive the FET(s) with 5 V logic to minimise RDS(ON) and power dissipation in the FET(s).

So just to make sure I understand.

I would have

  1. ESP32 GPIO - 10K resistor - channel 1 (74HCT14) - channel 2 (74HCT14) - addressable LED.
  2. ESP32 GPIO - 10K resistor - channel 3 (74HCT14) - channel 4 (74HCT14) - MOSFET - white LEDs?

The 10k resistor ("k", not "K") does not go in series between the ESP and the logic gate, it goes from the ESP pin to ground, to hold it down and keep the LEDs off while the ESP is booting and not controlling the pin.

And I gather from your original that there is a third channel for a second white LED strip.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.