How to properly dim LED's with this "high frequency" PWM? - Page 1
Forum section: electronics / beginners

author: Faranight
author_rank: Unknown
timestamp: June 16, 2021, 09:11:14 am
content: Hello,Electronics is my hobby and I am relatively new to mosfets and switching applications in general, so I'll request some help. I am working on a circuit where a PWM driver (PCA9634) is used to generate a 97kHz square wave signal of a chosen duty cycle. The chip is a 8-channel driver, but let's assume we're only using a single channel since I can simply replicate the same solution on all 8 channels later. Anyway, I would like to use this PWM signal to drive and dim a certain +24VDC LED light. The outputs of PCA9634 are obviously not strong enough to drive the LED directly since they require a lot more current than the pins can supply (according to datasheet: sink 25 mA and source 10 mA at 5 V), and the fact that the IC runs on 3.3V while the LED requires +24V.What would be the proper way to drive the LED light with the given PWM frequency?I was thinking of using an intermediate mosfet as an on/off switch. The first thing that came to mind was to use a low-side N-channel mosfet, but that would mean connecting it to the ground rail. That implies that I would have to clamp the positive wire of the LED light to the +24V rail... which is not something that I am a fan of considering this is going to be an outdoor light. The mosfet switch should therefore be located *before* the LED chain (high-side), and the obvious choice is to use aP-channel mosfet. Unfortunately, this type of mosfet cannot be driven directly by the PWM IC.So here's where I am stuck. I've seen some circuits where a P-channel mosfet is driven by a N-channel mosfet or even a BJT, but it was also stated that this setup was not meant for high-frequency switching. The mosfets apparently have some parasitic gate capacitance that delays the switching action a bit, and that can be a problem at high frequencies. But honestly, what even is a high frequency at switching? Does 97kHz qualify as a high frequency in a mosfet application? If I use a N-channel mosfet or a BJT to drive the P-channel mosfet, will the circuit be able to cope with the used switching frequency (97kHz)? Should I use a different approach than a n-mos/bjt to drive the p-channel mosfet? Should I use something else instead of a P-channel mosfet to drive/dim my LED?Thanks in advance for any advice.

author: ledtester
author_rank: Super Contributor
timestamp: June 16, 2021, 10:58:04 am
content: QuoteWhat's your concern about doing that?Have a look at this review and teardown of a DC12-24V Dimmer Box:https://www.electroschematics.com/dimmer-box/You'll find the schematic around 1/3 of the way through. It's all low-side switching.

author: Faranight
author_rank: Unknown
timestamp: June 16, 2021, 11:44:05 am
content: Quote from: ledtester on June 16, 2021, 10:58:04 amI guess it's a habit I've picked up.It's a common decision that you would put a switch before the load and not after it. For example, consider that you're making a device that has an electric motor and is powered by mains AC. You would always put the switch on the live wire, not the neutral one. I guess I was trying to apply the same design principle on a DC circuit - put the switch on the positive rail, not the ground (i.e. before the load, not after it).Are you suggesting my approach is wrong?

author: ledtester
author_rank: Super Contributor
timestamp: June 16, 2021, 11:56:06 am
content: For mains power this is a good practice, but 24V is not a shock hazard.

author: Faranight
author_rank: Unknown
timestamp: June 17, 2021, 05:15:05 am
content: Cool, I'll do it with a n-mosfet then. That simplifies the circuit a lot.Thanks.

author: james_s
author_rank: Super Contributor
timestamp: June 17, 2021, 05:18:27 am
content: That's the standard way of doing this, N channel mosfet low side switch, for 97kHz you'll want to make sure your mosfet driver can supply enough current to switch the gate sufficiently fast. If you really want to make sure the +24V line is disconnected when the load is off you could switch the main power to the strip with a relay but it isn't really necessary.

author: tooki
author_rank: Super Contributor
timestamp: June 17, 2021, 04:28:43 pm
content: Quote from: Faranight on June 16, 2021, 09:11:14 amBy pure chance, I just designed that same IC into a design a few weeks ago so its capabilities are still fresh in my mind.Did you not read section 7.7 of the datasheet? It specifically explains the configuration options so you can use NPN or PNP transistors or N-channel or P-channel mosfets, with or without pullups, since it supports configurable totem pole or open-drain output, as well as logic inversion.

author: Faranight
author_rank: Unknown
timestamp: June 21, 2021, 06:07:59 am
content: Hey!Quote from: james_s on June 17, 2021, 05:18:27 amI'll try to find a decent logic-level N-channel mosfet, and see what happens, if I drive it directly.How does one calculate the amount of needed current to switch a mosfet at a given frequency?The PCA9634 datasheet says:The LED output driver is programmed to be either open-drain with a 25 mA current sink capability at 5 V or totem-pole with a 25 mA sink, 10 mA source capability at 5 V.Quote from: tooki on June 17, 2021, 04:28:43 pmThat chapter only describes polarity configurations. The issue is that I'm powering the said IC on 3,3VDC while the LED's will be on a +24VDC rail. The pins of that chip are 5V tolerant, but not 12/24V tolerant, so I can't hook it up directly to a p-channel mosfet gate (i.e. +12V), can I?

author: james_s
author_rank: Super Contributor
timestamp: June 22, 2021, 03:40:02 am
content: Quote from: Faranight on June 21, 2021, 06:07:59 amWell you can look up the gate capacitance and calculate it based on the required rise and fall time to minimize the time spent in the linear range. It's probably easier to just wire up a prototype and put a scope on the gate to have a look though. Wild-assed guess is you'll want a gate driver capable of an amp or so, the average current will be low but mosfet gates are capacitors, you need to drive them pretty hard when you want fast switching. They make ICs specifically for this, or you can use a totem pole follower stage.

author: tooki
author_rank: Super Contributor
timestamp: June 22, 2021, 05:06:35 pm
content: Quote from: Faranight on June 21, 2021, 06:07:59 amNo, but you can connect the gate of an N-channel MOSFET or the base of an NPN transistor directly. In either case, the LED string’s positive side is connected directly to the positive supply rail, and you’re essentially connecting and disconnecting ground. This is shown (with an NPN) on page 24 of the datasheet.