LED brightness control

Do you need to change the brightness? If you merely need to set different brightnesses for each (and experimentation is possible) try resistors.

If you want something controllable, a small microcontroller using software PWM (so you can use all the output pins, not just those with hardware timers) could make sense.

Reply to
cs_posting
Loading thread data ...

Is there any chip that can be used to drive several LEDs at different brightnesses. They all need to run all at a different brightnesses. I'm looking to drive 3 or 4 RGB LEDs, so I probably need 9 to 12 PWM outputs. Preferably I need a small interface with not too many wires. I was thinking to use a UTP cable (8 wires) for control.

I do seem to find the PCA953x and they don't exactly seem to fullfil my requirements, unfortunally. What would be a good solution to this problem?

- Joris

Reply to
Joris Dobbelsteen

Hello Joris,

Why not? The PCA9532 does pretty much anything in your above list and the interface is even simpler. What I don't like about it is that it still needs resistors from each LED. So I am probably going with the Texas TLC5923. But this one won't work for you as it can't do individual brightness control via PWM.

Regards, Joerg

formatting link

Reply to
Joerg

Hello Joris,

Read the data sheet again. IIRC the PCA9532 allows 8-bit precision and thus 256 brightness levels. Don't mix this up with its two modes. It can also switch to a blinking mode but that doesn't have much to do with the dimming part.

Here Philips came really close to a dream chip but not quite. I don't understand why they didn't put it in a package with thermal pads and include current sources like TI did with theirs.

Yes, if you have enough free port pins there would be no reason to use a separate LED driver chip. Unless it was one that also did away with all those series resistors.

Regards, Joerg

formatting link

Reply to
Joerg

Indeed, almost, but I cannot control the LED to fine, only with 2-bit precision (doing it a little tricky might get a little bit more), but its not very fine control. Basically I get just 32 colors and with some harsh limitations I some more. I was looking for a finer control...

The currently suggested solution was actually pretty easy. Using a processor you don't really need PWM, you can do it in software too. So with enough outputs I can control sufficient LEDs. Most processors will have at least 16 outputs. That would be sufficient for even larger number of LEDs that I currently need.

Thanks for your input on the subject.

- Joris

Reply to
Joris Dobbelsteen

What I mean was that I cannot control all the LEDs *individually* with a good granuarity.. I could fiddle arround switching the PWM and modes in some creative manner to get some more control, but if I connect a RGB LED I cannot generate the full RGB spectrum.

The two PWM generators just can be used for dimming and blinking, but I can only dim two leds, not three. And I want some more. I would need (almost) as many PWM generators as outputs...

This is unless I am seriously missreading...

Indeed, but I was looking for a complex solution, instead the simple solution was way to simple...... relocating the microprocessor does the job. If you can't find something there are two possibilities: (a) its right under your nose or (b) its really for away. In this it would be (a) ...

- Joris

Reply to
Joris Dobbelsteen

Hello Joris,

Sorry, but I'd suggest reading it again. IIRC the PCF9532 does provide you with two PWMs for _each_ LED output. That means you'd get 32 PWMs for about a buck fifty. Not bad. This chip is explicitly advertised for RGB applications where individual fine tuning may be required.

Yep. Just had one of those myself. I was pounding out coefficients for digital filtering on a little HP calculator. Then I remembered that I had bought a couple DOS programs for exactly that purpose in the early

90's. Aha. A few minutes of digging through binders and now the PC can do the job so I can sit back and polish off all the leftover Halloween candy.

Regards, Joerg

formatting link

Reply to
Joerg

Hello Joris,

Me, too ;-)

Well, yes, the control register is to address each LED. You can set it to auto-increment when you want to write all of their PWM registers sequentially. If you want to write just to the PWM of one particular LED then address it directly.

After you wrote to all of the PWM registers or at least to the ones where you have LEDs connected you can then switch each LED to its own

256bit PWM, to the slow blink, to full on or to off.

At least that's how I understand it and this would corroborate what they state on page 2 "...blink rates / duty cycles for each individual PWM".

After all the individual PWMs had been programmed, IIUC.

Maybe a day to finish by popping the cork on a nice bottle of Trappiste or Chimay ;-)

Regards, Joerg

formatting link

Reply to
Joerg

Are you really sure? I'm seeing this:

formatting link

I see page 2 mention what you say, but looking through the remainder of the specification I don't actually see this to be true...

Hitting page 5 of the spec: i2c addressing: 4 fixed bits, 3 selectable (with external pins) and the R/!W flag. So I can put 12 devices on my board... Next byte: Control register. There's a nice table on the right side:

- 2 input registers are not even remotely interesting...

- 2 prescaler/PWM module (resp PWM0 and PWM1).

- 4 registers to control 16 LEDs.

Page 6: bottom: each individual LED can be configured at:

- Off

- On

- PWM0 blink rate

- PWM1 blink rate

Sorry, but I believe you interpreted it incorrectly. I can't discover more than two PWM modules. Maybe you can point me to that...

At least right on time... Doesn't look like my current day

- Joris

Reply to
Joris Dobbelsteen

formatting link

That's good for starting...

I believe you interpret this incorrect. Increment means the next register (so next register number) is written. Otherwise they would have made some really strange device, if you have to program all the PWMs just to modify a single one.

So I'm sure you interpreted it wrong here. If you read somewhere further down you see an example of using the 'auto-increment' function, which just traverses the registers you see listed. That would be page 11 actually.

Probably some marketing dude interfered with it, because it is possible, but in a limited way.

I'm seeing I'm doing well. That's usually the result of me doing multiple things at the same time. It had it twice today that someone called me to inform that I had a meeting. I had 3 meetings totally today. Looking at my time zone, it looks more like starting it with some alfa, leffe or hoegaarden (some good dutch beer).

- Joris

Reply to
Joris Dobbelsteen

Hello Joris,

You don't have to program them all, IIUC. Say you'd like to set LED3 from 212 to 196. It starts at LED0, then you increment once, twice and at the third increment you are at LED3 which you can then change. The others you'd just leave alone because they didn't need to be changed.

Well, I am not a programmer. But the example on page 11 shows that this chip seems to be able do what you originally wanted to do, to set the brightness level of each LED individually. The exact order of code needs to be gleaned from the data sheet and that takes more time than just a brief look. The uC can feed it whatever sermon the data sheet says it wants to get to the desired register.

Easy on the marketeers. I am married to one...

But what's limited here? If it has 16 fast PMWs and another 16 slow PWMs and all can be individually programmed, what more do you want? Ok, the chip needs series resistors for the LEDs which ain't so nice. Probably they didn't want to spring for the thermo-package. And it's over a Dollar which doesn't sound too great if you can upgrade the uC to one with enough extra port pins for less. But you'd have to check whether the uC can really stomach the LED currents at the port pins. Some are spec'd as wimpy, like the MSP430 with 2mA (where everybody knows it can do a lot more...).

There is one issue that causes me to be cautious with some of the specialty chips from EU companies. I have seen too many of them vanish into lalaland. Then the purchasing manager comes running down the hallway all red in the face.

Hah, I am self employed. Not many meetings, usually :-)

Hoegaarden is nice. You could chase it with a Beerenburger. But leave the car keys for the night, don't drive.

Groetjes, Joerg

formatting link

Reply to
Joerg

No that's not the way it works. You have 8 registers. When you have written data the the register 2 (PWM 0 prescaler) you can program register 3 (PWM0 register) without doing a second I2C transaction.This means some less overhead on the bus.

It's mostly to efficiently write to the 16 LEDs with just 1 transaction instead of 4. It speeds up transfers by factor 3.

I am one...

Yes, but in a too limited way for my application. I have to little resolution this way.

I know, I'm fully aware of the technical details of the protocols involved. I stuffied it quite toroughly at this point.

Don't get offended and hopefully your wife doesn't too. I mean the writer of the datasheet made it sound a little nicer than it actually is.

  • 16 LED drivers (on, off, blinking at programmable rate) Ok, it can do that. It has 16 pins to drive LEDs and each led can be on, off or blinking
  • 2 selectable fully progrmmable blink rates Indeed, it can do that... I don't know why something should blink at 152 Hz? Probably it will be the dimmer.
  • 256 brightness steps. Yes, we have 2 8-bit PWMs. So when blinking at 152 Hz we effectively have
256 brightness steps.

  • The PCA9532 is a 16-bit I2C bus and SMBus I/O expander optimized for dimming LEDs in 256 discrete steps for RGB color mixing and back light applications. This is a potential application, lacking any specific information how they have this in mind. Maybe they use more components...

So its true what they say here.

The "if" is the limit, it only has 2 PWM generators. Next the 2 PWMs are the same, they both have a prescaler to select the speed, so they can be run at any frequency, both fast or slow.

Do believe me, I've used PWMs on more occasions. It would be stupid to have

32 PWMs for 16 outputs.

That's the electronics side, probably your expertise. I only have some very basic knowledge of it. Unfortuanlly the LED driver will not be able to source the 100 mA I have in mind. So the 25 mA falls a little short indeed.

Not a concern for this project, as I only have to make a single one of it.

Well, I'm still a student. But usually project require a lot of time only for communication and such thinks take a lot of time. For some reason you need to see people personally in order to get some real decisions made.

I always do. Two nights a ago I took the train and had some (and some more) beers...

Groeten ;)

- Joris

Reply to
Joris Dobbelsteen

Hello Joris,

8bit is too little? Wow. Got a tough requirement spec there.

I didn't study it too long but my impression is they do have a set of PWM for each LED. If this chip would help you if it did, I'd call the guys in Eindhoven and ask.

A large number of PWMs isn't stupid. The highest number I did was 32 on one circuit board to be able to fine tune the output amplitude of a pulser bank. It was for what us RF guys call apodization, signal folks would call it windowing. Before they had done that with regulators which was ok in winter because it generated a lot of heat. But not in summer ;-)

