multiplexing with pwm?

Are there any options for multiplexing leds and being able to control the brightness of each led, like pwm?

I need to control about 20 leds brightness individually from one arduino

thanks

Here's an example of doing PWM on an 8x8 RGB LED matrix:

http://blog.spitzenpfeil.org/wordpress/wp-content/uploads/2008/10/matrix_code.pde

Thanks.

Possibly bit heavy for me currently but I'll try to digest it.

What's the hardware used?

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