Using Mosfet for high-side switching of LED strip with ESP-32

Hey yall,
I've been working on a 24-volt LED strip alarm clock with CCT temperature control. I plan to control it with an ESP-32 using PWM. The LED strip draws about 2.5 amps when powered on. I've been digging around for a while and have been able to figure out almost everything I needed for this project on the forum, but there's one thing hanging me up. The LED strip has a common positive, and individual grounds to control the color temperature. This rules out using an N-channel MOSFET, at least in its typical configuration. I've searched around online for some p-channel MOSFETs to fit the bill, and I think I've found it. The one I've got my eye on is the IPP80P03P4L-04 (link to the datasheet below). This one has a max Vgs (threshold) of 2V and an Rds of 4.1milliohms which almost seems too good to be true XD. I then see it is intended for reverse battery protection and it makes me fear there's something else that makes this a poor application for me. Does this transistor seem reasonable for what I'm trying to do?

I've also heard that MOSFETs are pretty fragile and if you expect a long life out of them, you really need to baby them. Because of this, I've also been considering using a MOSFET driver. But I'm honestly not sure how to begin with that. Any guidance is greatly appreciated!

IPP80P03P4L-04 Datasheet:
https://www.mouser.com/datasheet/2/196/Infineon-I80P03P4L_04-DS-v01_01-en-1225645.pdf

Thanks for reading! :slight_smile:

Try it first without the mosfet driver. It depends on the PWM frequency and if the mosfets gets hot.

You can handle the mosfets in a normal way. They are not as fragile as some mosfets 30 years ago.

The ledstrip has a common wire for the +24V ?
That means you need n-channel mosfets to pull something low for a color.
Can you draw a schematic ? Can you give a link to that ledstrip ?

Adafruit has a logic level mosfet: https://www.adafruit.com/product/355
Sparkfun has a logic level mosfet: https://www.sparkfun.com/products/10213

The mosfet that you found has a gate capacitance of 10nF. For a high frequency PWM signal, you better find one with a lower gate capacitance.
It is also not fully on at 3V:
afbeelding

The low Rds is indeed that low. Modern mosfets have a few milliohms.

Thanks for the detailed response. I now feel like a complete idiot! You are absolutely right, I do indeed need an N channel mosfet. For some reason when I was first looking at it I thought I needed a P channel mosfet and never challenged it. I actually initially purchased some N channel mosfets (IRLZ44N) on eBay the same time I ordered my LED strip, but never even tried them. I just hooked up the circuit on the breadboard now and everything works as it should. I do fear that they're counterfeits as the resistance I calculated is about 50 mOhms. I'm gonna do some testing and see how hot they get and that will be my final indicator if I use them for the final project.

On another note, I would like to understand this better so I hope you don't mind if I pick your brain a bit. I saw you were concerned about the capacitance. The way I understand this is that the primary concern is the total gate charge. Though I recall from physics 2 that the rate a capacitor can charge changes as charges more, so I can see how that would affect it. How do you calculate this using capacitance? (Note: I see now that the total gate charge is pretty large as well so I agree it would've been a poor choice) Also, I did see that it wasn't fully open at 3v, but it says it can run about 40 Amps, so I figured this wouldn't be an issue, what do you think would happen if I did try to use it at 3V?
Thanks! :slight_smile:

(Edit: Formatting error)

The effect of capacitance on heat due to switching times depends on what frequency you are using.

I've been running strips of LED's using IRLD014's driven from a 5V MCU for 7 years. Each IRLD014 is switching about 1/2 amp. I'm running at about 220 Hz.
I've added additional capacitance from Gate to source to slow the switching down a bit to reduce generated EMI. I use an AM radio (I know what is AM?). When I can bring the radio tuned off station, near the circuit and I don't pick up much noise on the radio I figure the circuit is not generating too much EMI.

You are looking at the wrong curve. You need to look at this curve (for the FQP30N06L, your sparkfun link)

For the fully on case:
At 2.5 A and Vgate = 3V the expected drop is ~ 0.2V so the MosFet will heat up to dissipate 0.2 * 2.5 = 0.5Watts. As the mosfet heats up this will get worse at elevated temperature.
So in free air the device will heat up by 62 °C/Watt or 31°C rise over ambient. If you case is 40 °C then the Mosfet will be at 81 °C.

Of course if you are dimming to 50% then these numbers drop in half.

I know this is a long technical path for those not used to designing with MosFet's but there is not much I can do about that.

John

image

JohnRob, I miss the word "low-pass filter", I would like to add that to your explanation.

The ESP32 has a maximum output current for a pin of 12mA. Since the gate act as a capacitor the current has to be limited to 12mA.
3.3V / 12mA = 275Ω
So a resistor of 330Ω is needed to protect the pin of the ESP32.

The 330Ω together with the capacitance of the gate act as a low-pass filter. The curves of the PWM signal gets less steep and the mosfet is no longer fully on or fully off. Because of that, it gets warm.
There is often a pulldown resistor to keep the mosfet off during power-on. For a picture, see: https://www.gammon.com.au/motors

The mosfet drivers or gate drivers are designed to blast a large current into the gate to overcome the problems of the capacitance.

The mosfet drivers or gate drivers are designed to blast a large current into the gate to overcome the problems of the capacitance.

Everything you say is true. However I think the critical point here is the magnitude of the truth.

The RFP30N06LE has an input capacitance of 1350pf. For simplicity I will assume the gate is actually linear.

If the output of the ESP-32 is internally limited to .... say 20ma. Being a mosfet output the max current is internally generated heat.

dt = C dV / I = 1350e-12 * 3.3 / 0.02 ≈ 225 ns

I'm going to suggest that the over current for 225ns is not long enough to cause any damage.

Remember I stated this also assumes a rather slow 220Hz. So even with the 330 ohms you suggest the gate will be at the max voltage the ESP-32 can supply for all but about 400 ns of the 4.5ms period

The gate to ground resistor; could be 100k making the divider effect negligible.
Also note the ESP-32 likely outputs something less than 3.3V (aka Vin) my guess would be approx 3 v.

The manufacturer put the limits in the datasheet for a good operation. Designing software and designing a circuit is not about how far you can go beyond that.

The ATmega328P can do crazy things beyond what is in the datasheet. The actual short circuit current for a output pin is more than 40mA. I used a voltage charge pump once with 100nF capacitors and a high frequency (I forgot what it was, above audio range) and it worked fine. I added a current limiting resistor later on :wink:

The ESP32 is a much more complex processor. If the limit for a output current exceeds the 12mA then it can have effect on the noise on other things.
I don't know what the analowWrite() or ledc PWM frequency is. There is more than one solution and things have changed.
All worst-case things combined (10nF gate capacitor + current limiting resistor + high PWM frequency) might heat up the mosfet.

Hi,

So you want to control each individual ground do you with the ESP32?
That is each cathode (gnd) connection being individually connected to some separate control from the ESP?

Can you please post a basic circuit diagram of how you will connect the LEDs to the ESP and include the P-CH to switch the common anode connection.

Thanks.. Tom.... :smiley: :+1: :coffee: :australia:

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