Go Down

Topic: multiplexing with pwm? (Read 6234 times) previous topic - next topic

madworm

#15
May 19, 2011, 05:57 pm Last Edit: May 19, 2011, 06:00 pm by madworm Reason: 1

How are the UDN2981A and TLC59213A different from the ULN2003?


The ULN2003 and similar connect the cathodes of the LED to GND, current flows into this chip. The ones I mentioned connect the anodes of an LED to +, current flows out of these chips. You need the latter if you do multiplexing for turning on the active row/column.

If you just need a few LEDs, using a TLC5947 (24 pwm channels) or some of the MBI ones may be better.
• Upload doesn't work? Do a loop-back test.
• There's absolutely NO excuse for not having an ISP!
• Your AVR needs a brain surgery? Use the online FUSE calculator.
My projects: RGB LED matrix, RGB LED ring, various ATtiny gadgets...
• Microsoft is not the answer. It is the question, and the answer is NO!

mrboni

Ok, so, am I right in thinking that if multiplexing, you can't use a ULN2003 because you need to switch the leds at the anode end to be able to address each led in the matrix?



If I'm not multiplexing, (which I don't really need to given the smallish number of leds I'm using) and use a TLC5947 to drive the leds with pwm, does it make no difference whether I use a ULN2003 type or UDN2981A type?

If so which is best (simplest ideally :) and have you any links to info that will help get my head around the circuitry needed between the two (and the arduino)

Feel free to tell me to 'go search Google'!  There's just a lot of information out there..

Cheers

madworm

#17
May 19, 2011, 11:27 pm Last Edit: May 19, 2011, 11:32 pm by madworm Reason: 1

Ok, so, am I right in thinking that if multiplexing, you can't use a ULN2003 because you need to switch the leds at the anode end to be able to address each led in the matrix?


You can use it, but not alone. The ULN2003 can do the switching on the cathode side (with resistors and no integrated PWM). This is sufficient for just a single row btw. For two or more rows, you need one of the others to select which row is active by turning on the anodes.

Quote

If I'm not multiplexing, (which I don't really need to given the smallish number of leds I'm using) and use a TLC5947 to drive the leds with pwm, does it make no difference whether I use a ULN2003 type or UDN2981A type?


If you're not multiplexing, all you need is e.g. one or more of the 5947 chips. There is code for these chips on the macetech.com site. If you need the chips in DIP package, you'll have to use 5940, only 8 channels but there's a library for it as well.
• Upload doesn't work? Do a loop-back test.
• There's absolutely NO excuse for not having an ISP!
• Your AVR needs a brain surgery? Use the online FUSE calculator.
My projects: RGB LED matrix, RGB LED ring, various ATtiny gadgets...
• Microsoft is not the answer. It is the question, and the answer is NO!

mrboni

"If you're not multiplexing, all you need is e.g. one or more of the 5947 chips. There is code for these chips on the macetech.com site. If you need the chips in DIP package, you'll have to use 5940, only 8 channels but there's a library for it as well."

But as I plan to power a group of leds on each channel totalling around 400mA, I can use a UDN2981A on the outputs of the 5947 right? and the UDN2981A wont have a noticeable delay in switching low/high that will mess up the pwm?

getting there!

mrboni

actually, the total current per channel is more likely to be around 250mA peak

but the same setup will should remain suitable..

madworm

You know that if you don't wire the leds directly to the outputs of the 5940/47 you lose the current regulation and need resistors again...

250mA per channel is a very ambitious number for these small chips. Especially at high duty cycles they will get more than just warm... You'll need something more beefy for that.

If you can arrange your 'group of leds' to be wired in series so that N*Vf is about 1V smaller than your supply voltage, you can get away with linear constant current drivers (no inductor required). If the difference is much larger, these types easily fry. I did just that (not the frying...) with a board I built for lighting up my kitchen workspace. The leds are wired in series in groups of 4, the voltage needed to drive them is about 12V and the led drivers are fed with 13V. That way each chip can handle about 650mA spread over 8 channels. Each chip handles a cluster of 32 300mW leds. Quite bright. The chip I used is the MBI5168 (about 0.7$). It doesn't do pwm on its own, but you can dim all 8 channels with just one pwm pin of the arduino board.

