# how to control LED array? (follow-up)

• posted

Hi - this is a follow-up to this thread:

cd7eab0/cb7e229d9bca99d5

I've been working on finalizing the design. I've drawn up a schematic in Eagle of what I think should work:

This is essentially identical to what John Fields was suggesting, except I've modified some resistor values as I have now chosen LEDs:

(3.3v forward voltage, 20-30ma typical current)

The design of this array calls for only one column to be on at any given time. The columns are active high, and the rows are active low. The goal is to saturate the transistors. The value for R1-R16 was chosen by dividing the typical base-emitter saturation voltage by the base current, thus 0.85/.015 = 56.67, or about 56 ohms. These values were found on page two of both the 2N4401 and 2N4403 datasheets:

The value for R16-R24 was chosen by taking (V+ - 2*VCesat - Vled)/ILED = (5 - 2*0.4 - 3.3)/.03 = .9/.03 = 30 ohms. A current of 30ma was chosen because only one led on each row will be on at any given time, and as each column will only be on for 1/8 of the time - I feel it is best to use the maximum current allowed.

Oh - lastly, if anyone is curious as to the odd placement of gnd on the row connector and +5v on the column connector (as the layout would probabaly be nicer the other way around) - I did this as a reminder that the rows are active low and the columns are active high.

So how does everything look? Some of my calculations and final numbers differ from the original thread - thus I thought I should check back to see if I'm doing something wrong. Thanks so much,

-Michael J. Noone

• posted

"Ban" wrote in news:maSle.952901\$ snipped-for-privacy@news3.tin.it:

Now that I'm looking back - He used different values.

The idea is that there'd be 15ma going through the 56ohm transistors, saturating the transistors. (I believe they're saturated at 15ma?) Did I mess up somewhere in my calculation?

But unless I'm looking at something wrong - that wouldn't saturate the transistor, and if it's not saturated my understanding is that you can't accurately predict voltage and current through it.

It will need to be able to drive 240ma - 8*30ma = 240ma. I want to run these at max brightness due to the 1/8 duty cycle.

Oops - you're quite right about that. Not quite sure where my head was there.

Oh damn - just realized that Vcesat is not constant - it varies depending on collector current. That's no good... I'm not quite sure what exactly to do about that as collector current should be anywhere between 0 and 240ma - which presents a fairly wide range of Vcesat voltages.

Could you advise on how to make such a current source?

Thanks,

-Michael

• posted

Did Mr. Fields also advise to take these 56 ohms base resistors? They will consume more current than the LEDs. You can use 470 ohms for them. with 8mA you can drive easily 100mA collector current in case you multiplex. You have to calculate the voltage across the resistor, not the transistor. when you have 4.5V control signal (typical PIC) and 0.75V Ube, then R= 3.75V/8mA =

468 ohm. You can even take 1k if you use transistors with beta of 150 or more. Uce sat will be a bit lower than 0.4V, maybe 0.15V, so it is better to use 47 ohm for 30mA. But if you always multiplex them and the program doesn't get stuck with one LED always on, you can probably even put 100mA through the LED with a duty cycle of 1/8. It would be better to make a current source for the Leds then you do not need these resistors at all and can easily adjust the brightness.
```--
ciao Ban
Bordighera, Italy```
• posted

Michael, in the first place choose different transistors for 240mA current. I had a look at the Zetex site and found these for example: NPN ZTX1047A Vbe

• posted

"Ban" wrote in news:uvTle.952925\$ snipped-for-privacy@news3.tin.it:

3D22

I'm looking at the datasheet for the BCR402R, but I must admit I'm a bit confused about it. Is the idea of the chip essentially that it outputs an amount of current controlled by the size of the resistor between Vs and Rext? The datasheet is rather sparse in regards to the effects of changing the value of this resistor. Or is the idea that the chip always supplies 30ma if it can, and this resistor is used to drop the voltage down? The latter of these is what I'm thinking is probabaly the case - but I'm just not sure - I mean I think most LEDs run at more like 5-15ma

