multiplexing with pwm?

Check out this video from Collin's Lab: Make: - YouTube

It talks about some of the hardware you can use, and also the basics of multiplexing. Now, I don't know if with this you can control LEDs with PWM signal or with just ON/OFF signals, but it's worth a try.

The suggested hardware is kinda expensive, but, fortunately, the manufacturer (Maxim), gives away samples on their website. If after watching the video you want to try this out, you can order the hardware, free of charge, from Maxim's website.

Good luck.

Thanks for the link

I was looking at those Maxim drivers but didn't think any of them supported PWM. Am I wrong?

Nice to know about the free samples!

mrboni:
Thanks for the link

I was looking at those Maxim drivers but didn't think any of them supported PWM. Am I wrong?

Nice to know about the free samples!

Like I said, I'm not sure if they can run PWM signal, I have a couple but haven't used them (too busy burning Macbook's logic boards :S ). But in case you try it, post back with the results. I'm planning on using them on a future project, and would be nice if I could get PWM control.

Something else I remembered: you can try using an LED painter from Brillidea (http://www.brilldea.com/product_LEDPainter.html). It might be overkill, or it might be what you're looking for :slight_smile:

Maybe this can help:
http://arduino.cc/forum/index.php/topic,10097.0.html

mrboni:
What's the hardware used?

He is using the SPI port to send data to four 8-bit shift registers: Rows, Red, Green, Blue. He sets the color bits LOW and the Row bit HIGH to turn on LEDs in a specific row. The SPI Slave Select line goes to the Latch input of the serial-in, parallel out shift registers. When the Slave Select line goes HIGH the bits that were shifted into the shift register appear on the outputs.

The circuit diagram is shown here:
http://francisshanahan.com/index.php/2009/how-to-build-a-8x8x3-led-matrix-with-pwm-using-an-arduino/

And does this allow pwm for each led individually?

cheers

mrboni:
And does this allow pwm for each led individually?

Yes. You can set the brightness level for each of the 192 LEDs (88(R,G,B))

#define __rows 8
#define __leds_per_row 8
byte brightness_red[__leds_per_row][__rows]; 
byte brightness_green[__leds_per_row][__rows];
byte brightness_blue[__leds_per_row][__rows];

Great thank you.

I will try to get my head round this.

Have you made anything similar?

Ah, one quick question, is it possible to use something the ULN2003A on these pwm'd channels to drive high current leds?

Thanks

The ULN2003 will only sink current it will not source it.

Usable source driver arrays are: UDN2981A, TLC59213A (latched)

And if you're thinking about using that piece of code, please make sure you get the latest version. The one that was linked above is pretty old and a bit sub-optimal.

Also if you're interested in getting a decent level of brightness (good visibility in broad daylight), you'll definitely want a bit more than plain 595 chips, probably even dedicated constant current drivers. Saves you from using tons of resistors.

I don't really understand this - "The ULN2003 will only sink current it will not source it."

How are the UDN2981A and TLC59213A different from the ULN2003?

And given that I don't need a very large number of leds, and I dont need them arranged in a square array, would I be better off with something like the TLC5940?

And if so will this work with the UDN2981A or TLC59213A?

Thanks for being patient with my basic questions!
Will

mrboni:
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.

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 :slight_smile: 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

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?

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.

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.

"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!

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

but the same setup will should remain suitable..

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.

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

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!