You should first determine how much power you need to switch and then search for a suitable driver. Using just resistors is not a good idea at high currents, as you'd need precise and ridiculously low values. Pain in the arse. You can find nice led drivers on e.g. the 'national semiconductor' website.
• Upload doesn't work? Do a loop-back test.
• There's absolutely NO excuse for not having an ISP!
• Your AVR needs a brain surgery? Use the online FUSE calculator.
My projects: RGB LED matrix, RGB LED ring, various ATtiny gadgets...
• Microsoft is not the answer. It is the question, and the answer is NO!

My little board the Lightuino 5 (www.toastedcircuits.com) has 16 500mA voltage source drivers and 70 15-20mA constant current sinks.  You can definitely matrix + PWM them, I've done it with a set of 5 5x7 4" matrixes I got off ebay.  However, I doubt you could get 8 bits of intensity.  The most I tried, if I remember correctly, was 4.

Cheers!
Andrew
http://www.toastedcircuits.com Lightuino LED driver: 16 sources, 70 sinks, remote controlled.  Also high powered LED drivers.

mrboni

Thanks Andrew.

Your lightuino board looks like it would do the trick but I reckon it will be out of budget (at least it is functionally overspecified for this project). How much do you sell them for (including UK p&p if you have any idea) and what's the lead time?

It also seems that I may well need more than 16 channels. If not now then a little further down the line. Can you get >4 bits pwm when not multiplexing?


I'm getting a bit lost though. @Madworm -

but will the 5940/UDN2981A combo work for my needs, allowing for the fact that I will need to use a current limiting resistor on each channel, and it may be tricky to get perfectly matched brightness between channels?

It's crucial that i can do pwm on each channel and (I think) crucial that I can get at least >200ma per channel.

I'll have another look on the national semiconductor site. Last time I looked part of it wasn't working. Will chips from these guys be difficult to address from the arduino? A benefit of the 5940 is that there is already a library for it.

This is seeming like a more difficult job than I first imagined!

mrboni

This seems like their best multi channel chip - http://www.national.com/pf/LM/LM3464.html#Overview Only 4 channels :(

Also are smd so I would need an adapter for each one

Will be very expensive (£8 for each chip and £5 for each adapter = £52 for 16 channels!)

mrboni

Just came across this - http://www.jjoseph.org/misc_projects/high_power_rgb_led_controller


"To simplify the number of components, this design uses three TLC5940 outputs in parallel per LED color, achieving 360mA (3x120mA)"


Is it ok to do this (combine outputs so aggregating current?)

If not, surely I can just use two of these chips together, mirroring the outputs, each feeding seperate smaller led groups of 120ma taking me to my >200mA goal?

mrboni

Ok, seems that it's only wise to take around 30mA from each channel of the 5940 -
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1238693450


Some interesting discussion there though


So it seems ok to use something like UDN2981A or a mosfet on the output of 5940, I just will miss out the benefits of constant current, meaning more fiddling around matching leds and limiting resistors, but with the benefit of a well documented arduino library, easy availability, and low cost?


:)

Grumpy_Mike

Quote

Some interesting discussion there though

So you understand you will not be able to turn the LEDs fully off if you do this.

mrboni

No?!  I don't.  Arrgh

Why?

Grumpy_Mike

Because as was mentioned in that thread, the TLC5940 doesn't turn an LED fully on, it only gives 4095 on to 1 off. You don't notice this for full brightness because you can't see it. When you invert this then it doesn't go fully off it gives you one on pulse in 4096. You do see this.
So the trick is not to invert the signal and so you have to put another layer of buffering or arrange non inverting buffering.

mrboni

Right, I get you.


So either I use something non inverting like this - http://docs-europe.electrocomponents.com/webdocs/0608/0900766b80608e30.pdf

or I need to invert the signal again. What's the best way to invert (cheaply and) without amplifying again?


How can I tell if this is inverting or not? - http://docs-europe.electrocomponents.com/webdocs/0b87/0900766b80b878b6.pdf

And another question - with any transistor setup, how can I tell what input current will give me what output current? Ie how much amplification is taking place


Thanks Grumpy


Go Up