- I think 30ma is pretty high for an LED.

So - what I think you're suggesting is to use these BCR402Rs to drive single LEDs at a time, and then use a saturated transistor to handle the whole 240ma. Is that right? Also - do you know of any sources for the BCR402R? The usual suspects - Digikey, Newark, and Mouser, all don't carry it.

Thanks!

-Michael

• posted

```--
If you want to drive the LEDs at 30mA, then the column driver needs to
pass 240mA with all the LEDs in that column ON.```
• posted

```--
Aarghhh!!!  It should be:
```
• posted

John, have you ever considered making these corrections _before_ you hit send?

Thanks, Rich

• posted

Probably so. Your base resistors are incredibly low-valued.

Yes.

You can saturate a BJT with a lot less than 15mA into the base. It all depends on the circuit around it and the BJT. Of course, with 56 ohms, you'd probably be getting more than 15mA, as well.

You can probably run them with even more than 30mA, given that they will only be on for 1/8 duty. You might want to make this an adjustable setting so you can change things later on.

Then design things to work.

Actually, I don't think you need to worry about controlled current sources or sinks. The topology you have is just fine for getting the job done. You could try and design something else, but I'd recommend getting the design you already have laid out working reasonably well. Then, once you understand it well enough, you can always work on various improvement ideas later on.

Let's look at a slightly modified version of your design. I've made the PNPs the high-current sources that may need to drive many LEDs at once and the NPNs the lower-current sinks that will never need to sink more than one LED's current. You can always arrange it the other way, of course. Here's a 3X3 design that is expandable to the 8x8 on which you appear to be working:

: Vcc : | : | Vcc : \\ | : / Ra3 | : \\ 47k | : / | : Rb3 | |e : | | | : A \\ | : RaA / gnd : 47k \\ : / : | : gnd

This section sinks the current for one LED, only. The NPN, QA, is operated as a switch (assumed saturated.) The input point called "A" is the place where your logic-level control enters to control the switch, QA.

Let's make the design assumption that the beta we want should be about

20 (a figure that is well below the peak beta for most common devices today.) If you expect to sink 30mA per LED, then you would expect (30mA/20) or 1.5mA for the base drive. At about 1mA or so, typical Vbe is very close to the usual 0.7V assumption, so let's go with that as an approximation. So the base of QA will be at 0.7V when sinking.

If your logic level control is nominally 5V and CMOS and having to provide 1.5mA or so, let's choose an estimate of about 4.8V at the pin of your micro (it's not uncommon to find output resistance slopes of about 60-150 ohms for micro pins; so use the worse value of 150 ohms at 1.5mA to get 0.225V drop -- I just called this 5-.2 or 4.8V.) This means that RbA should be (4.8V-0.7V)/1.5mA or 2733 ohms. A standard value at or below this figure should be fine. 2700 ohms, then.

If you wanted to sink 100mA, instead, the computation would be to figure a base drive of 100mA/20 or 5mA. Your micro's output would probably drop to something like 4.2V, supplying that much current (you can always examine the data sheets to get a better figure for this.) This means your RbA value should be (4.2V-0.7V)/5mA or 700 ohms. Call it 680 ohms to pick up on a standard value.

What about the dissipation? Well, for QA, the operating Vce at a beta of 20 might be around 0.1V or so. Looking at the 2N2222A from Motorola, I see that at an Ic=10mA and an Ib of 0.5mA (beta=20), the Vce is typically below 0.05V at 25C. I also see that an IC=150mA and an Ib of 7.5mA (again, beta=20), the Vce is typically below 0.1V. Let's use the higher Vce, or 0.1V. That makes things look worse, heating wise, so it will be a conservative estimate if you choose to run at 30mA instead of 100mA. With Vce=0.1 you get 0.1V*30mA or 3mW at 30mA and you get 0.1V*100mA or 10mW at 100mA. Both dissipations are easily handled by a 2N2222. Also, by a 2N3904, if you prefer. The TO-92 plastic package will be just fine.

