different colored LEDs in series(d'oh! I mean parallel)

I am working on a project with lots of LEDs, likely 100+, that need to be sort of individually controlled… The good thing is though that it’s very abstract so there can be lots of patterns. They will be arranged like streams coming out from a central point, and I just need to display little comet sort of patterns on them, shooting from the center. Each steam can be identical, and every 32 or so LEDs in each steam can repeat so ultimately I only need about 32(this number is not particularly important) differently controlled channels. To make things way easier I can just put each pattern in parallel with the others.

BUT! there will be different colored LEDs and they cannot be arranged in that same pattern, they will start with one color, then in the middle be another, then at the end be a third… Likely with some diffusion between the three, but still only the three separate colors.

So basically I just need to know everything that I need to known about putting different colored LEDs in series. I know that each color needs its own resistor so that’s at least 3x32 resistors. I was hoping that I could get resistors with enough wattage rating to power all of each color in each position alone, but I realize that it would probably end up being easier to use multiple resistors for each color for each position.

Also any additional help on switching this much power and PWM would also be helpful. I don’t think I need to bother with multiplexing with such few individual channels, but I’m not sure if I should use one transistor per position or spread the current between a few, or between the different colors or what. I just want to know how it ought to be done. Also what sort of IC could I use to get PWM and 32 channels. I know there’s one that’s meant for LED’s but since I’m going to be using transistors anyway I don’t want to spend extra on it.

I’ve attached an image a very basic idea of what I’m going for. However it wont be quite as simple. It wont just be one pattern per color, there will be many more streams and sets of patterns, and when the colors change, there will be a few intermittent back and forth for diffusion.

Thanks!

You can put several colors of LED in series as long as they all have the same maximum continuous current rating. For example if you had some LEDs that rated for 20 mA (continuous) and some rated for 35 mA (continuous) you can't run them in the same string without either overheating the 20 mA LED's (by running them at 35 mA) or running the 35 mA LED's at less than full brightness (by using 20 mA).

The supply voltage will have to be higher than the SUM of the voltage drops of all the LED's in a string.

I think that four 8-bit shift registers connected to the SPI pins will let you do software PWM on 32 channels easily enough. Each string of LED's will connect to one of the 32 output pins and each will need an NPN transistor that can handle the voltage and current as well as two resistors: one connecting the output pin to the transistor base and a current-limiting resistor to limit the current in the string to the maximum continuous current rating of the LED's.

johnwasser: The supply voltage will have to be higher than the SUM of the voltage drops of all the LED's in a string.

Could you explain that a little more? So If I'm having a red(1.7) yellow(2.2) and blue(3.5) I need to supply at least 7.4 volts, then my resistors need to account for the voltage drops from that voltage down to each LED color? Why it that? or have I got it wrong? It seems strange to me that, that would be the case because what if you had two blue LED's that were slightly different so one was 3.5 and the other was 3.4, just because of that difference you now have to double the supply?

stoopkid:

johnwasser: The supply voltage will have to be higher than the SUM of the voltage drops of all the LED's in a string.

Could you explain that a little more? So If I'm having a red(1.7) yellow(2.2) and blue(3.5) I need to supply at least 7.4 volts, then my resistors need to account for the voltage drops from that voltage down to each LED color? Why it that? or have I got it wrong? It seems strange to me that, that would be the case because what if you had two blue LED's that were slightly different so one was 3.5 and the other was 3.4, just because of that difference you now have to double the supply?

In that example, the voltage drop will be about 7.4v but may vary a little with the individual LEDs. One option for driving this string is to use a constant current supply (e.g. TLC5940 chip, which also does PWM), no series resistor, and a supply voltage sufficiently above 7.4v for the constant current supply to work (e.g. 9v would do if using the TLC5940). Alternatively, use a series resistor and a voltage that is sufficiently higher than 7.4v that the current variation if the 7.4v is not quite right is small enough. For example, use a 12v supply, and for 20mA LEDs calculate the resistor as (12 - 7.4)/0.020 ohms. You only need one series resistor per string of series-connected LEDs.

To make it easy for yourself, compose each string out of the same combination of LED colours; or it you can't do that, standardise on a few combinations, so that you don't have too many different voltage requirements to deal with.

Ok ok, now I feel stupid. I’ve been saying series this whole time meaning parallel. I have Bo clue why I was saying the exact opposite of what I mean…

Ugh so let me start over… I want to put them all parallel to eachother. Everything else is correct except for that ridiculous mistake. That was my confusion with the voltage drop thing.

So for anyone still putting up with me: any info for lots of different colored LEDs in parallel would be very appreciated.

Also is there a version of the TLC5940 that doesn’t have the high power rating and is cheaper? If all that extra cost is for power then it’s just a waste. Also I don’t need a very high resolution PWM at all.

stoopkid: So for anyone still putting up with me: any info for lots of different colored LEDs in parallel would be very appreciated.

You can't put LEDs directly in paralel, but if you give each LED its own series resistor, you can put several of those LED+resistor combinations in parallel.

stoopkid: Also is there a version of the TLC5940 that doesn't have the high power rating and is cheaper? If all that extra cost is for power then it's just a waste. Also I don't need a very high resolution PWM at all.

You could look at the ShiftPWM library. However, you are limited to 9mA current from each 74HC595 pin if you are using all 8 output pins. So to drive several LEDs from each pin, you will definitely need a buffer. Simplest solution is probably to pair each 75HC595 with a ULN2803.

Well say I have a few LEDs that are the same color and will always be on at the same time, with the same PWM levels at any time. Do they still need their own series resistors, or can I use one rated for at least as much power as they will all dissipate? Or is it always 1 resistor per sees no matter what?

Also if I'm switching the LEDs with transistors, do I still need a buffer? I won't be powering them strait from the 595.

For parallel LED's you need a separate current limiting resistor for each LED. If you just put two 20 mA LED's in parallel and supply the pair with 40 mA there is no way to be sure that half the current will go through each LED. If one gets too much it will have a shorter life. Also the other will get too little and will be dimmer than necessary.

If you want to run multiple LED's on one signal you will need fewer resistors and drivers if you put them in series rather than parallel.

Alright well then I’ll just put a resistor on each one… It will be tedious, but a lot easier than figuring out all the combinations and trying to adjust for each.

Can I at least power each channel with one single transistor that is rated for however many LEDs are on that channel?

How should I power something like that? 20mA * maybe 256 LEDs is like 5 amps… How do I supply and regulate that much power efficiently?

Luckily you won't have all of the lights running through a single transistor but divided among 32 (?) channels. That makes 8 (256/32) LED's per transistor or 160 mA if the LED's are 20 mA each. If you plan to have, for example, only five lit up at once you would only need a 800 mA power supply (call it 1 A). You can even get VERY clever and stagger the PWM pulses for the dimmed lights so that they are not all on at the same time. That would further reduce the maximum power requirement. Probably not worth the effort.

Should be easy to find a transistor that can handle 160 mA at whatever voltage you use.

If you use series strings of LED's the voltage requirement is higher but the current requirement is lower: 20 mA per transistor in the above example.

The thing is that it will be doing lots of stuff in addition to the trails... Probably anything I can think of, including flashing them all on at the same time, so at times, all of them will be at full brightness. This is ok, I can just get transistors rated for that.

My problem comes with the power supply. I figure I'll use a laptop power supply, that's the simplest thing I can think of for that much power. But what measures should I take to ensure consistent power regulation when I am switching so much on and off?

With that number of LED and using a laptop power supply giving maybe 19v, you'd be much better off putting LEDs in series rather than in parallel. The current consumption and heat dissipation will be much lower.

If you can keep the current down to 1A or so (which is easier to do if you connect LEDs in series), you will find that you can get an inexpensive regulated power supply producing 12v or 15v.

Ugh. ok well here’s my problem… I attached a very simplified version of what I’m going for. Just 1 arm, there’s likely to be 4, and shown with 8 channels instead of 32. As you can see the colors used on each channel wont quite be uniform. And the number of LED’s on each channel may not even be uniform. It is complex enough in this picture, but the real thing will be even more complicated. Not to mention with the branching there will be quite a few LED’s on each channel, enough for the voltage drop to add up a heck of a lot.

Am I just getting too complicated? Is parallel really out of the question, efficiency speaking? It would have been nice soldering all the grounds straight to the aluminum enclosure. Maybe everything in parallel but then the four arms could be in series?

OK, you've got more than 70 LEDs in that diagram, times 4 arms makes around 300 LEDs in total. Here are your options as I see them:

  1. LEDs in parallel. You'll need to put the series resistors next to the LEDs, so that you have 1 wire per channel going into each arm, plus a common supply wire. Otherwise you will have a huge number of wires going into the thing (i.e. one per LED, plus supply, which is >70 wires going into each arm).

A laptop power supply doesn't make sense because it provides too much voltage. What you need instead is a regulated 5v power supply. If you run the LEDs at 20mA each, that's 6A total when they are all on. Or 3A at 10mA. My local supplier (Maplin) sells a low cost 5v 3A regulated power supply, so two of those (i.e. each one driving 2 arms) would suffice. Or you could cut the current to 10mA per LED.

With 32 channels, each channel is driving about 10 LEDs, so 200mA. You can switch this using a transistor such as the BC337. So you need 32 x BC337 and 32 x base resistor. You could use ULN2803 drivers instead, but their saturation voltage at 200mA is rather high, so you'll need to increase the power supply to 6v if you do. You'll also need 300 LED series resistors.

  1. LEDs in series. If you put all 10 LEDs of each channel in series, you'll need around 40v to power them, which is not convenient unless you build your own power supply. However, if you put the LEDs in 2 of the arms in series, that's only about 5 LEDs in series per arm, so around 16v LED voltage drop maximum. You could use a 19v laptop supply and constant-current drivers to make the current independent of the LED configuration. Each constant current driver can be built from 2 transistors and 2 resistors. So that's 32 channels x 2 transistors, x 2 (because you need to duplicate it for the other 2 arms) = 128 transistors and 128 resistors. But you don't need any LED series resistors. The maximum current (at 20mA LED current) is 32 x 2 x 20mA = 1.28 A, which is well within the rating of a laptop power supply. Even an unregulated supply would do because of the constant current drivers.

Thank you both for all your help so far.

Simply because of the complication with the voltage drops between the different channels, I think Ill go with the first choice there. Each channel will have different numbers of different colors and it would require a lot of precision to keep all the channels the same brightness. So this is my plan:

  • 4 shift registers with the shift PWM library driving 32 BC337 through resistors.
  • All the LED anodes of each channel connected to one of the BC337 emitters, daisy chained to whichever LED is closest on the same channel, each LED connected through a resistor depending on its color, all LEDs running 10mA. BC337 collectors connected to 5v of sufficient amperage for however many LED’s there ends up being.
  • cathodes of all the LEDs soldered to the aluminum enclosure and the enclosure tied to ground (is this an ok way to sink power? It would make wiring easier and help with mounting)

I hope that I am understanding correctly and that this will work. Unfortunately I’d like to make it even a little more complicated, if you didn’t already hate me enough. IF it’s possible I’d like to add a few more channels, I guess 8 more with the whole extra shift register. Then those 8 channels will also be connected to those same LED,s but in a different configuration. Just a few of them in the center so in addition to this pattern I’m using I can also illuminate the center LED’s independently of the rest.

I hope that this will only require two things,1) diodes on each channel for each LED to separate the two channels, and 2) using the same shift register chain to do the PWM so that the two PWM signals work together rather than clashing and causing extra brightness. So two half brightness signals sync up rather than accidentally being opposite and causing full brightness.

