Shop OBEX P1 Docs P2 Docs Learn Events
Controlling about 50 LEDs, discretely from a Propeller — Parallax Forums

Controlling about 50 LEDs, discretely from a Propeller

Ken GraceyKen Gracey Posts: 7,392
edited 2012-11-06 08:37 in Propeller 1
Hey all!

Got a friend who teaches art at a local private school. We've been slowly getting her involved in more and more electronics, from really neat mixed-media projects with movement and lights to where we are today: sewable electronics. Our first project was a huge California wall map that had various components and LEDs for each region or county (I forgot) - it's still running about eight years later. The latest request is to control about 50 to 100 LEDs that will be sewn into fabric. I'm hoping that some of you are also seamstresses so you can give me some tips. . .

Question #1: the physical setup

The physical wiring of these projects is more consuming than the programming. I'm not sure if I should use conductive thread or if we should just use wires and LEDs with built-in resistors. Considering they're all individually controlled, a bunch of home-runs could become quite rigid - and this is a stocking. Any tips?

Question #2: the electronic circuits
Next, how about a preferred circuit? Any favored shift registers or I/O expanders you'd recommend? Of course I want to use a Propeller. But I also need some really small hardware boards upon which I can build. There will be an SD card and a pushbutton somewhere.

And the bigger picture. . .several ladies in the office are now building electronic jewelry, EL clothing, and really cool stuff. I'll certainly draw from their experiences this week, but we need to make some helpful hardware for their projects at some point. Feel free to share any ideas you might have about a Propeller-based e-textile controller.

And go ahead - send me to Google if you need to. I got some thick skin and realize I can be a bit lazy. I'm also short on time [all the time] and know that these forums are loaded with the right mixture of experience.

Thanks,

Ken Gracey

