Maximum GPIO source/sink current
Posted: Fri Mar 26, 2021 9:46 pm
Hello,
I want to build an LED dimmer with PWM with an ESP32 controller. The 24 V LED stripes are switched with a MOSFET but that needs a certain current to switch through quickly. An alternative might be a combination of npn+pnp transistors between the GPIO and MOSFET gate (think it's called push-pull but I don't know it, I'm a software developer, not primarily an electronics engineer). Anyway, I'm sitting in front of LTSpice simulating different resistor values and watching the timings. My aim is to be able to turn the LEDs on and off with a minimum GPIO pulse time of 50 ns (equivalent to 20 MHz).
Now I couldn't find out what maximum current I could use here. The datasheet says 40 mA source current on the high level and -28 mA sink current on the low level. Another thread in this forum shows other figures and even states that the limits are configurable. And it says that higher currents might be okay for a short moment.
According to my simulation, I only need the highest current for a very brief moment of around 10 ns, after that it already decreases to the half or less.
But I want to build a controller with 8 channels (as far as I could find it out, that's the number of fast timers available in the MCU). So that's 8 MOSFETs that want some current to be switched. If all of them turn on in the same moment, what is the maximum current I can draw from a single GPIO (or sink into it when they turn off at the same time) and for how long?
The intended PWM period frequency is 2.5 kHz and the dimmer should provide 8000 levels. Then the lowest level has an ON time of 50 ns. I need so many brightness levels because the lighting needs to go from 100% at full working illumination down to so little that it's just an orientation light in the middle of the night. And it should still be able to smoothly fade on and off even for the night light so I need a few levels below it. Sure I can use a lower PWM frequency for the night but I'll try to get as far as possible without that workaround.
I want to build an LED dimmer with PWM with an ESP32 controller. The 24 V LED stripes are switched with a MOSFET but that needs a certain current to switch through quickly. An alternative might be a combination of npn+pnp transistors between the GPIO and MOSFET gate (think it's called push-pull but I don't know it, I'm a software developer, not primarily an electronics engineer). Anyway, I'm sitting in front of LTSpice simulating different resistor values and watching the timings. My aim is to be able to turn the LEDs on and off with a minimum GPIO pulse time of 50 ns (equivalent to 20 MHz).
Now I couldn't find out what maximum current I could use here. The datasheet says 40 mA source current on the high level and -28 mA sink current on the low level. Another thread in this forum shows other figures and even states that the limits are configurable. And it says that higher currents might be okay for a short moment.
According to my simulation, I only need the highest current for a very brief moment of around 10 ns, after that it already decreases to the half or less.
But I want to build a controller with 8 channels (as far as I could find it out, that's the number of fast timers available in the MCU). So that's 8 MOSFETs that want some current to be switched. If all of them turn on in the same moment, what is the maximum current I can draw from a single GPIO (or sink into it when they turn off at the same time) and for how long?
The intended PWM period frequency is 2.5 kHz and the dimmer should provide 8000 levels. Then the lowest level has an ON time of 50 ns. I need so many brightness levels because the lighting needs to go from 100% at full working illumination down to so little that it's just an orientation light in the middle of the night. And it should still be able to smoothly fade on and off even for the night light so I need a few levels below it. Sure I can use a lower PWM frequency for the night but I'll try to get as far as possible without that workaround.