That doesn’t seem too much more complicated to me, but please let me know if I am completely off base with that assumption. It’s quite likely that I have no clue what I am talking about.

stoopkid:
Simply because of the complication with the voltage drops between the different channels, I think Ill go with the first choice there. Each channel will have different numbers of different colors and it would require a lot of precision to keep all the channels the same brightness.

The constant current drivers I suggested would keep the channels all the same brightness. But they need a lot of transistors!

stoopkid:

  • 4 shift registers with the shift PWM library driving 32 BC337 through resistors.
  • All the LED anodes of each channel connected to one of the BC337 emitters, daisy chained to whichever LED is closest on the same channel, each LED connected through a resistor depending on its color, all LEDs running 10mA. BC337 collectors connected to 5v of sufficient amperage for however many LED’s there ends up being.

Sounds like you’re going for the emitter follower configuration, which isn’t such a good idea because of the voltage drop. If you want to ground the LED cathodes, then I suggest instead you use BC327 PNP transistors, emitter to +5v, collector to the LED/resistor elements, base to Arduino pin through a resistor. You’ll need to drive the shift register output LOW to turn the LEDs on. Alternatively, if you don’t mind a separate power wire to the LEDs, I suggest a 6v LED supply and ULN2803 octal drivers.

stoopkid:

  • cathodes of all the LEDs soldered to the aluminum enclosure and the enclosure tied to ground (is this an ok way to sink power? It would make wiring easier and help with mounting)

