For a LED 'matrix kind of' project I want to use UDN2981's for sourcing, and ULN2803's for sinking.
I want to use 5mm LEDs, being able to use 100 mA (10% duty cycle). Since the ULN2803 can handle 500 mA to one pin, I intend to connect 5 rows to each pin of a ULN2803, thus always exactly one pin is active, sinking (max) 5 LEDs of (max) 100 mA (and by using 15 rows, this means 3 ULN2803's).
However, I'm a bit confused about the UDN2981 as source. See sceenshots below of the UDN2981 datasheet, the first picture shows the features, the second the max current (page 14, bottom left picture).
Assume I want to drive 100 mA LEDs.
- according to the features I can drive 5 LEDs, but according to the other picture I can only drive 350 mA (recommended maximum output current). Which is right?
- According to the diagram, I can thus only drive 3 LEDs at 100 mA at once, with 3 LEDs at 100% duty cycle I have about 310 mA, thus just over 100 mA per led. But is it really not possible to drive move than 3 leds with this source driver IC?
(Someone opted in earlier question for a MAX7219 but dimming separate LEDs is very hard if not impossible). I could us 2N7000 mosfets, but I would think the UDN2981 would be better for this job (and cleaner/easier layout/soldering if I can use the UDN.). But the idea I need 5 UDN's for driving 5 * 3 = 15 columns seems strange.
Update (Project description)
What I want is a kind of 'galaxy' ceiling, like 1 x 2 yards or so.
- leds: around 100-150, initially thinking about 3mm leds, but found out 5mm leds are stronger, especially at a distance (to ceiling), the 5mm I ordered are 30 mA continuous, 100 mA peak (10% duty cycle). I plan to use the 100 mA way of driving.
- microcontroller: preferably STM32F103C8T6 dev board, 72 MHz, using CubeMX and HAL. Mostly for educational reasons and to start with a 'simpler' project.
- Multiplexing: I was thinking about driving 8-16 at the same time (columns), and using 10 rows (to make it easy to fulfill the 10% duty cycle)
- Dimming: I want leds to go gradually fade in and out, independent of each other, possibly with different speeds, but maybe also other patterns to be visible (all on/off, left to right etc).
- Colors: The majority of the leds should be white, but I also want to add other colors, I intend to make each color a different row (since the resistors will be placed per row, so I can use different resistor values depending on the forward voltage).
- Power: I want an external power source, somewhere between 5 and 12 V, depending on what the LEDs need, I use a wall adapter, so current is not a problem (16 leds x 100 mA = 1.6 A + a little bit for the microcontroller, so 2A should be ok, including a possible DC down converter to 5V to power the STM32
- Driver: I thought about UDN2981, using 2 of them for 16 columns, each driving 8, they can handle 100 mA each. Someone proposed a MAX7219, but this has complicated 'dimming' functionality (couldn't find a library for STM for it that controls dimming per led, not even for Arduino).
- Sink: Not sure, I can chose between 2N7000 (but I think these can only be used as driver), ULN2803 (problem is that 500 mA is max, so I need for each 5 rows (5 x 100 mA = 500 mA) 2 ULNs (16 columns / 8 col/ULN), totaling 6). I also could maybe use TIP120 transistors, or IRL540N).
- IR: Eventually I want to use an IR receiver to control the device
- Pins: Since the STM32F103 has enough pins, I can use 16 (max) pins for the rows and 8 for the columns.
- Shift registers: thought about using them, or even a CD4051 multiplexer, but since I have enough pins, it's not needed; besides using shift registers cost more time to send.
- Brightness levels: I was thinking about 10 brightness levels
- Speed: I want a frequency of 100 Hz, 10 brightness levels (going through each column), so a 1000 Hz cycle or 1 ms; using 10 columns, means 0.1 ms/column, 16 rows to set means 100 us / 16 = 6.25 us/column; so 'plenty' of time.
- Memory: I want to keep two 2-dimensional arrays in memory for 16x8 leds, alternating the arrays when one is updated (called double buffering afaik).
- Timer: I want to use one timer, and check what needs to be done (everything including 'PWM'ing and changing column/rows will be done 'manually' (mostly it's just one or more pins making high and low).
- Loop: In the loop of the program I want to check IR, and build/change the patterns; when a pattern is full, the double buffer will alternate to the other buffer.
(So my main question - so far - is what is best/easiest to use as source and sink for the LEDs (so far 2xUDN2981 will be ok for 16 rows), columns not sure yet.