Need help to control a high power LEDs matrix

Hello everybody, I need to comand a kind of LED matrix (8x8) using high power LEDs (like THESE). The matrix will be common cathode. I'd need help to set the MOSFET configuration in order to provide at least 12V and 350mA per LED. I thought about something like this, but I'm not sure it works

Q1 controls every anode (via PWM) and Q2 sets ON/OFF the whole row. Is this the correct way to control these LEDs?

I thought about a Darlington driver (like THIS) but it can source 500mA "only" and it needs 25mA to comand the base. What would you do? Thank you so much for your help


and it needs 25mA to comand the base

No it does not!

This will not work:- 1) The top FET can only have 5V on it and as the drain is connected to 12V it can never be turned off. 2) You can not simply use resistors to current limit a 3W LED, you need a constant current source.

Grumpy_Mike: No it does not!

Right, I missread the datasheet. 25mA is the maximum base current.

Controlling this kind of LEDs is impossibile just using MOSFETS? Can you suggest a circuit that could help me please?

Thanks for your tips

Controlling this kind of LEDs is impossibile just using MOSFETS?


You need a constant current circuit. There are lots of different types so google for them. However multiplexing a constant current drive is tricky because the circuit has to respond within the multiplex time, meaning it has to be fast. This is like many circuits, more difficult to scale up than you think.

I'm reading this article to find out something that could help me

The easiest way I found is something like this

Probably it's not ok because the JFETs usually have a big gap between the IDSS(min) and IDSS(max).

Yes a constant current diode would do what you want, if you can find one of your required current rating.

And how to connect it in order to do the PWM on the anode and put 8 cathodes toghether?

Anyway, I thought this solution is a bit better

There are 2 causes: 1) the JFET is a depletion device, so the gate works in a range from -Vgg(max) - 0V (or just a little bit over hte 0volts, not much from what I read) 2) I can't find JFETs that can support 0.5 - 1A on the drain

This should work the same (or close, this is the article where I got the schematic @1st page)

Matt: And how to connect it in order to do the PWM on the anode and put 8 cathodes toghether?

First you should make sure that you can actually find a current regulating diode of ~300ma. I don't think they exist beyond a few tens of milliamps.

Creating an 8x8 array of high power LEDs -- with dimming -- is a problem with no simple or inexpensive solutions.

Matt: And how to connect it in order to do the PWM on the anode and put 8 cathodes toghether?

You would have to make the PWM output feed into the input for one of the row or column strobes. Btw: are you doing this with a Mega? To do it with a regular Arduino, you don't actually have 16 (+1 PWM) digital outs, unless you re-use the analog pins as digital outs (which is totally possible.)

Anyway, why common cathode? If you're using FETs, driving N-channel FETS on the anode (a bottom-side driver) of the devices from an Arduino is a lot simpler than trying to totem pole up to the supply voltage for a high-side driver (be it N-channel or P-channel.)

There are special MOSFET driver chips you can buy, which will generate the right voltage needed. Typically, you will need the chip, and one or more capacitors, for boot-strapping the right voltage to control the gate. However, a logic-level N-channel MOSFET on the cathode, with common anode, would be so much simpler!

First of all I want to thank you for your input. I thought about using some LM317 as constant current sources

The problem is something that allows the IC to get the necessary current since I can't connsect the Arduino directly (to be precise, there are some 74HC595s that make the PWM and I use an Arduino Uno -@jwatte).

A voltage/current regulator is a pretty steep low-pass filter. It’s not something you can use as a “driver” for a varying signal. You should drive that current regulator directly from the power rail.

What you want is to “and” each row strobe signal with the PWM. You can do this using 8 discrete AND gates – something like 2x 4081 chips (if you can still get discrete gates – haven’t checked in many years!) and tie the output of each AND gate to the gate input of your N-channel switch.
You can also do this by adding a second N-channel MOSFET in series with the first one for each row, and driving the gate of all those transistors with the PWM output. The problem with THAT is that you only get < 40 mA out of the Arduino, so driving 8 MOSFET input gates may not be fast enough (we’re talking microseconds here – it may also be fast enough.) If that’s the case, use another buffer device, such as complementary pair of P-channel and N-channel MOSFET devices (BS170, BS250P) or a dedicated output buffer like the 4050.

I'm a bit lost...

From what you've written I got this: I think the LEDs should have a series resistor or a current controller to work as it should, isn't it?

Is that what you meant? I didn't catch the second part, could you post some schematics? Thanks

Your circuit involving the LM317 will work but not the control unless that Fet in the ground leg is capable of handling all the current of the Led’s

