0

I have a project involving lighting up 12 dual LEDs using a 9-Volt DC Power Adapter with Max current of 500 mA

According to the datasheet Dual LEDs datasheet the forward voltage is about 2 V at 20 mA.

I want to light up the LEDs with a good brightness to them.

So far this is the only solution if I run them at 20 mA, but if I run them let say at 24 mA the resistance will change to something like 47 ohms.

My concern is that if a string happens to fail, I believe the current will be higher on the other strings. Also, the strings are driven by a PNP transistor which is required for my project's needs. Their bases are connected to microcontroller pins and set to low to activate the PNP and thus light up a string, the PNP transistor IC = 600 mA.

So for example if all the strings are ON and one string happens to fail, will the other two strings will be affected drastically to the point that will also stop functioning, or if only two strings are on and one fails the will remaining string still be functioning?

I need help finding a good solution give by these restrictions 9 V, 12 LEDs/4 LEDs each string, and PNP transistors. I know having LEDs in parallel is not really recommended, but I want to find the best possible solution that can make this project work to minimum downfalls.

enter image description here

Citi
  • 161
  • 7
  • What's driving the base of the BJTs? Nothing is wrttten about that. Also, may I assume that the resistors are grounded at the "tiny circle" end? Or is something else there that isn't shown? Like another BJT? – jonk Jul 31 '21 at 19:57
  • Is the 9V coming from a battery perhaps - if so it would not be constant 9V, it could be 10V when new with low load and voltage will drop below 9V due to internal resistance during use. The transistor is also assumed to be ideal, but it would have about 0.2V drop over it. Assuming 8V 20mA per LED chain will be awfully close to 9V supply so even small tolerances cause significant variation in current. – Justme Jul 31 '21 at 20:39
  • Are you aware that the Base pins of those PNP transistors will be at about 8.3V? Can your microcontroller survive having 8.3V on its pins? – brhans Jul 31 '21 at 20:52
  • Yes, the resistors are grounded at the end. Also, 9v power adaptor is used, this is the PNP transistor i'm using https://www.onsemi.com/pdf/datasheet/mmbt4403-d.pdf – Citi Jul 31 '21 at 21:22
  • Will the 9V power adaptor be regulated or unregulated? – Justme Jul 31 '21 at 22:36

3 Answers3

2

