HOWTO: Controlled Lighting of LEDs

Im trying to figure out all the ways to light up LEDs, particularly with microcontrollers.

I've experimented with a few ways, but so far, I havnt used any driver chips, just resistors and shift registers. I would like to learn about all the commonly used chips, and what they are good or not good at.

I have Itemized these factors

  1. single color LED

  2. RGB LEDs
    a)Common Anode
    b)Common Cathode
    c)LED order (RGBRGBRGB, or RRRGGGBBB)

  3. On/Off

  4. Pulse Width Modulation

  5. Voltage limited (resistored)

  6. Current limited (LED driver)

  7. current sink

  8. current source

And I've identified several LED drivers that I've seen postings about:

WS 2803/WS 2801
TLC 5940
AS1130
MAX7219

It seems to me, driving multiple LEDs can be grouped into 2 groups, shift registers + resistors, and LED drivers.

Shift registers seem the most versatile, they work with common anode, common cathode, single or RGB, or segmented displays, multiple inputs or outputs, and even non-LED things. They also seem to be the lowest cost solution. The only downside seems to be all the resistors you will need.

I havnt used any LED drivers yet, but they seem to be a bit more finicky about how you can use them. Driver chips seem to be common anode only. I think I did find chips that would work with common cathode, but for one reason or another, they were not suitable.

I would like to know more about LED driver chips, specifically ones that are supported on the arduino, and what chips are good for what specific instances (like maybe one one chip works good if you dont need PWM, with RGB LEDs, or works good with RGB, does PWM, but only works on common anode (TLC5940).)

I assumed current source meant that the chips controls + voltage, and current sink meant controls the ground, but then I read wikipedia, and am more confused, not less confused.

So, help me identify LED drivers, an the specific applications, limitations and benefits, and examples.

Asking a lot here for a forum answer, it is more like a chapter of a book you need.

  1. single color LED

  2. RGB LEDs

An RGB LED is just 3 LEDs, nothing special. Some (not all) have one connection common.

c)LED order (RGBRGBRGB, or RRRGGGBBB)

? - just depends on how you wire them up.

  1. Voltage limited (resistored)
  2. Current limited (LED driver)

No. 1) is not voltage limited, they are both current limited. Both attempt to produce a constant current in the LED. An active constant current output is what some, but not all, LED drivers have. Most that have constant current use a pull down constant current control because it is a lot cheaper to do this. This is what you call a common anode driver.

  1. current sink
  2. current source

Most drivers, even the ones that are not constant current use a current sink, again because it is easier / cheaper to do this. I know beginners don't like current sink but just get over it.

I would like to know more about LED driver chips,

So down load the data sheets and read all about them. There are many more than you mentioned. Go to a major distributor like Farnell, search on LED drivers and pick the ones you want to look at. The data sheet is available on line from them.

I assumed current source meant that the chips controls + voltage, and current sink meant controls the ground,

Yes if you want to think of it that way it will do as a working definition.

The MAX7219 also controls the multiplexing of a matrix in a way that many drivers do not.

Grumpy_Mike:
Asking a lot here for a forum answer, it is more like a chapter of a book you need.

  1. single color LED

  2. RGB LEDs

An RGB LED is just 3 LEDs, nothing special. Some (not all) have one connection common.

c)LED order (RGBRGBRGB, or RRRGGGBBB)

? - just depends on how you wire them up.

  1. Voltage limited (resistored)
  2. Current limited (LED driver)

No. 1) is not voltage limited, they are both current limited. Both attempt to produce a constant current in the LED. An active constant current output is what some, but not all, LED drivers have. Most that have constant current use a pull down constant current control because it is a lot cheaper to do this. This is what you call a common anode driver.

  1. current sink
  2. current source

Most drivers, even the ones that are not constant current use a current sink, again because it is easier / cheaper to do this. I know beginners don't like current sink but just get over it.

I would like to know more about LED driver chips,

So down load the data sheets and read all about them. There are many more than you mentioned. Go to a major distributor like Farnell, search on LED drivers and pick the ones you want to look at. The data sheet is available on line from them.

I assumed current source meant that the chips controls + voltage, and current sink meant controls the ground,

Yes if you want to think of it that way it will do as a working definition.

The MAX7219 also controls the multiplexing of a matrix in a way that many drivers do not.

