Shop OBEX P1 Docs P2 Docs Learn Events
LED Multiplexing... — Parallax Forums

LED Multiplexing...

Tim-MTim-M Posts: 522
edited 2008-08-21 17:23 in General Discussion
Hi All,

I'm looking for a bit of advice or experience regarding multiplexing LEDs on a Halloween costume for this fall. I think the project will be BS2 based and involve about 500 LEDs.

I'd like to use serial multiplexing ICs to simplify wiring and control code... something like AllegroMicro's UCN5833A which was discontinued in '05.

UCN5833A info. here:
http://www.allegromicro.com/en/Products/Part_Numbers/5833/

AllegroMicro also has the A6832 and A6833 devices as seen here:
http://www.allegromicro.com/en/Products/Applications/Lighting/displays_and_signage.asp

These are just my first thoughts... do any of you have advice for control of 500 LEDs? I'd settle for simple on/off control but dimming (PWM?) would be ideal.

Thanks,

Tim

Edit: I don't have alot of serial communication experience myself, so I'm wondering if there are issues or concerns with sending out strings as large as 32 bits at a time with a BS2, or if another/better way is recommended to get the job done.

Post Edited (Tim-M) : 8/20/2008 4:35:34 AM GMT

Comments

  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2008-08-20 13:05
    Well, everything usually starts with 8 because of 8 bits in a byte. So you might be looking at 512 Leds for a 16x64 matrix of one color.

    First you usually get a prefabricated 8X8 matrix which is equal to 64 leds. With proper power driver, you can use an SX28 or SX48 to do most anything you would like as a banner with dozens of these. You could have 8, 16, 24, or 32 led columns and endless length.

    You cannot send 32bits at a time to the BasicStamp as it is an 8-bit processor. The Allegro is a nice chip, but it isn't the only way to build a panel. You can send four consecutive bytes. If you really want 32bit processing, the Propeller is a 32-bit processor. 8 bit processing is usually done with having several 8-bit latches setting up a column of 8, 16, 24, or 32 LEDs to be powered on all at once. That is the multiplexing that one has to use.

    Multiplexing has two issues - the handling of the data AND the management of powering all the LEDs to appear seamless in their display. So far, your scheme is a bit vague. Are the 500 LEDs going to be in one panel or are you going to have clusters of LEDs located in many different places and things that are activated by triggers?

    And why do you want or think you need serial communication? Or did you just see that the Allegro was a serial shift register?

    Are you going to have a PC programed to feed data to the display in real time? If so, you have to program the PC as well. It might be easier to load whole images in large EEPROMs and forget using a PC.

    The outcome is only as good as the details of the initial plan. And the plan should include a budget or you may just find it all too expensive.

    Also, if you want a panel - how many colors and which colors? Here in Taiwan I see a lot of three color panels, but since they are Red, Green, and Yellow they really don't appeal to me. I would like a richer choice of colors and suppose that these panels were originally made for traffic control.

    Finally, if you really want a panel -- you may be able to buy one second hand for far less than the cost of building one from scratch. Cash always comes into play. I have been wanting a 16x16 matrix for quite some time, but only recently found a kit for $33 USD. It works fine, but the microprocessor is a 89c51. So I have to learn the Assembly language for that device to modify it. There is no schematic. And, all the documentation is in Chinese- so I have to reverse engineer the board.

    I have gotten used to the challenges as they really do make one fully understand the principles. But things do take longer when you have to find all the answers for yourself.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    It's sunny and warm here. It is always sunny and warm here.... (unless a typhoon blows through).

    Tropically, G. Herzog [noparse][[/noparse] 黃鶴 ] in Taiwan

    Post Edited (Kramer) : 8/20/2008 1:23:13 PM GMT
  • Tim-MTim-M Posts: 522
    edited 2008-08-20 14:04
    Hi Kramer,

    Thanks for your input.

    I should have included more detail... First off, I'm not looking for a panel at all.· The LEDs are spread over the surface of clothing,·a costume, and the desire is to have control of each one for visual effects such as patterns and sequencing.· The project·will stand alone with no PC involved.· Power will come from batteries (type to be determined)·in a backpack.

    I assume serial control simply because the number of LEDs used or driven, is so much greater than the number of Basic Stamp·outputs available.· Some type of interface is obviously·needed and I am aware of shift registers.· All data will be output from the uC except for a couple of control push buttons, so all communication is in the·output direction.

    The plan is sound and not all that expensive because the two of us building it are donating the labor.· 500 LEDs, most of the same color, will cost less than $50, throw in a uC or two plus the interface electronics and the budget is still under control.

    I posted the questions in case there is a better way to accomplish this other·than using shift registers and the community here is a great resource of information from so many varied backgrounds.· I have considered the Propeller as the uC for the project but I have yet to use one and am tending to fall back on what I know since the project is somewhat simple.

    Tim

    Edit: typos.
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2008-08-20 14:36
    Tim,

    I understand that you are not looking for a panel but take a look at the work we have done with a Bicolor (tricolor) 64x32 LED matrix display:

    http://forums.parallax.com/showthread.php?p=739950

    I have even been able to cascade 2 of these displays to form a 128 x 32 LED matrix display with a faster 50 MHz resonator. I can't imagine wearing 500 LEDs as the current consumtion would eat up at least an amp or more. It would·not be long before your "batteries" would be·drained. That many LEDs really need a stable regulated voltage and constant current source.

    I had worked on a project a couple of years ago with a BS2px and·about (110) CD4017 and·CD4081·ICs·that sequenced over 700 LEDs over a panel. Take a look and ask youself if you want to wear this many LEDs.

    Good·Luck.
    1280 x 960 - 577K
  • Tim-MTim-M Posts: 522
    edited 2008-08-20 15:01
    Hi Tim,

    It's been long enough that I forgot about your Firehouse Project. There is alot of hand wiring work represented in that project, well done!

    I understand the concerns about the number of LEDs and power consumption. The truth is that 500 LEDs is the worst case and reallity will likely be closer to 300... still a high number I realize. The costume design is beyond my control and is nearing final stages by those involved. To address the power consumption, I've advised that the lighting patterns should have few LEDs on at any given time. The wear or "on" time for the costume is fairly short and that makes a big difference too. Batteries will most likely be Sealed Lead Acid or Lithium Ion.

    To keep things organized, flat and more comfortable to wear, the plan is to wire LEDs in groups and connect the groups back to the controls using ribbon cable.

    Sounds to me like you guys think this project is nuts and maybe it is. I really do appreciate the help and am open to all ideas.

    Tim
  • Tim-MTim-M Posts: 522
    edited 2008-08-20 15:06
    To simplify.... the costume could be divided into seperate areas with each area having its own control. All electronics will reside in the backpack as well.

    Tim
  • FireHopperFireHopper Posts: 180
    edited 2008-08-20 15:20
    I'm doing something along those lines, however I'm using a propeller, and a TI chip, tlc5940

    all my work is based on stuff the guys at brildea has done, so I can't take any credit. [noparse]:)[/noparse]

    his stuff is in the customer application area, under living room controller..

    my other costume is also featured there. under fursuit [noparse]:)[/noparse]

    animatronic wings :>
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2008-08-20 15:41
    Tim,

    If you can get it down to 256 LEDs then controlling with a 16x16 LED matrix may be a good answer solved with an SX48 proto board:

    http://forums.parallax.com/showthread.php?p=649643
  • Tim-MTim-M Posts: 522
    edited 2008-08-20 16:08
    Really good ideas FireHopper and Tim. Looks like I'll need to make a decision about microcontrollers... the problem is, I haven't used the Prop or the SX. This could mean that I'd have to lean on you guys pretty heavily for help on the programming side and I don't feel that that's very fair to do if I'm new to those devices.

    Tim
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2008-08-20 16:12
    This really isn't the formal concept of multiplexing. Mostly it is a lot of blinking lights. You might consider dragging a car battery with a luggage carrier as a power source.

    Since it is a costume, the Allegro chips may still be a bit of overkill. You don't need latches, but you do need the serial to parallel shift registers. You can put together 8 bit or 16 bit shift registers to get 32 bits of output or even more, like 40bits and so on. Each output can be attached to one LED.

    PWM is not possible with the shift registers lighting the LEDs. You would have to take PWM directly from the BasicStamp and it tends to dominate processing resources. If you want it, the Propeller is a much better choice. You have 32 I/O pins and 8 processors. You can have feeds both to the shift registers for general dazzle and maybe 8 PWM channels to provide special effects to some LEDs.

    A Basic Stamp has 16 output pins, so you could have 12 pins outputting 12 different strings of serial data to different shift registers and you could have 4 pins clocking the 12 shift registers at four different rates. That would have quite a bit of variety. I would consider putting it all on a cape, rather than having to wire a coat and pants with plug ins.

    I guess it would be 12 strings of 40 LEDS by piecing together 40bit shift registers from small combinations. There are tons of ways to manage the output and much would best be done by trial an error. Having three speeds would be nice. yeah.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    It's sunny and warm here. It is always sunny and warm here.... (unless a typhoon blows through).

    Tropically, G. Herzog [noparse][[/noparse] 黃鶴 ] in Taiwan
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2008-08-20 17:10
    I agree with Kramer. In my Fireman project, I used cascading decade counter (so only 1 LED was on at any one time). However, using shift registers like the 74HC595 (lots of BS2 and SX examples) you can control (turn on/off) any combination of LEDs with data statements very easily. The 64x32 LED matrix example uses (8) 74HC595s to turn on any combination of 64 column LEDs. In theory, DATA can be shifted out forever, as long as you have enough program space on the BS2 or SX for DATA statements.
  • Tim-MTim-M Posts: 522
    edited 2008-08-21 03:16
    OK guys... I'd have to agree that there will have to be some things to work out, definitely some trial and error for this rookie. Regardless of the processor calling the shots, I'd like your help deciding on the output scheme.

    For ~300 LEDs:

    74HC595's at 8 outputs each = 38 needed for 304 total outputs. How would you lay this out? Use multiple uCs with so many 595s per processor for manageability and speed?
    I am attracted to the 595s for the reasons you point out of history and examples, but it feels overly busy and cluttered to me.

    If I can use something like the Allegro 5833s, only 10 would be needed for a total of 320 outputs and this seems more manageable from the communications side of things.
    This assumes that I could 'shift data out forever' to make it happen. Since you guys have experience with that part, maybe you would speak to it a little bit?

    Tim
  • VIRANDVIRAND Posts: 656
    edited 2008-08-21 04:37
    I've done 256 non-multiplexed LED's driven by the chips in sets of 8 and at 256x20ma it pulls up to around 5-7 AMPS.
    A battery can't do that for long so I power it with a quality mains to 5V 20A power supply.

    Maybe think about using a 4017 and four 74HC595's to run up to 320 LEDs with half an amp.
    You will probably need 10 transistors (or driver chip) to get enough current for 32 LEDs from the 4017,
    and 33-ohm resistors between each 595 pin which drives one of 10 LEDs at a time, chosen by the 4017.
    The LEDs would be in a grid circuit but not necessarily arranged that way if you are going to use a big spool of wire.
    (Idea: use ribbon cables for each set of 8 or 10 LEDs, less mess!)

    4017 is a unique self-decoded ten-counter which looks like a shift register when it controls LED's.
    Only weird thing about it is the pin order is all mixed up.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2008-08-21 08:21
    The 74HC595 can be extended [noparse][[/noparse]or daisy chained] to share clock and have data passed through.

    I would use four in one chain, though you could have eight or more in a chain. The 8 bits of data that goes into the first one is moved to the second, then the third, then the fourth, and so on until it dies at the end of the chain.

    Once an 8 bit pattern enters the chain it cannot be modified.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    It's sunny and warm here. It is always sunny and warm here.... (unless a typhoon blows through).

    Tropically, G. Herzog [noparse][[/noparse] 黃鶴 ] in Taiwan
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2008-08-21 09:33
    Take a look at this 24+ output drawing using the BS2 and 3 I/O lines to control 24+ outputs using 74HC595 ICs. Expanded forever ....
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2008-08-21 13:09
    That looks pretty good except I have had trouble with some LED color lighting properly when using 470ohms. 330ohms may be a more prudent value, especially if you are blinking very fast.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    It's sunny and warm here. It is always sunny and warm here.... (unless a typhoon blows through).

    Tropically, G. Herzog [noparse][[/noparse] 黃鶴 ] in Taiwan
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2008-08-21 13:24
    Absolutely and can probably even bring it down to 220 or 100 ohms for much brighter LEDs. Just always be sure to use these current limiting resistors so that you don't burn out the LEDs. Test it out and see what looks good on a few first.
  • LilDiLilDi Posts: 229
    edited 2008-08-21 16:29
    Tim,
    Don't rule out the TLC5940 IC. You can directly connect 16 LEDs without the need for current limiting resistors and have 4096 step grayscale on each individual LED. The TLC5940 is loaded with data over a single serial link to as many cascaded IC as you you wish.
  • Tim-MTim-M Posts: 522
    edited 2008-08-21 17:08
    My apologies for causing quite a bit of confusion with this thread. I realize that what we're talking about is not really multiplexing and that I didn't understand the term correctly. Kramer is right that this is mostly a bunch of blinking lights and I appreciate you setting me straight.

    Thanks for the help and good ideas guys! Sounds to me like this comes down to two main issues...

    1. Which microprocessor for the brain?
    - Need advice here since I don't have a concept of the time it will take to send the long serial strings given the number of outputs. I have yet to use an SX or Propeller, so will one of the Basic Stamps be fast enough for the job?

    2. Which method or IC for an interface to the outputs?
    - Lildi, I'll take a good look at the TLC5940. It would be fun to have dimming capability for more effect options and this looks promising.
    - I like the tried and true 595s too, it would just take a bunch of them for the number of outputs desired.

    Tim
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2008-08-21 17:22
    The BS2 or BS2px should be fine with the addition of some LED driving ICs for basic LED manipulation. However, you may be able to do a little more tricks (e.g. Interrupts, etc.) with an SX chip. Now it will be a choice of convinience vs simplicity. You can use the well known and documented (but will use more of) of the 74HC595 or else you can figure out how to integrate other ICs (that you may use less of) into your design. It's either more hardware or more software writing - what ever you feel more comfortable in.
  • Tim-MTim-M Posts: 522
    edited 2008-08-21 17:23
    VIRAND, I don't quite grasp the concept of how the 4017s and 595s are working together. Are you 'scanning' the LED field fast enough to make them look like they are constantly on and thereby cutting the current draw down? This is a guess on my part, but I'd love it of you could explain it a little more.

    Thanks,

    Tim
Sign In or Register to comment.