You have correctly added series resistance into each string (rather than try to share one common resistor between all three). Since each string is in parallel on the 9 V supply they are, in effect, independent. (You might see a little variation on the 9 V reading on good battery while switching strings on and off but it probably won't be noticable.

The 600 mA transistor rating gives you plenty of margin.

if all the strings are ON and one string happens to fail, will the other two strings will be affected drastically ...

No. You're feeding from a constant voltage source (9 V). If you were feeding from a constant current source then yes, the current would split two ways rather than three.


You haven't shown how you are driving the PNP transistors. Watch out for high-side driver fail.

enter image description here

Figure 1. The protection diodes on most logic chips creates a sneak-path to positive supply. This will keep the PNP transistor permanently turned on and may damage the chip.

enter image description here

Figure 2. To drive a high-side transistor from a GPIO pin we need a level translator. An NPN transistor does the job nicely.

Images from my post on High side driver fail which has some more text on the issue.

Transistor
  • 168,990
  • 12
  • 186
  • 385
  • We're using a 9V power adaptor as our voltage source. Also right now I have it as Fig#1 and the PNP I'm using is this one https://www.onsemi.com/pdf/datasheet/mmbt4403-d.pdf and PIC18f4220-i/pt. 5V and High-Current Sink/Source 25 mA/25 mA. – Citi Jul 31 '21 at 21:21
  • I think I need to implement figure 2 since Vss > Vmicro. I have the PNP like figure 1 with 10k at its base. I would just need to make the Port pins go high to drive the NPN – Citi Jul 31 '21 at 21:22
  • With the Figure 1 setup are you able to switch the LEDs on and off? – Transistor Jul 31 '21 at 21:27
  • Well, In the beginning, with fewer LEDs I was using 5V at the emitter and I coded the microcontroller to go low 0v at the base when I wanted to light up a string. But because of some restrictions, we want to use 9V instead – Citi Jul 31 '21 at 21:33
  • That makes sense. You'll need 9 V for four in series. – Transistor Jul 31 '21 at 21:37
  • Yes, I would need 9v for 4Leds and we're getting the source voltage (9v) coming from a power adaptor. but my question is if I do Fig 2 which I probably need to, – Citi Jul 31 '21 at 21:44
  • However, my concern is if a LED string fails there other strings will no be affected to the point that won't be functioning, but if Im getting my power source feeding from a 9v power supply adaptor (constant voltage) will that help – Citi Jul 31 '21 at 21:49
  • I will be using a 9-Volt DC Power Adapter with Max current of 500 mA, Okay it seems that I will need to implement figure 2 to prevent high-side driver fail – Citi Jul 31 '21 at 21:54
2

Why you shouldn't use a resistor to limit the current...

I don't like using resistors as current-limiters -- most especially in cases where you are using up most of the voltage headroom with the LEDs, themselves, and leaving almost nothing left over for the resistor. If you are willing to waste a lot of voltage overhead for the resistor, then they work fine as current limiters with LEDs. But otherwise, no. They are very bad to use with LEDs when there is little to no overhead.

This is where I depart completely from the answers already provided, as well as your own thinking. I can't even get myself to help you there because it is just so wrong right from the start.

I blanche at the idea of leaving only a nominal (guessed) \$1\:\text{V}\$ out of an estimated \$8\:\text{V}\$ for the LEDs. It just won't work well and it slaps me in the face to see it.

You can read the details here and here, the gist of this with regard to the current variation in the LED:

$$\begin{align*} \%\,I_{_\text{LED}}&=\%\,V_{_\text{CC}}\cdot \frac{1}{1-\frac{V_{_\text{LED}}}{V_{_\text{CC}}}}\tag{1}\label{1} \\\\ \%\,I_{_\text{LED}}&=-\%\,V_{_\text{LED}}\cdot \frac{1}{\frac{V_{_\text{CC}}}{V_{_\text{LED}}}-1}\tag{2}\label{2} \\\\ \%\,I_{_\text{LED}}&=-\%\,R\tag{3}\label{3} \end{align*}$$

In the above cases, \$V_{_\text{CC}}=9\:\text{V}\$ and \$V_{_\text{LED}}\$ is the total voltage for all the LEDs placed in series. So for purposes of (4) \$2\:\text{V}\$ (nominal) LEDs, \$V_{_\text{LED}}=8\:\text{V}\$.

The above also assumes, though-out, that \$V_{_\text{CC}}\$ is the average value and that \$V_{_\text{LED}}\$ is also the average value and that you always have sufficient voltage to operate the LEDs.

  1. Eq. \$\ref{1}\$ is interesting. In your case with the above assumptions, the variation in LED current will be \$9\times\$ the variation in the supply voltage. If the supply rail varies by 5% then the LED current will vary by 45%! Something to think about!
  2. Eq. \$\ref{2}\$ is similarly interesting. In your case with the above assumptions, the variation in LED current will be \$8\times\$ the variation in the LED voltage. If the LED voltage varies by 10% then the LED current will vary by 80%! Something still more to think about!
  3. Eq. \$\ref{3}\$ isn't terribly important. All it says is that if you use 2% rated resistors then the LED current regulation will be -2% (the negative sign just means "in the opposite direction of.") I'm sure this isn't of any concern, at all.

You could improve things by giving more voltage to the resistor. What about just (3) LEDs per series string?

  1. Eq. \$\ref{1}\$ says now that the LED current will be \$3\times\$ the variation in the supply voltage. If the supply rail varies by 5% then the LED current will vary by only 15%. That's better.
  2. Eq. \$\ref{2}\$ is similarly interesting. In your case with the above assumptions, the variation in LED current will be \$2\times\$ the variation in the LED voltage. If the LED voltage varies by 10% then the LED current will vary by 20%. That's much better.

So, you can see that the resistor gets better when you throw more voltage at it. But I think you can also see that I believe you are cutting things far too thin when you expect to use (4) LEDs in the string.

Another reason why you shouldn't use (4) LED in-series strings...

The above was all theoretical. Now let's look at the LED datasheet:

enter image description here

Already you can see that it is possible that \$V_F=2.4\:\text{V}\$ when operating at \$I_F=20\:\text{mA}\$! That's +20%! Quite a variation. (4) such LEDs, if you happened to grab all the wrong ones, could mean they don't even light up for you!

Now, admittedly, it's unlikely. But are these the kinds of risks you want to take?

Battery voltage...

EDIT: I just noticed that you wrote in a comment that, "We're using a 9V power adaptor as our voltage source." So the following may not be applicable. That said, it may be useful to others who actually are using a battery, instead. So it stays, with my understanding that it doesn't apply directly in your case.

One more thing. The battery voltage of \$9\:\text{V}\$. Let's look at a typical ENERGIZER 522 -- 9 V batttery:

enter image description here

Right off the bat you can see that they just barely allow about \$60\:\text{mA}\$ draw. Maybe. (They are rated in the other curves for a lot less draw.) So, sure. You can use one.

But what about the voltage? Note that the above chart specifies \$4.8\:\text{V}\$? Do you expect to use one down to that voltage??? I doubt it.

Now think a moment. You already know that it is possible that you might have a (3) LED in-series string requiring as much as \$7.2\:\text{V}\$. Sure, you expect no more than \$6\:\text{V}\$, typically. But you don't design for "typically." (Or you shouldn't.)

You could drop down to just (2) LEDs, in-series. But I think you need to plan for some battery voltage other than \$9\:\text{V}\$ in your design.

Let's look at another curve from that datasheet:

enter image description here

See how rapidly the voltage drops to \$8\:\text{V}\$?? And it isn't close to being used up, yet. I might pick \$7\:\text{V}\$ as my minimum design voltage. You need to pick your own number. And then stick with it.

How many LEDs, now?

(Of course, you may actually be using a high quality \$9\:\text{V}\$ power supply. But you haven't said so in your question. I've chosen to assume the obvious, in response.)

Temperature

I forgot to mention temperature! The LED voltage will vary significantly over temperature variations, ambient and otherwise. And if their voltage varies, as you know by now, the resistor will supply more (or less) current as the drop across the resistor changes to accommodate the LED changes due to temperature.

Yet another reason not to like resistors.

Use current regulation.

Finally, you probably really want to use current regulation using BJTs. This is really easy to adapt to the circumstances and it will give you a uniform result even as the battery voltage declines and even with varying LED voltages in your strings. The problem with the idea is that it also requires some voltage overhead. But the benefit is that, unlike a resistor, it requires less voltage overhead for good current regulation. So, at least, you are in better circumstances with an active current limiter vs a passive one.

If you want to see all the gory details of designing one, look here.

But I can't help you with that because you need to make some decisions.

If you do decide to go with active current regulation...

Here's the schematic I'm thinking about, right now:

schematic

simulate this circuit – Schematic created using CircuitLab

I'm assuming above that your MCU cannot stand-off high voltages. So I've included option 1 for driving the circuit. There may be other options to consider. (An NFET comes to mind.) But again, I'd need more details and your thoughts about NFET vs BJT.

(At these current levels I like BJTs more -- they are cheaper and easier to get and I don't have to worry about whether or not I'm grabbing one with the right \$V_{_\text{GS}}\$. But that doesn't mean I wouldn't use an NFET if a junk-box one was laying out and handy.)

Anyway, there's a thought to consider. It's an active circuit. And it will work quite well. It is stable against temperature variations, as well. (Also against variations in the power supply rail. So long as there is enough overhead and the devices can dissipate wasted heat. But it's better to avoid wasted heat and just keep the supply rail close to what's needed, if possible.)

You can probably work out \$R_3\$ given your MCU voltage and that you only need about \$150\:\mu\text{A}\$ into the base.

Summary

If the above doesn't convince you to never again use resistors as LED current-limiters, nothing will.

There are also some wonderful ICs available these days. They do even better at all this -- lower voltage overhead, better current control over temperature, etc.

But I consider them to be boutique. New ones come out that are better and offer more features, all of which also help sell them. Given time, the older ICs will gradually fade in volume and at some point wind up "hard to get."

On the other hand? BJTs are forever. (And I can get big, fat ones for high currents that the ICs can't readily handle, too.)

EDIT: Added for the case where you want only (2) BJTs per series chain...

If you are willing to sacrifice some BJTs for the common good, then you can use mirror BJTs, instead. This will reduce the number of BJTs per string to just two, instead of three.

The high-side resistors of \$5.6\:\Omega\$ are there mostly to limit source current with the series string isn't ON and to mitigate the impact due to BJT variability within a part number and manufacturer when the string is ON.

The I/O pin resistors can probably be \$27\:\text{k}\Omega\$, or thereabouts.

schematic

simulate this circuit

Note that I decided to set up a Darlington. I'd forgotten about what happens when a series chain isn't ON. (Or if none of them are...) So there are a few more BJTs in the above circuit. Make sure \$Q_1\$ can dissipate. A TO-220 wouldn't hurt.

Finally, keep in mind I'm a hobbyist and no expert on any electronics topic. I spend hobbyist time doing hobbyist level thinking and offer that for free. I make mistakes. I miss important details. So do test this out with just one string, at first. And don't hook it up to your MCU until you are feeling comfortable with the results.

jonk
  • 77,059
  • 6
  • 73
  • 185
  • Thank you for your help, I'm not using a Battery voltage supply but I getting my source voltage from a DC Power Adapter with Max current of 500 mA. I see how 4 LEDs at 9V will be a problem. I think the best route would be to use 3 led – Citi Jul 31 '21 at 22:37
  • @Citi That's a good decision, I think. In that case, I'll add something. – jonk Jul 31 '21 at 22:39
  • Sorry to "slap you in the face", jonk! :^) As usual, you're very thorough. – Transistor Jul 31 '21 at 22:42
  • Yes, using the equations above, I agree I'm cutting things far too thin. As of right now, my option would be to use figure 2 by @Transistor shown above to drive the Mirco GPIO pin and use 3 LEDs per string at 9V to improve things. – Citi Jul 31 '21 at 22:44
  • @Citi There it is, for now. – jonk Jul 31 '21 at 22:47
  • @Transistor Nah. It's the circuit that slaps me in the face. But I was surprised that you didn't look at the LED datasheet long enough to see this whole idea is crazy-minded nor immediately have it pop into your mind that reserving a nominal 1V is "slim to no chance." ;) – jonk Jul 31 '21 at 22:49
  • Yes, I'm using PIC18f4220-i/pt. 5V and High-Current Sink/Source 25 mA/25 mA. That can't stand high cannot stand-off high voltage. I would like to use BJTs, I think @Transitor Figure #2 will do the job? – Citi Jul 31 '21 at 23:24
  • I'll be already using a total of 6 PNP and 6 NPN transistors. This project will be a LED box that will be connected to another board through a Cat8 Ethernet cable where all the 8 pins are used. – Citi Jul 31 '21 at 23:33
  • The PNPs will allow get the voltage from the board and connect the collector to the CAT8 Ethernet cable pins. if necessary I would too use the minimum transistors, but that will get the job done – Citi Jul 31 '21 at 23:35
  • @Citi If you are willing to dedicate about 5 BJTs as "overhead" then you can get by with two BJTs per series-LED chain (mirror chained), instead of three. But it doesn't pay off until you have five chains or more. For a display using lots of LEDs, it pays off quickly. – jonk Aug 01 '21 at 01:01
  • Thank you for your response, I'm using dual LEDs red and green. I'll be using the 3 LEDs per chain, so there will be 6 chains, that are controlled by 6 pins in the Micronotller. So I was thinking of using 1 NPN and 1 PNP for each chain. – Citi Aug 01 '21 at 01:15
  • @Citi With six chains, it *might* be worth the extra trouble then. I'll try and keep it simple while also dealing (without much thinking behind it, to be honest) with BJT vagaries and temperature. – jonk Aug 01 '21 at 01:40
  • Thank you again, this means a lot – Citi Aug 01 '21 at 02:00
  • @Citi Added the schematic. Hopefully, that gives an idea. \$Q_1\$ could be a Darlington to reduce the offset, but unless you add "lots" of series chains I don't think it's needed. – jonk Aug 01 '21 at 02:01
  • Okay. Thank you. – Citi Aug 01 '21 at 02:09
  • @Citi I made a few modifications. I think the Darlington arrangement is probably better, now that I've thought more. I also added \$Q_{14}\$ to give the Darlington something consistent to sink (and some other minor thoughts.) – jonk Aug 01 '21 at 02:33
  • I see thank you, so much for your help – Citi Aug 01 '21 at 03:09
0

You should use NPN transitors between each LED string and Ground. With PNP transistors, the microcontroller will not be able to turn the LEDs off - you would have to get the PNP base up close to 9 volts to turn it off.

The three LED strings should be independent - a fault in one string should not affect the other strings.

Peter Bennett
  • 57,014
  • 1
  • 48
  • 127
  • Hi if I used the figure 2 shown above implementation, will a fault in one string will not affect the other strings to the point that will stop working right? – Citi Jul 31 '21 at 22:09