Comments

  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2012-11-04 09:42
    Hi Ken;

    What will control the LED pattern?
    Will they need to change rapidly?
    Why does this need to be on cloth?
    How flexible does it need to be?
    Does it need to be weather or water proof?
    What is the power source?

    Duane J
  • tonyp12tonyp12 Posts: 1,951
    edited 2012-11-04 09:43
    So many ways to go about the LED circuit.
    could do 12 Rows sourced by Prop directly with 7 Prop pins controlling a ULN2003V12DR for columns sink (=15% duty)

    I think the proper way would be to use Constant Current LED drivers.
    http://www.mouser.com/ProductDetail/Texas-Instruments/TLC5926IDWR/?qs=sGAEpiMZZMsE420DPIasPjS%2fGpARRo9f7ANH7FDsp04%3d
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2012-11-04 09:43
    Ken,

    The "Witches Halloween wand" that I made last year for my daughter used 25 LEDs wired individually... I used 38 gauge copper wire. With most of the really small gauge copper wire, the enamel is burned off during the soldering process, so there is no need to strip the wire beforehand.

    http://www.youtube.com/watch?v=AXnGtZcEjgs
    http://www.youtube.com/watch?v=NepGWSOuf8s

    BTW) the LEDs are from a 25-string of white LED Christmas lights (re-wired) ... The wires that you do see in the video are going to the speaker... those are thicker than all 25 of the other wires going to the lights. .... and YES, there is a Propeller in there! :-)

    On question #2, do the LEDs need to vary in brightness, or just ON or OFF?
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-11-04 10:10
    @Ken,

    I recently discovered the PCF8574A chips. These are 8bit I2C I/O Expanders that are both easy to use and will accept 3v. I'll bet they would work well in this project. There's a nice object in OBEX ready to go for these.

    Jeff
  • Martin_HMartin_H Posts: 4,051
    edited 2012-11-04 10:18
    Ken, I was able to control 192 LED's from the Propeller with only the addition of current limit resistors. Here's the thread :

    http://forums.parallax.com/showthread.php?136152-LED-Marquee-Module-for-Gadget-Gangster-Platform-(w-video)

    While I did this in the form of a marquee, you could disperse the LEDs around too. To simplify the wiring the alternate row Charlieplexing could be eliminated and still control over 90 LED's. I had pins left over so some day I plan to revisit this project for a much larger array.
  • eldonb46eldonb46 Posts: 70
    edited 2012-11-04 10:20
    @Ken,

    I recently discovered the PCF8574A chips. These are 8bit I2C I/O Expanders that are both easy to use and will accept 3v. I'll bet they would work well in this project. There's a nice object in OBEX ready to go for these.

    Jeff

    Or, the MCP23017 with 16 GPIO pins. I have used this chip in several of my projects to drive LEDs, programming is simple with "jm_i2c" from the OBEX.

    Eldon - WA0UWH
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-11-04 10:25
    I bought a bunch of those as well for the store, but I haven't had a chance to play with them... Guess it's time to dig those out too! :)

    Jeff
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2012-11-04 11:12
    I've have really good results just cascading the 74HC595 chips. Using the superbright LED's you can limit the current well within the limits of the 74HC595. There are some great propeller projects that drive up to four 74HC595's (32 LED's) so you could just use two sets and two instances of the object each running in COG.

    Robert
  • jmgjmg Posts: 15,173
    edited 2012-11-04 11:44
    Ken Gracey wrote: »
    ... - and this is a stocking. Any tips?

    You mean as in a pair that go onto legs ?
    What area is the map and how long do they expect to wear this, and how bright do the LEDs need to be ?
    Is this indoor night time performance, or outdoor daylight ?

    You are looking for 'any or all' illumination, right ?

    How many are to be made ?

    Flexible PCB allows a smooth surface on one side, and even distributed parts, but it has more tooling... is that too much ?
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2012-11-04 11:57
    Ken,

    Here is a way to control 100 LEDs with a chip we already have.

    There are two modes of operation for this circuit:

    Edit: To avoid 3.3V <-->5V complications, just run Vcc1 and Vcc2 at 3.3V on the L293D.
    I just tested it and it seems to be fine at 3.3V. ... The schematic shows 5V.. ignore that and make it 3.3V


    If P0 to P24 are INPUTs , then none of the LEDs will light in in either mode.

    Mode 1: Normal operation
    P25 is HIGH ... this is an enable to the L293D

    If P26 is HIGH and P27 is LOW ; If P0 is LOW then the bottom left LED will be ON
    If P26 is HIGH and P27 is LOW ; If P0 is HIGH then the upper left LED will be ON
    If P26 is LOW and P27 is HIGH ; If P0 is LOW then the upper right LED will be ON
    If P26 is LOW and P27 is HIGH ; If P0 is HIGH then the bottom right LED will be ON


    Mode 2: Normal operation
    P25 is HIGH ... this is an enable to the L293D

    If P26 is HIGH and P27 is HIGH ; If P0 is HIGH then the upper left AND lower right LED will be ON
    If P26 is LOW and P27 is LOW ; If P0 is LOW then the upper right AND lower left LED will be ON
    1024 x 592 - 96K
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2012-11-04 13:55
    In these videos I used two cascaded 74HC595 chips to drive 16 LEDs with a BS2
    and 8 LEDs using half of the 16 pins on a MCP23S17 SPI I/O expander
    and multiple LEDs and tact switches using a MCP23016 I2C I/O expander
  • JonnyMacJonnyMac Posts: 9,108
    edited 2012-11-04 14:02
    Have a look at the November issue of Nuts & Volts to see how I controllered 94 RGB LEDs with just two Propeller pins in one of my Hollywood projects. The chips used (WS2801) give 8 bits of brightness per output. You could use them to control three discrete LEDs versus a single RGB.

    Related thread: http://forums.parallax.com/showthread.php?141495-WS2801-Driver
  • jmgjmg Posts: 15,173
    edited 2012-11-04 14:09
    Edit: To avoid 3.3V <-->5V complications, just run Vcc1 and Vcc2 at 3.3V on the L293D.
    I just tested it and it seems to be fine at 3.3V. ... The schematic shows 5V.. ignore that and make it 3.3V

    Doesn't that push the voltage budget ? The L293D has Darlington level saturation specs, of 1.4V typical, when you add in a LED drop of ~2.1v, and you have run out of margin ?
    It does seem to have a TTL threshold, of 2.3V max, so split supply should be ok.

    A overall linear regulator on the LED VCC would allow brightness control, straight from the battery.
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2012-11-04 14:48
    jmg,

    On the L293D that I have, I measured about a .7V drop with a load ( ~30 Ohms) to ground when powered from a 3.3V source on both Vcc1 and Vcc2 .... So that leaves about 2.6V overhead. Typical LEDs are about 1.7V drop

    Also, the L293D is used in half duplex for this, so the return path is through the Propeller I/O, which under load only has about .3V drop, making the 2.6V overhead become 2.3V. (Realistically about 2.4V since the Propeller has an internal resistance of about 40 Ohms)

    As long as you manage the Duty cycle on the I/O's and choose the resistors properly, you can drive multiple LEDs' at an average current that will not exceed the I/O specifications of the Propeller.
  • max72max72 Posts: 1,155
    edited 2012-11-04 15:20
    I second JonnyMac's suggestion.
    The drawback with his object is everything will be too easy.
    I tested a strip and in less than 5 minutes you are set. The object is as usual first quality, easy and powerful. Great fun.
    Massimo
  • LawsonLawson Posts: 870
    edited 2012-11-04 20:42
    Is there any reason why an 8x8 matrix can't be used? I will be quite bright using high brightness LEDs even running off the I/O pins. It should also save a bunch of wire with careful layout. This does assume that a distorted grid is acceptable. Failing that, I'd second the shift register suggestions.

    Lawson
  • CircuitsoftCircuitsoft Posts: 1,166
    edited 2012-11-04 23:09
    Check out the circuit and program for the Wayne&Layne BlinkyGrid. It's a fantastic intro to Charlieplexing (and I know you have one).
  • ClemensClemens Posts: 236
    edited 2012-11-05 00:22
    Hi Ken

    I soldered this grid some years ago following a technique discussed here on the forums:
    http://forums.parallax.com/showthread.php?99843-A-fist-full-of-LEDs-for-Christmas&p=696682#post696682
    It works without additional hardware, not even resistors.

    Cheers, Clemens
  • ErNaErNa Posts: 1,752
    edited 2012-11-05 00:41
    What about this: (see attached screenshot)
    It's a mux solution with current limited by inductances, so a type of switch mode driver. The switches are representing the propeller pins. Let's just look to one leg: S1 and S4 are closed. There is voltage across L1 and D1, current will start to flow, the led will light up. S4 is opend, S3 is closed. Current will continue to flow until the inductance energy is used. Now S3 can be savely opended. (if opened before, the current will continue to find his way over D6, the pin protection diode (internal))
    As an option a second LED of different color could be paralled inversely and activated by inverting the polarity of the output pattern of the prop pins.
    796 x 544 - 10K
  • RaymanRayman Posts: 14,670
    edited 2012-11-05 04:11
    Charlieplexing is the fun way to go... I've heard you don't even need resistors...

    The PropRGB board might show another way, where you can control 8x8x3 LEDs...
  • Ken GraceyKen Gracey Posts: 7,392
    edited 2012-11-05 19:44
    Hi Ken;

    What will control the LED pattern?
    Will they need to change rapidly?
    Why does this need to be on cloth?
    How flexible does it need to be?
    Does it need to be weather or water proof?
    What is the power source?

    Duane J

    Hey Duane, got a few more specifics from the artist.

    What will control the LED pattern? => the DAT section of my program with a bunch of 0's and 1's
    Will they need to change rapidly? => only at a visually appealing rate
    Why does this need to be on cloth? => it's a stocking. Jessica has some conductive thread.
    How flexible does it need to be? => seems to be okay with the conductive thread. Stockings get loaded with candy, treats, coal, and oranges.
    Does it need to be weather or water proof? => no sir
    What is the power source? => sized for a few hours of operation. Probably something that can be easily replaced.
  • Ken GraceyKen Gracey Posts: 7,392
    edited 2012-11-05 19:48
    jmg wrote: »
    You mean as in a pair that go onto legs ?
    What area is the map and how long do they expect to wear this, and how bright do the LEDs need to be ?
    Is this indoor night time performance, or outdoor daylight ?

    You are looking for 'any or all' illumination, right ?

    How many are to be made ?

    Flexible PCB allows a smooth surface on one side, and even distributed parts, but it has more tooling... is that too much ?

    You know, a Christmas stocking - the kind that hangs over the fireplace and gets filled with treats, lottery tickets, fruit and other consumable stuff. These things are decorative and not usually worn on somebody's foot since they're just for decorations.

    We only need to make one (1) of these since it's for her mother, an 85-year-old woman who's gotten interested in my quadcopters among other stuff.

    Flexible PCBs are out of the question due to the lack of time. I'll have to use our boards, as is, with the right LED driver circuitry.
  • Ken GraceyKen Gracey Posts: 7,392
    edited 2012-11-05 19:51
    Hey guys,

    Thanks for the input. I'm going with JonnyMac's suggestion, and will follow up with OBC's idea in case I fail. Most of these suggestions I understand well enough to implement on my own without much help. I tend to stand on the shoulders of neighborhood giants when it comes to my projects, making quick high-level gains from their expertise!

    I'll be sure to follow up with a photo and video of the result.

    Thanks gang!

    Ken Gracey
  • jmgjmg Posts: 15,173
    edited 2012-11-05 21:03
    Ken Gracey wrote: »
    You know, a Christmas stocking - the kind that hangs over the fireplace and gets filled with treats, lottery tickets, fruit and other consumable stuff. These things are decorative and not usually worn on somebody's foot since they're just for decorations.
    ...

    Flexible PCBs are out of the question due to the lack of time. I'll have to use our boards, as is, with the right LED driver circuitry.

    Ahh.. Ok that use is more tolerant of weight, and stiffness.
    There, you could use winding wire as conductive thread, as needed, and standard PCBs and Batteries could fit near the opening, where it tolerates more stiffness.
    Some form of overall brightness control via SMPS trim would give the longest battery life.
  • max72max72 Posts: 1,155
    edited 2012-11-06 06:06
    Ken,
    out of serendipity I tested WS2801 leds with a 3.3V supply, and it works. When setting all of them to white the 25 leds string tends to have a reddish hue, but it works nonetheless.

    Massimo
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-11-06 08:37
    Hard to beat JonnyMac's LED knowledge! The undisputed master of the LED. He could do a Nuts & Volts article just on all the ways to control bulk LEDs with PWM. (Has he done this yet? :)

    Honored to be chosen as second,
    Jeff
Sign In or Register to comment.