Luckily then, no need to go find large NPNs.

By the way, I've added RaA here as a 47k value designed to ensure that if there is no signal input at "A", then the base will be clearly pulled to ground keeping the NPN base from floating and firmly off. At a base voltage of about 0.7V when ON, this resistor will sink another 15uA. It won't be noticed. Or even a 10k @ 70uA won't be noticed. But tying it down like this may help in a stand-alone display with a connector, where the signal lines might just "float in space," otherwise.

Forget RA for the moment and lets go on to the high side "column driver" section:

: Vcc : | : | Vcc : \\ | : / Ra1 | : \\ 47k | : / | : Rb1 | |

• posted

```--
I did...```
• posted

I forgot to finally address myself to the value of RA in:

: | : \\ : / RA : \\ : / : | : | : RbA |/c QA : ,--/\\/\\-+-| NPN : | | |>e : | | | : A \\ | : RaA / gnd : 47k \\ : / : | : gnd

What it should be depends on the Vcesat of QA and the Vcesat of Q1 (or Q1p, from the earlier discussion) and on the expected voltage across the diode at the desired current. Already, we know that for QA, this Vcesat is about 0.1V. Also, if you are going with 30mA per LED, the

2N4403 gives you about 0.35V for Vcesat at full-bore 240mA. So, you lose about .45V (call it .5V) at those two places. Also, the LED itself at 30mA is about 3.3V from what you've said. So the total loss of voltage is about 3.8V from 5V. That leaves 1.2V for the resistor, RA, at 30mA. So, Ra=1.2V/30mA, or 40 ohms. Make it 39, as a standard value.

In the case of the higher drive, 100mA per diode, more thoughts are needed. Here, with the TIP30A I mentioned, the Vcesat is still about

0.6V at 800mA. If you use a TIP42A, instead, that drops well below 0.2V with 40mA base current. Whether you use one or the other only chooses where the heat gets dissipated (RA or Q1p), so long as there is enough voltage headroom for the LED itself. So let's see what the LED requires.

I don't have a data sheet on your LEDs, so a lot of guessing is in order. But the diode equation that says that the slope of the Vd vs Id line (the linearized resistance) of a diode is about (nkT/q) / (Id+Isat). At Id's of 20-100mA, Isat can be largely ignored. So this is about n*26mV/Id or something like 2.6 ohms at 30mA with n=3 (nominally 1, but 3 isn't an unreasonable guess) and .78 ohms at

100mA. For pure rough-shod guessing work, I'd take the average of these two (2.6+.8)/2 or 1.7 ohms as the mean slope and figure that if there is 3.3V at 30mA, then there is 3.3V+(100mA-30mA)*1.7 or 3.42V at 100mA. Call it 3.5V. So, with 5V supply, we are left with (5V - 3.5V

- .6V - .1V) or 0.8V. That's slim, but it suggests an RA of .8/100mA or 8 ohms. Use a 7.5, I suppose.

RA would need to dissipate 75mW. In the 100mA per LED design, Q1p would be dissipating some 550mW, if you recall, with the TIP30. If you wanted to shift more dissipation to RA, you could use the TIP42 which would cut its Vcesat to say 0.2V and its dissipation to under

200mW. But then the difference in Vcesat (0.6 - 0.2) would have to be picked up in the resistor, RA. So it's new value would be 12 ohms and its dissipation would be 120mW. That might not seem quite right, because you might be wondering how it is that you can go from 550mW to 200mW on Q1p and only go up from 75mW to 120mW on RA. But if you remember that there are eight of these RA resistors, each of which are carrying their own part of this difference, then you can see how it all comes out even again. In other words, by using a slightly more expensive PNP on the high-side source, you can distribute the power dissipation over 8 resistors, resulting in lower peak temperatures overall.

Jon

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.