I disagree. The circuit shows the PWM going straight into the LM317. The LM317 actually needs some stabilizing capacitors, and once those are in there, the response of that circuit won’t be anywhere near what you want for PWM modulation.

The circuit I suggest looks something like the attached. If you have many “PWM” outputs, you could use one for each column, else you have to switch the columns separately from the rows and PWM – so, two MOSFETs per LED, plus one per row. That starts getting unwieldy with the soldering iron :slight_smile: The constant current source should be set to drive 8 LEDs in parallel.

You can move the PWM driver up to the top for column strobe, using P-channel MOSFETs, if you can find a way to turn them off (by putting their gate at the top voltage.) An easy way to do that is to use a pull-up resistor to the gate, and ground the gate out using an N-channel device that’s logic level. The output will then be inverted.

Also, because MOSFETs need to build up a charge to turn on, their gates work as capacitors. You have to feed a certain amount of charge (== current times time) into it before it turns on. Then it doesn’t need very much current at all, only enough to replenish internal losses (which are generally very small.) However, that current build-up is going to be a bit slow when all you have to feed eight gates in parallel is less than 40 milliAmperes. For 400 Hz PWM (as normal on an Arduino) it probably doesn’t matter too much, especially if you have sufficient margin in the current/power rating of your MOSFETs. But they do generate more heat while switching, than they do when turned on or off.

And, as an aside: This is why modern CPUs generate lots of power. It’s actually all the current of all the transistors being turned on and off when changing state. If something doesn’t change, it draws next to zero power. This, in turn, is why smaller geometries is better, because you need less charge to open the gate.

PWM LED Driver.png

There are no stabilizing capacitors possible with the LM317 current limiter and If you add them all you will accomplish is to spread out the PWM pulses.

The data sheet seems to disagree. It recommends a 1 uF capacitor across the output to improve ripple/transient response. If you look at the transient response on page 4, you can see that it’s almost 10% of output voltage without it.

However, that doesn’t matter. You cannot source the input power for a LM317 for this application from a PWM pin on an AVR processor directly, because the available current output from those chips is way too low to drive the LEDs we’re talking about here. (There was talk of a 74HC595 – same problem there.)

You willl not have as much current available as you set with the sense resistor because the Fet Rdson is not in the feedback loop

That statement is wrong, as far as I can tell. I will have exactly the current set by the sense resistor. I can use the same current through as many components as I want in series. It’s the same current. All I need is sufficient source voltage.
To follow your suggested logic, the current control also wouldn’t include the LEDs themselves, because they are also not in the feedback loop. That’s simply not how current (and current regulation) works. The voltage drop over the sense resistor is I times R. I set R so that the voltage drop at the current I want is exactly the reference value. For example, if I want 800 mA current, and reference value is 1.25V, then R == 1.25/0.8, or 1.5625 Ohms. (On another note, that needs to be at least a 1W resistor, preferably 2W.) Trying to put anything more than the sense resistor in the feedback loop (from out to sense) of the regulator will hurt the precision of the regulation.
The same argument goes to your previous suggestion that there is “no feedback as to the current drawn” – the feedback is with the sense resistor, which is in series with the actual current drawn.

I agree that when all low-end drivers are turned off, the regulator will try to “float to top” in an attempt to increase current.
That’s not necessarily a problem, especially when you just switch the load to another column, so the regulated voltage won’t actually float up.

[/quote]I have used L317’s for current control many times and all of my applications were stable and worked well, including some variable current designs that however aren’t applicable here.[/quote]

I didn’t say they weren’t.
I described my suggestion for how to use double low-end drivers to solve the problem of PWM modulating the row strobes using a separate input for the “modulate” than for the “row strobe,” essentially by folding the logical-and function into two switches in series.
I also expressed concern at trying to obtain a PWM power signal, and then regulating the current output of that. At a minimum, that signal will be pretty spiky (as shown on page 4 of the data sheet.) With a capacitor, you’ll remove the spikes, at the cost of smearing the PWM. Maybe the spikes don’t actually matter in this case, either – you can try it and see if the LEDs blow early or not :slight_smile:

I agree with jwatte's solution, if I set the resistor between the Vout and ADJ pins the output current isn't going to change depending on the load in order to the fixed voltage between these pins (~1,25 V). The output voltage changes.