So, for the scope of LEDs and microcontrollers, we can consider current source switching +5 on (or turn a pin high, or set to 1) all prettymuch the same thing, and current sinking switching to ground (or turn a pin low, or set to 0). also all prettymuch the same thing?

How would you group the driver chips? constant current (like TLC5940 ?), and not constant current (like shift registers ?) Or current sinking and current sourcing?

I suppose there is another category, where you use transistors to power columns or rows.

I looked over many datasheets, and there were perfectly good reasons to not use each and every one of them, but all that data is kinda mushed up into one big ball of not organized information. It would be nice to have a table that you could check off your needs, and get a list of viable solutions.

The max7219 is most suitable in multiplexing is exactly the kind of thing I would like to know about each of the driver chips mentioned, and not yet mentioned.

Does that chip control both source and sink, that sounds like another category all together.

How would you group the driver chips?

Voltage output - this includes source and sink.
PWM output - allowing variable brightness
Constant current - no resistors needed
Multiplexing - including matrix scanning and charliplexing.

Any one driver might have more than one of these elements in it. Plus there is the dimension of how the chip communicates with the computer.

Those all make good sense, thank you for explaining that.

Those could be converted into binary like:
Source =1, sink=0
PWM=1, NoPWM=0
CC=1, NoCC=0
Multi=1, NoMulti=0

It seems to me I could make a neat little table with those parameters, it would help figure out what would work good in different situations.
I should look up some example circuits with each to get a better idea.

Are there chips that source, but wont sink? my guess is that if it will source, it will also sink, but if it sinks, then it probably donent source also.

I also think that multiplexing is more of a feature, than a requirement. Most of the time we are multiplexing, but may not use a chip that has that feature. If you need to source, then you need a chip that will source current, but one that sources current, and multiplexes may be a better option.

Looking over datasheets and other documents, it seems there are a lot of factors, that make it harder. I was looking at the max 72xx chips, and It appears that they are not suitable for RGB, since they can only set one voltage output, and RGB LEDs need 2 or 3 voltages.

PWM is not as simple as yes or no, there is also how many levels of PWM (8bit, 12bit, ...)

There is also how many channels (how many LEDs does it control at one time), some are more.

TLC5940 Sink, no source, PWM (12bit), constant current, 16 channels. NoMulti.

MAX 72xx Sink, and source, no PWM, CC, multiplex, upto 64 LEDs (8x8, 8x7 segment, bar or panel)

74hc595 Sink, source, PWM(with shiftpwm), NoCC, 8 channel, NoMulti.

WS2801 Sink or source, PWM (not sure how many), controls 1 RGB LED, you use one chips per RGB LED, but chain many chips in a series. This seems most suitable for strips of LEDs that need to be indivdually controlled with PWM.

WS2803 Sink only, 18 channel PWM (8bit)/6 RGB 24bit. constant current or constant voltage. Common anode RGB only.

In addition to these features, I've also noticed things like protection circuits (like over current, or temperature, or no LED).

I've also found that there are a LOT of LED drivers made by many different companies, Its overwhelming.

Try eliminating all the chips that are expensive and/or not easy to get hold of on eBay.

The list will be an awful lot shorter...maybe five or six chips.

You could also include chips like LM3914 and AN6884 which can do multi-LED current regulation without the need to send serial data before they'll do anything (just take their input pin high and all the LEDs will turn on).

Are there chips that source, but wont sink?

Yes.
Also sometimes a chip's maximum source current is less than it's maximum sink current.

I also think that multiplexing is more of a feature, than a requirement

No you sometimes do not want to spend the processing power doing multiplexing or chalyplexing, so sometimes it is a requirement.

I was looking at the max 72xx chips, and It appears that they are not suitable for RGB, since they can only set one voltage output, and RGB LEDs need 2 or 3 voltages.

No you don't, you just multiplex the colours just like you multiplex the LEDs.

Its overwhelming.

Have to agree.

I've also found that there are a LOT of LED drivers made by many different companies,

Other than dot-matrix led drivers, most of those led drivers are meant to drive power led strings (vs. signal leds that most arduinos drive). They are for the most part dc/dc converters - as a matter of fact, you can simple take a dc/dc converter in place of those led drivers. You can simply think of those led drivers as a switch.