Go Down

Topic: using Uno to multiplex 200 common-cathode RGB LEDs, not sure about resistors (Read 6014 times) previous topic - next topic

atoi

So I'm trying to rig this up the best way possible, but I think I'm getting a bit mixed up about a couple things (I'm pretty new to this stuff). I had a friend tell me that if I cascade the shift registers in this project (595s) I could get away with using a single 10k pullup resistor for the entire project, and a 2.2k resistor connected to each shift register. I've seen people use one resistor per anode, or even just one on the common cathode, but I've only seen maybe one case of someone doing it this way, so I'm a bit confused.

Soldering a 330 ohm resistor to each anode seems like a massive undertaking, so I certainly don't want to commit to that route unless I have to. I've looked at probably 30 different schematics, but my lack of experience and knowledge makes it tricky to judge their quality. Can anyone give me a nudge in the right direction?

Thanks!

Grumpy_Mike

Quote
I had a friend tell me that if I cascade the shift registers in this project (595s) I could get away with using a single 10k pullup resistor for the entire project, and a 2.2k resistor connected to each shift register.


Time to change friends. he is talking rubbish. You always need some form of current limiting circuit and a resistor is the simplest. You need one in each anode.

Hear is why:-
http://www.thebox.myzen.co.uk/Tutorial/LEDs.html

atoi

Thanks, you may have saved my board! I assume he was planning on limiting the current going to the shift registers, and thus limit the current leaving them and going to the LEDs, correct? And what about the schematics that use the LED on the cathode?

I guess I'll have to buy 600 330 ohm resistors. I better get ready to spend a few weeks soldering.

P.S: Your posts have been a result in virtually every Google search I've done on this subject, and they're always helpful and well-written. I just wanted you to know how much I appreciate all the help you've provided.

Grumpy_Mike


Thanks for those kind words.

Quote
and thus limit the current leaving them and going to the LEDs, correct?

Well it's a theory, rubbish but a theory.

Quote
And what about the schematics that use the LED on the cathode?

If you just have one resistor in the cathode the voltage drop across it will depend on how many of the other LEDs are on. So say you turn on the red, then the green, the brightness of the red will drop and the green will com on not so bright. When you turn the red off the green will be brighter. Is that what you want to happen?

By the way if you only turn the LEDs on an off in an RGB LED you only get 7 colours, again is that what you want?

dc42


I guess I'll have to buy 600 330 ohm resistors. I better get ready to spend a few weeks soldering.


If you're building your system on a stripboard or pcb, you may prefer to use resistor networks instead, e.g. 75 of these http://uk.rs-online.com/web/p/networks-arrays/6253991/.

You mentioned multiplexing, but you haven't given any details. If you really are multiplexing the LEDs, then you will have the anodes of several LEDs connected together and only one of the corresponding cathodes will be driven low at any one time. In this case, you only need one resistor per bunch of connected anodes, not one per anode.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

atoi

Quote

If you really are multiplexing the LEDs, then you will have the anodes of several LEDs connected together and only one of the corresponding cathodes will be driven low at any one time. In this case, you only need one resistor per bunch of connected anodes, not one per anode.


I'll have to look into that. At the moment I don't see any downside to multiplexing at all, just seems like the commonsense route. Anyway, I'm thinking the ShiftOut example can provide most of the basic information I need at this point.

Thanks again for answering my questions so thoroughly, and I'm sorry if they've been asked before.

dc42


At the moment I don't see any downside to multiplexing at all, just seems like the commonsense route. Anyway, I'm thinking the ShiftOut example can provide most of the basic information I need at this point.


The downsides to multiplexing LEDs are:

1. The processor has to regularly do work and change the values on its output pins and in the shift registers to keep the display refreshed. This isn't difficult, but is more software to write.

2. The maximum brightness you can achieve is lower, especially if you are being cautious and running the LEDs at no more than their maximum continuous rating (which is a good idea during development in case the multiplexing software stops working).

The upside is lower component count. For example, to drive all 200 LEDs independently, you current need enough shift registers to provide 600 outputs, and 600 resistors. If you multiplexed them as 5 rows of 40 LEDs each, you would need enough shift registers to provide 120 outputs, and 120 series resistors, along with 5 row drivers.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

marklar

It is important to know if you only need 7 colors from the RGB or do you need to mix colors to create a wider array of colors.  If you only need 7 colors then you only need on/off for each "frame".  If you want to mix color, you have to create a software PWM mechanism where you manually turn the LEDs on and off real fast and POV mixes the colors.  I implemented PWM for 44 LEDs multiplexed x2 but I don't think that would scale up to 200 LEDs.  You may be able to run 200 LEDs with 595 chips but know your limits.  Don't assume what you build with 10 LEDs will scale up to 200 .. work up slow.  If what you really want in the end is lots of colors (i.e. cycle through the hue smooth) then you may want to consider another chips like the TLC5940/41 chips.   

Understand power needs - 200 RGB LED will need a 60watt power supply at 5v. 

When you look at the price of 200 LEDs on e-bay, it is easy to say - oh I want 1000.  When you add up what is really takes in time and money - most people end up scaling back by an order of magnitude.  So if you have to scale back your project - know your in good company :)


milamber

I am using a library recently posted here in the forums (ShiftMatrix) to run a 48x16 LED matrix. When applied to a RGB matrix this becomes 16x16, as RGB LED's have 3 actual LED's inside the one body(so 48 / 3 = 16). This is 265 individual RGB control with 32 levels of brightness per each channel (Eg. 32x32x32, R G B). This will give you lots of colors. This is all achieved with shift registers and some transistors. Check it out. The library is very easy to use.

Also as far as I can tell using a Matrix will save on power consumption as you will only have one row or column on at a time. So only one set of lights across the panel actually has power at any one point. For the matrix I describe that would be 48 x 20mA = 960mA for the LEDs plus some more for the Arduino and the Shift Registers. Would still be under 1.5A, at 5v that would be 7.5watts(at most).

This is just one other way it could be achieved. See what works well for you.

Grumpy_Mike

Quote
using a Matrix will save on power consumption as you will only have one row or column on at a time.

But the price you pay is that they are dimmer. To a first approximation there is no power saving over a multiplexed matrix and all the LEDs being on at the same time running a current that will give you the lower brightness.

atoi

This has given me a lot to think about. Time and money aren't really limiting factors at the moment (my wife is being *very* patient :P), so my only major concern is doing things correctly. With that said, I'm actually working on two arrays concurrently. The other is a 7x21 matrix of red LEDs, and I think the multiplexing method would work much better for those, since it's basically just a glorified scrolling marquee.

I think for the RGB array I'll stick to individually addressing anodes, since both brightness and color resolution are going to be significant factors. The animations will also be much more complex, and reducing software complexity a little will save some time. I'm a software developer by trade, so I'm sure I can manage enough abstraction to make things develop somewhat smoothly.

Another issue I didn't think was worth mentioning was that these displays will actually be mounted to two helmet visors, so being able to see through them (and thus, reducing the number of wires and components) is a consideration.

Power is another issue I had been avoiding until I had a finalized schematic in mind, but I suppose I should have been considering it. I don't expect that 5v will probably be enough in the end, but I really haven't even scratched the surface of that.

Grumpy_Mike

Quote
I'm a software developer by trade, so I'm sure I can manage enough abstraction to make things develop somewhat smoothly.


Well a lot of 'professional' software people I have known abstract things to such an extent that they don't work, this is because they assume that CPU cycles and memory are infinite. Embedded programming sometimes means you have to do things to save memory and increase speed that you would not consider on a desktop machine.

My favorite gripe is the multy levels of subroutines that in the end only return the number you sent it.

marklar

Quote
expect that 5v will probably be enough in the end

5v is the voltage and is not a limiting factor - in fact you will most likely want 5v.  What would not be enough would be current, such as in the case of trying to run too many LEDs from the regulator on your arduino board or worse through pins. 

If you want to wear the helmet then you will need to run on a battery.  You could use a good sized but fairly expensive lithium ion battery pack for an iPOD as long as it has 1.2amps (1200ma) or higher output.  The plus with this setup is it is small and can be used to charge your phone / ipod, etc - when not wearing the helmet.

When you are running on non-battery power - you will still need an external power source.  If you are running 60 leds then that need 20ma each will be 1.2 amps.  This is more than you want to run from either your arduino regulator or the USB provided power so you will need external power - a DLink 5v power supply is a commonly used item for external power. 

As for how you do this electronically - I stopped soldering chips or using 595/TLC chips a while back so I'll leave the chip selection / wiring assistance for people that more into that aspect of your project.  I assume you don't want to "cheat" and use a pre-soldered solution with chips built in .. because that would be no challenge at all and you won't learn much in the way of electronics.

Best of luck.

brucethehoon


atoi


a DLink 5v power supply is a commonly used item for external power. 


Thanks for clearing things up for me. That sounds like it'd work really well. I'll see if I can pick one up locally and play around with it tonight. I'm (clearly) still working on basic comprehension here. If I'm understanding you correctly, then if my LEDs each required 20ma I'd need 4 amps available. That's a pretty heavy load. That seems to imply that if I use virtually any standard non-rechargeable batteries I'm going to be switching them out after a couple hours. So am I off base in assuming that if I (hypothetically) used a 9 volt battery and limited the current with resistors, the battery would last longer than it would without the resistors? If so it might make sense for me to rig up a set of those in parallel. I guess there's no reason I couldn't just use a series of 1.5v batteries instead... I've got some reading to do :).


Appropriate?
http://www.elcojacobs.com/shiftpwm/


Very! Thank you so much! I don't know how I managed to miss that when I was doing my research. That should shave a day or two off the project!

Go Up