I guess then the uC solution looks even more attractive because you are going to need an extra transistor per channel anyway. A BSS123 comes to mind, being cheap, but it depends on your VCC level. Being a cheapskate I'd probably go bipolar plus base resistor to shave off 2-3 pennies per channel. Well, and a resistor for the LED.

With one big 'if': You have to be able to actually get a few chips. Just tried that with one EU semi company and got a bloody nose. Won't do it again soon ...

Communications is most important, yes. I chose a rather difficult final project, building a CCD camera plus a VME interface from scratch. Wanted a real challenge. It used the old Philips NXA sensor and I just had to beat the performance of their camera for sports (and I did). First thing I asked at the institute was what the budget for this project was. Hmmmph .... nobody had ever asked that before. Which blew my mind. So they set it at 2000DM (when there still was HFL and DM). I spent a third of that on communication such as phone calls and telex, no email in them days. That resulted in an immediate scolding. In the end I stayed under the total but obviously that wasn't the way universities think. The other thing that made them really nervous was that I only had paper to show many months into the project. But then building it took just a month.

In Zuid Limburg there is no train from Maastricht to Vaals and the buses didn't run late at night. So I took the bicycle to meet friends in a pub. On the way home it was a straight stretch of about 20 miles so I put it in 10th gear and 'floored it'. The stretch is mostly straight except for a wee detour around some trees near Margraten. A detour which I missed ...

Regards, Joerg

formatting link

Reply to
Joerg

Mistyped, meaning too little fine tuning possible. I want the full RGB spectrum. Though currently I'm in doubt I will really need it anyways. However the uC does provide a simpler solution. I recon it isn't possible witht the chip, you say its easily doable...

Like I sayed, they didn't...

But thats for more complex things, not something like driving a visible LED. I could accompany 12 channels with 5-bit resolution at 100 Hz in software using 1.4 MHz, leaving 95% CPU time to other things. The chip will go up to

16 MHz, so I can easily do much better, if its needed.

Well, I got to get a lot more than a simple resistor. I was planning on maybe driving those Lumileds Luxeon III LEDs. They only need about 1.4 Amps each, so that would do very nicely I guess. I'm not planning looking into the LED.....

Well I usually like a good challenge too. Unfortunally I'm usually prone to making something at bit more complex than required. I once saw a design flaw in software that required the hole thing to be largely rewritten. A good learning point was to give some extensive comparison of the current and changed situation. The decision was taken to go with the current design, was the flaw was very minor... Only, the guy who wrote the spec didn't think of it that way. Afterwards the quirk was solved in a dirty way.

Its one of the many projects I'm doing. For most it is that we see eachother quite unregular. Some only 2 or 3 hours a week, which is way to less if you are sorta coworkers. Many of my previous projects we where busy together a full day, that was dedicated to it. That works a lot better and allows much better interaction.

I was lucky enough to stay in Eindhoven with a friend of mine, get to bed late and get up early (unfortuanally)... The latest bus I could catch would be 21:00 (taking the train on 20:30), which isn't much fun...

Well, I had a bike. That was, I parked it in Eindhoven once at a not so good location. Currently I'm unaware of its whereabouts... That also messed up my plan to take the bike each morning instead of the bus. And currently restricts me to the times the bus actually drives, or take a 10 km walk (which is quite long in the middle of the might)

You actually lived in the Netherlands and moved away or came only temporary to here? I'm currently in Noord Brabant, though I sometimes see Limburg, but I would only rarely get further than Weert. Being in Weert you probably know the brand Brand too ;)

Anyways much thanks for you advice and keeping the discussion alive.... ;)

- Joris

Reply to
Joris Dobbelsteen

Hello Joris,

Not if 8 bits isn't enough fine tuning.

You could almost double that number of bits by doing two PWMs per LED and combining that resistively (current summing). With a large LED that would also require two driving transistors, one large and one small.

Wow. Guess that'll be one big FET. Just make sure your micro can swing its gate capacitance fast enough without letting off puffs of smoke.

It can work. There is one long term client that I have only seen once in over 10 years. And that was only because his boss wanted to see who 'this guy' (me) is.

I had one bicycle stolen in Vaals. But that didn't deter me. I just kept the next ones as ugly as could be and nobody would want to steal them. They usually died by wearing out or because some tree was in the way. When I did a contract job at a larger company I found that it is good not to ride a blue or green bicycle in NL. Mine was yellow back then so I always found it with ease among several thousand others.

I lived there many years. Also in Germany and now in the US.

Hmm ... don't remember that one. But I am not too much of a deep-rooted person when it comes to what I call 'home'. When living in NL I spent a lot of my time at a Belgian sports club. Which meant that my Dutch wasn't very understandable further north ;-)

What really cracked me up was when a friend and I were listening to Urbanus and laughing so hard while the folks from all the other Dutch places didn't get most of his jokes.

Regards, Joerg

formatting link

Reply to
Joerg

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.