I have few questions tho; shouldn't the MOSFETs be an N-channel and a P-channel, as you said in your previous post? I also didn't understand how can the Arduino output current affect the switching speed of the FETs (we should talk about the 74HC595 output current, but let's assume it's the same to make it easier) since the MOSFET input resistence is close to infinte, so no current flows into the gate (just a small leakeage one). On the BS170 datasheet I can read that tON = tOFF = 10nSec. Another point is that I don't think using just one current source for the whole circuit is a good idea. I should allow it to draw the current for 8 LEDs (0.35*8 = 2.8A). This means that if I turn on 8 LEDs at a time evey load will get 350mA, but if I turn a single LED on, it will receive the whole current. So I think that every LED need his own current source.

Thanks for your help

since the MOSFET input resistence is close to infinte, so no current flows into the gate (just a small leakeage one).

Yes but the gate of a FET looks like a capacitor, so when you first put a voltage on it that capacitor has to charge up. An uncharged capacitor looks like a short circuit so potentially an infinite amount of current can flow in the short time until that capacitor is charged up. Once it is charged up then no further current flows because, as you say, it has a high input impedance.

When both of the switches are at the bottom, then both should be N-channel. The point of a P-channel is that you can put it at top of the load, because you turn them on by pulling the gate negative. The draw-back of P-channels is that you have to get the gate all the way up to the drain voltage to turn them off -- not possible with 5V logic controlling a 12V load. The work-around for that is to use a pull-up resistor (1/2W, 100 ohm, say) to pull the gate high, and instead use a cheaper signal-level N-channel to pull the gate low when turning it on. The problem with that is that you are trading off power loss in the pull-up for fast enough turn-on time in the P-channel.

Now, why do I keep talking about turn-on time? It's because the MOSFET gate works like a capacitor. When it is fully charged, it lets current flow through gate and source. When it is depleted, it stops the current flow. When it is in an intermediate state, some current flows, but there's also a significant resistive loss. MOSFETs can have very low on resistance, and very high off resistance, so the loss in "on" or "off" states is very small, and little to no heat sinking is needed. However, in the "in-between" state, the resistive heating is significant, and if you stay in that state for any significant fraction of the time, they will heat up past their tolerance level, and burn out. Hence, why single on/off switches are safer, and PWM is safer with lower switching frequency. Also, why you want enough current into the gate of the device to build up (or deplete) that charge quickly.

What do the pros do? They use special MOSFET driver circuits that can deliver very large current "spikes" for short periods of time; enough to quickly push the device on/off, but then just deliver enough to compensate for the internal losses, which are very small. Additionally, these drivers often are able to "totem pole" the output voltage above that of the input voltage, so you can use a N-channel device (typically cheaper, and lower Rdson, and thus better and cooler) even as a high-end switch. There will be a dedicated "boost" capacitor attached to the driver, where it will build up charge that it can then dump into the gate of the switch it's driving. I haven't found any of these in a DIP package, though -- all the cool kids do surface mount these days. I'm going to have to get into toaster oven re-flow soldering soon :-(

Ok, now I got your point (; So the FET gate acts like a kind of low-pass filter more or less. Sorry if I ask basics concepts of the electronics but I didn't study the FETs at high school so now I feel a bit lost when I read very technical replyes. Anyway, everything's clear now... About the project, I thought about using some drivers which could help me a lot: CAT4101. I've also looked for some high speed MOSFETs and found this which could be useful. They look fast enough, since the propagation delay is ~30ns if 5V are applied to the input (anyway, as jwatte said, I don't think I'll have a lot of problems with the propagation times in any case since the frequency isn't that high and I can adjust in order to make it as fast as it needs to be). I'll buy some components as soon as I can and try these wirings, thank you all for your inputs! I will write something to make you know how the stuff goes on and to ak something if needed! XD

It sounds like you pretty much got it now :slight_smile:

However, the “propagation delay” is not the right metric to look at. What you want is “gate charge” – a higher gate charge needs more current, or the same current for a longer time, to reach saturation. The propagation delay means something slightly different, and is more important to worry about if you’re doing very-high-frequency things like hundreds-of-megahertz clocks, or radio (RF) design, or physical interfaces for very-high-bitrate (gigabits, or at least dozens of megabits) serial busses etc.

CAT4101 seems like a decent enough device that combines voltage and current regulation with switching. One of those (plus the set resistor) per column, and a simple power MOSFET per row, would probably work fine. Note that you get “PWM” anyway because you have a 1/8 duty cycle if cycling the rows and driving the columns. If you want to drive all the LEDs, all the time, you need 64 of those drivers and resistors, and some way to get 64 separate outputs to each of the drivers. Perhaps a big enough shift register would do it :slight_smile: