1
\$\begingroup\$

I'm working on an art project that consists of ~180 LEDs with about a dozen fading/flashing PWM patterns, with each pattern group/circuit controlled by a PN2222A transistor on the cathode side, with the transistor bases' signals coming from a microcontroller.

I would like to be able to control the overall brightness of all LEDs simultaneously (not really possible via the microcontroller with how I've programmed it), so I had the idea to use a few leftover transistors connected in "parallel" on the anode side to create a PWM brightness controlling "main bus" for all LEDs. The PN2222A transistors I'm using are rated up to 2A, so I figured putting 2-3 in parallel would allow the control of the LEDs high current draw (~3.6A @20mA each):

brightness control idea

I'm wondering if this looks like a reasonable solution? Or is there some reason not to do this in favor of a better way? Thank you very much!

\$\endgroup\$
2
  • \$\begingroup\$ I get BJTs for 0.4 cents each (PN2222A). So I'd be tempted to parallel them up like you are thinking, instead of buying more expensive mosfets. That said, you need emitter degeneration, which your diagram misses. This is because the BJTs vary substantially in their saturation current and one of them will likely hog all the current with the drive set up that way. Also, it is sometimes better to pay a little more for a BJT that can handle the current than to just stack them up like that. But if you have thousands of a single BJT type like I do, then paralleling can look good. \$\endgroup\$
    – jonk
    Feb 12, 2021 at 19:50
  • \$\begingroup\$ Also, I don't ever use dropping resistors. Given your high-side and low-side approach, I'd prefer to arrange one side as the higher-current switch and the other side as a current source/sink and leave out those resistors in between. In fact, I'd insist on it. You can go discrete for that current source/sink or you can select ICs that provide that feature (there are many of them and it will take up less space that way and provide more features, if you want them.) I can write something up that I've done before, if needed. \$\endgroup\$
    – jonk
    Feb 12, 2021 at 19:51

3 Answers 3

2
\$\begingroup\$

You have the transistors as emitter followers so they are going to drop a lot of voltage. In a comment you said you have series resistors for each LED that are not shown in the schematic (necessary). Okay, they've been added but via an edit so all the comments about them being missing look odd .

I suggest using a single P-channel logic-level MOSFET. Low = ON in this case.

Somthing like an AOD417 which comes in a relatively easy to handle package.

At 3.6A with at least -4.5V Vgs it will be less than 55m\$\Omega\$ at 25°C so dissipation about 0.7W (will get warm, so a square inch or so of copper would be good). For more money, a https://www.vishay.com/docs/70297/sq40031el.pdf will be about 15x better.

\$\endgroup\$
3
  • \$\begingroup\$ I would add that there is no apparent current control for the LEDs shown. The only current limit in the schematic shown would be when the PN2222's run out of Hfe capability for a given base drive current. The best solution overall would be to use FETs for both the top and bottom positions. \$\endgroup\$ Feb 12, 2021 at 18:18
  • \$\begingroup\$ LEDs have resistors in reality, forgot to draw them in the quick diagram sketch (updated now). The general consensus seems to be use a MOSFET, so I will look into this. Thank you! \$\endgroup\$ Feb 12, 2021 at 18:44
  • \$\begingroup\$ @JackCreasey He said he has resistors in the comments. I'll add that to the answer though just to be clear. \$\endgroup\$ Feb 12, 2021 at 18:50
1
\$\begingroup\$

This is a bad idea in itself. First of all BJT are not really well suited to paralleling, since current will tend to go in only one of these.

Also your high-current bus transistors would be difficult to drive since they are not ground referenced: however that could work since you are driving one single led from +5V so the emitter voltage is low. Your low side BJT are working in common emitter but your high side would be common collector, it's quite different.

The simplest way is to not use an array of 2N2222 but simply a single big transistor. 180 leds at 10mA are really not a big problem to drive, just pick some TO220 package. Even better use a MOSFET, it's easier to drive from the MCU since it doesn't need as much as gate current. Use the part you find available, it's not really critical.

The other thing you could find is that LEDs doesn't really like to be put in parallel, you'll see many different brightnesses; it's really a manufacturing tolerance issue.

What is usually done for this kind of work is to have LED strings of many led in series (with white leds is not unusual to have supplies of more than 60V!) so that the current in each is the same (they will have the same brightness). That's quite a lot more complicated, however.

If you want to go that way many manufacturers do controller ICs for led strings, with PWM and often even blinking options. Just shop around

\$\endgroup\$
2
  • \$\begingroup\$ To parallel BJTs you need a resistor in the emitter circuit of each one. MOSFETs you parallel but share a common heat sink. They will share automatically as one gets hotter its resistance raises allowing the others to pick up the load. FYI inside they are a bunch if individual cells connected in parallel. You need to look at the saturation voltage of your transistor, a Phillips data sheet shows a saturation of 1.6V * 2 transistors gives you 3.2V. 5V - 3.2V gives 1.6V to light the LED. My suggestion is to redesign the circuit and probably use a higher voltage. \$\endgroup\$
    – Gil
    Feb 12, 2021 at 18:30
  • \$\begingroup\$ Thank you for the clear explanation! Yea I considered a single higher-rated transistor originally, was just hoping I'd get lucky and be able to reuse what I had leftover/on hand, but no worries. There are resistors on the emitter side in front of the LEDs in reality, just forgot to draw them in the quick sketch (updated now). So quick browsing digikey, it looks like maybe something like this would work? Max drain current is listed as 17A, well above my needs: digikey.com/en/products/detail/infineon-technologies/IRFZ24NPBF/… \$\endgroup\$ Feb 12, 2021 at 18:42
1
\$\begingroup\$

Bad idea. I won't go into why because others will but there is no need to do this in the first place.

Why can't you modify the program to PWM the LEDs for brightness control?

If it's because of the way you programmed the patterns and flashing and can no longer integrate them to inherently PWM as they flash the different patterns. You don't need to do it simultaneously (although it would be better).

Ad hoc solution is to slave your pattern control signals to a master brightnes PWM timer. Take the LED drive signals you place on the output pins of the MCU, but before placing them on the pins, logically AND the pattern control signal with the output signal from a PWM timer whose duty cycle controls brightness. And then place the result on the MCU output pin. As long as the brightness control PWM frequency is significantly higher than the pattern flashing the the small amounts of jitter won't be discernible to the human eye.

If you want to get fancy, you may also use multiple global brightness control PWM timer channels that are staggered so some LEDs are on while others are off during the high frqeuency brightness control pulsing which will help alleviate peaky currents. Since they are all on the same timer but different channels you can change the PWM duty cycle to change the brightness of different groups of LEDs independelty as well.

ALso, paralleling a bunch of LEDs and using a common current limiting resistors can cause problems. LEDs are not all perfectly identical and the ones with the lowest voltage drop will tend to divert current away from all the others through themselves if each does not have its own series resistor. The issue is almost identical to to why you shouldn't parallel BJTs without current balancing resistors.

\$\endgroup\$
2
  • \$\begingroup\$ The controllers I'm using (3 actually) are old PIC12F675's (just what I had on hand). To create the PWM I have to manually program each pin turning on, set a delay, and then back off, so adding in an additional layer of PWM to the program for brightness just isn't practical. Your logic gate solution could work, but would require a lot of rework to fit a dozen or so (1 gate per circuit's transistor) additional AND gates (since the CB is already wired). Also, the LEDs do not use a single common resistor per pattern/circuit, the drawing is just diagrammatic. But thank you for the response \$\endgroup\$ Feb 12, 2021 at 18:52
  • 1
    \$\begingroup\$ I don't mean a physical AND gate. I mean logically AND in software, inside your MCU. Even if you are using do-nothing loop delays, you realize you can use timer interrupts and just have that all run on top of your existing delay code, right? The timer interrupt can periodically swoop in, check the pattern control signals in whatever state they are in, logically AND the pattern control signals against its own PWM state, set the pins, and then exit the interrupt so the pattern control delays can keep doing their thing. \$\endgroup\$
    – DKNguyen
    Feb 12, 2021 at 18:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.