OK in principle, but you can’t solder to aluminium using normal techniques, it requires acid-cored solder I believe.

stoopkid:
I hope that I am understanding correctly and that this will work. Unfortunately I’d like to make it even a little more complicated, if you didn’t already hate me enough. IF it’s possible I’d like to add a few more channels, I guess 8 more with the whole extra shift register. Then those 8 channels will also be connected to those same LED,s but in a different configuration. Just a few of them in the center so in addition to this pattern I’m using I can also illuminate the center LED’s independently of the rest.

I hope that this will only require two things,1) diodes on each channel for each LED to separate the two channels, and 2) using the same shift register chain to do the PWM so that the two PWM signals work together rather than clashing and causing extra brightness. So two half brightness signals sync up rather than accidentally being opposite and causing full brightness.

That doesn’t seem too much more complicated to me, but please let me know if I am completely off base with that assumption. It’s quite likely that I have no clue what I am talking about.

Neither have I - I didn’t follow what you are proposing to do. You can easily add more channels by cascading additional shift registers. The ShiftPWM library gives you independent control of each shift register output.

I’ve attached what I mean with the extra channels driving the same, but different sets of LEDs. Basically I’m perfectly happy with everything running in patters, except for the very center bit. Referring to the image, I want to be able to have, say 3 at 33% 4 at 66% and 5 at 100%, but then also be able to have 1 2 and 3(just in the first set there) fade up and down without affecting 1 2 and 3 in the rest of the sets. I realize that those center ones will always duplicate the rest of the pattern, but I want to be able to brighten all the center ones in addition to whatever pattern is going on there. I hope it makes sense, I can get even more visual if it’s not making sense.

I don’t think this idea would work with the LED’s in series, but I feel like there should be no problem with them in parallel.

I don't feel that your pattern requirements offer any scope for simplifying your control circuit over being able to control every LED.

You're right, I'm getting tunnel vision. I'll just put the center ones on different channels.

dc42:

stoopkid: - 4 shift registers with the shift PWM library driving 32 BC337 through resistors. - All the LED anodes of each channel connected to one of the BC337 emitters, daisy chained to whichever LED is closest on the same channel, each LED connected through a resistor depending on its color, all LEDs running 10mA. BC337 collectors connected to 5v of sufficient amperage for however many LED's there ends up being.

Sounds like you're going for the emitter follower configuration, which isn't such a good idea because of the voltage drop. If you want to ground the LED cathodes, then I suggest instead you use BC327 PNP transistors, emitter to +5v, collector to the LED/resistor elements, base to Arduino pin through a resistor. You'll need to drive the shift register output LOW to turn the LEDs on. Alternatively, if you don't mind a separate power wire to the LEDs, I suggest a 6v LED supply and ULN2803 octal drivers.

Ok, so would it be better to give all the LEDs a common anode power supply and sink the LED groups' cathodes with the BC337? I'm still having trouble completely understanding NPN vs PNP beyond base high and base low...