1
\$\begingroup\$

I have some front panel with 30 LED inexpensive SMT LED diodes with diffrent colors.

I need to "feed" some of them with 15mA to get even brightness (they are rated for 20mA).

Normally, if I have just few LED diodes I drive them directly from microcontroller. Some PIC devices have 25mA capability per pin, but total current cannot exceed 200-300mA (I don't remember exactly), so I can't drive 30x15mA from PIC.

For now I'm using ULN2803A (controlled individually), but I'm looking for:

  • less expensive way
  • less pins without multiplexing

I have seen this idea with shift register:

How to drive 30 LEDs with a smaller amount of pins?

but 74HC595 datasheet says that is has only 6mA source/sink current.

\$\endgroup\$
11
  • 2
    \$\begingroup\$ Tip: the 'D' in 'LED' stands for 'diode'. You don't have to say Light Emitting Diode diode - but banks do the same thing with 'PIN number' (Personal Identification Number number) so you're in good company. \$\endgroup\$
    – Transistor
    Commented Jul 8, 2021 at 19:32
  • 2
    \$\begingroup\$ Can you post your current schematic? And how are you trying to control them? Chatlieplexing? Multiplexing? Individual? \$\endgroup\$
    – Passerby
    Commented Jul 8, 2021 at 19:34
  • 3
    \$\begingroup\$ Far better to assume nothing in engineering. Please detail your question with specifics, as @Passerby asked. You can easily draw a representative schematic of one channel and paste that. \$\endgroup\$
    – TonyM
    Commented Jul 8, 2021 at 20:05
  • 2
    \$\begingroup\$ What voltage are we using? Why don't you draw the quick representative schematic? \$\endgroup\$ Commented Jul 8, 2021 at 21:58
  • 2
    \$\begingroup\$ If your setup is a single led per pin, no multiplexing or anything, it's easy enough to say as much. Please edit your question to include that. Assuming you don't care about common cathode or anode wiring as well. And please add the source voltage being used for the leds. \$\endgroup\$
    – Passerby
    Commented Jul 9, 2021 at 4:42

5 Answers 5

2
\$\begingroup\$

I can't post specific product recommendations, but there are I/O expanders out there that will sink 40x 15mA simultaneously for less than $0.14/channel and with far more features than a ULN2803A.

\$\endgroup\$
7
  • \$\begingroup\$ Can you provide a link? \$\endgroup\$ Commented Jul 8, 2021 at 20:29
  • \$\begingroup\$ Product recommendations or links to specific products aren't allowed on the site, but if you search any of the major electronics retailers for "I/O expander", you can narrow down the results by number of I/O channels, current per channel, etc. The current limit for sinking is commonly higher than for sourcing so don't let that throw you off. \$\endgroup\$
    – vir
    Commented Jul 8, 2021 at 20:32
  • \$\begingroup\$ The chip I looked up had 40 channels, sinks up to 25mA per chan, uses i2c protocol, runs at 400KHz. And cost > $5 USD for 1. \$\endgroup\$ Commented Jul 8, 2021 at 21:55
  • 1
    \$\begingroup\$ Links to a purpose built or generic IC are okay. \$\endgroup\$
    – Passerby
    Commented Jul 9, 2021 at 4:39
  • 1
    \$\begingroup\$ Like we discourage questions just asking "what part can do x" or suggesting fully built commercial parts like "buy a router". But suggesting a part and category of similar parts is not prohibited. \$\endgroup\$
    – Passerby
    Commented Jul 9, 2021 at 4:55
2
\$\begingroup\$

The 40 pin PICs like the PIC16F18877 can go up to 350mA for the chip, and the 28 pin like the PIC16F18857 can do 250mA. You could use a pair of them slaved to your main MCU to drive the LEDs. Or reduce the current per LED a bit. For instance, 10mA would work out at 300mA which would be comfortably within the capability of a 40 pin PIC16F. Controlling them by one of the MCU interfaces (SPI or the UART) would be trivial.

\$\endgroup\$
2
\$\begingroup\$

To drive multiple leds with individual current or brightness needs, sounds like you need a led driver with individual led brightness control.

You could mess with rolling your own from microcontrollers or using discrete logic or using generic IO expanders, but don't recreate the wheel. Purpose built led display driver ICs can do what you want easily.

The TI TLC591116 https://www.ti.com/product/TLC59116 has 16 open collector outputs that can be individually controlled for brightness and fading, high voltage (17V) support, and a simple i2c interface so only 2 control pins. 2 of these can cover your entire board and you don't have to worry about current control as the dot correction feature can dim the ones you need to be dimmer to match the rest. Cheap too. But its just one of literal thousands of parts from TI or any major semiconductor manufacturer that can do exactly what you want. Others can do matrix support as well, fun lights applications like set and forget fading patterns etc. So start googling for led display driver ics.

\$\endgroup\$
1
\$\begingroup\$

This solution is all-discrete for minimized cost of parts. Of course, it will require more PCB space, and assembly time, but it's also simpler (no i2c, no clock required, etc.) The discrete transistors will take all of the heat off of your PIC microcontroller.

This is a kind of multiplexing -- 15 pins controlling 2 LED's each, and 2 more pins for the common which you will use to power on each group. So you'll set pins 1-15 for LED's 1-15, then turn on common1 by taking pin16 to V1. You'll leave them on for half the time (200ms?), then turn them off by setting pin16 to either GND or open. Then you'll set pins 1-15 for LED's 16-30, then turn on common2 by setting pin17 to V1. You'll leave them on for half the time, then turn them off by setting pin17 to either GND or open. Then repeat the whole process.

schematic part 1

and every next two LED's looks like this:

schematic part 2

The 140 ohm resistors are calculated for 100 % on time, so you'll probably have to set them more like about 70 ohms. R2, R7 are pullups, and R4,R9 are pull-downs, all of which may be optional depending on how you set the pins, and the quirks of your microcontroller. You may be able to get "digital" transistors with the pullups and base resistors integrated, possibly saving more money and/or board space. These Pre-Biased Bipolar PNP Transistor 50V 100mA 246mW SMT SOT-23-3 at Digikey are $3.60, 12 cents apiece in 30 qty, and include a 2.2K base resistor, and a 47K base-emitter resistor, integrated into the package, for frugality and assembly joy. At 100 qty, 7 cents apiece.

I would leave the 2N4401's discrete (and through-hole) so you can upgrade them if needed to a 2N2222 or TO-220 if heat is an issue (hot location, like a scoreboard). Heat shouldn't be an issue, though -- simulated and calculated as less than 100mW at each 2N4401.

\$\endgroup\$
1
  • \$\begingroup\$ A total of 17 pins used. \$\endgroup\$ Commented Jul 9, 2021 at 0:14
0
\$\begingroup\$

If you’re going to use relatively high current drivers then how about multiplexing the array; you might use 8 cathode connections with ULN2803A and then you’d need 4 high-side drivers, perhaps using discrete p-channel FETs. You’d be driving each LED at 25% on-time so would use a somewhat higher current (although anything above abs. max for the LEDs is at your own risk, of course). Tip: mux at high speed to minimise strobing and heat cycling of the LEDs.

\$\endgroup\$

Your Answer

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

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