Shop OBEX P1 Docs P2 Docs Learn Events
Maximum LEDS — Parallax Forums

Maximum LEDS

flying_flipflying_flip Posts: 36
edited 2009-01-25 22:38 in BASIC Stamp
Another project that I'm looking to do is to light up a R/C Electric Sailplane for night flying.
With the Basic Stamp (2 or 2px) I would like to be able to light/control as many LEDs as possible.
With 16 io lines it seems that 16 would be the number, but...
I noted other posts talking about decoders or de-multiplexers....

A 4-16 decoder would allow 4 inputs to be translated to 16 single outputs.

a0·a1 a2 a3 => y0 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15
1·· 1·· 1·· 1··=>· 0· 0·· 0··0··0 · 0· ·0·· 0·· 0··0··0··· ·0··· ·0··· ·0··· ·0·· 1· => lighting 1 led

and with persistance of vision I can stream through
multiple nibbles to light all or some at a time, without flicker?

With 4 decoders I get control of 64 leds
With·8 decoders I get control of 128 leds (but don't have enough io pins to activate them all).

This reduces the voltage requirements as well, correct?
Am I on the right track or blowing smoke?

Any assistance is appreciated.

Phil
«1

Comments

  • flying_flipflying_flip Posts: 36
    edited 2008-12-03 18:14
    Also, If I am on the right track is this a good "decoder"

    http://www.mouser.com/Search/ProductDetail.aspx?qs=vul0MlC/a1dPzYEx8Nqwxw==

    Phil
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-12-03 19:30
    I highly recommend using "low-current" LED's, if you're going to have 16 of them. "Low-current" LED's can be lit with 1 mA of current -- you'll need to use bigger value current limiting resistors to run this low. But running this low, you'll be able to drive 16 LED's with a BS2 without using too much current.

    Probably you want to 'clump' the LED's anyway -- assigning one I/O pin per LED is probably over-kill, unless you really want fancy LED cycling.
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-12-03 19:31
    Also, the BS2 runs at about 2000 instructions per second. At this slow speed, it becomes difficult to 'strobe' LED's fast enough to not have flicker.
  • flying_flipflying_flip Posts: 36
    edited 2008-12-03 19:37
    I will probably be using the BS2PX (19k instructions per second)
    but am looking to use 100+ leds if possible.
    Power doesn't have to come for the Stamp, just control.

    Phil
  • awesomeduckawesomeduck Posts: 87
    edited 2008-12-03 21:59
    Look for a multiplexer that is fed serially and can be daisy chained. You could potentially run an unlimited number of LEDs.

    Not exactly perfect for this app, the MAX7219 allows you to control eight, 8-segment LEDs. There is nothing to prevent you from using this chip to control LEDs that are not part of a 7-segment (plus decimal point) device.

    The scan rate on the MAX7219 is proportional to the number of "digits" you drive..typically 800 Hz. I have used the MAX7219 extensively with 5 digits and seen no flicker. You can also use the 7219 to set the intensity very easily.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-03 22:01
    How about something like this Maxim LED driver: datasheets.maxim-ic.com/en/ds/MAX6969.pdf

    It's got 16 outputs and these have current regulators so you don't need series resistors for the LEDs.
    They can be cascaded like the 74HC595 which only has 8 outputs. 6 of the MAX6969 gets you just under 100 LEDs.

    Post Edited (Mike Green) : 12/3/2008 10:09:50 PM GMT
  • awesomeduckawesomeduck Posts: 87
    edited 2008-12-03 22:30
    MAX6969 is a good choice, it can be daisy chained and has 55mA *continuous current* per LED available with no extra parts.
    A single 7219 can support 64 LEDs with a single chip, but they are mux'd and that might cause flicker depending on the application.
    Classic engineering design choice here: "Good, cheap, fast...pick two"
  • flying_flipflying_flip Posts: 36
    edited 2008-12-03 23:51
    Assuming MAX6969.
    How can I run 6-8-more of them? (6 get me 96, 8 gets 128,etc.)
    Do I not need 4 pins to communicate with it?
    My though is BS2PX talks to the MAX6969's by sending serial ie. SEROUT command?
    Are there any other chips I would need for this project?

    I am not an Electric engineer by any stretch....But I want to put on a dramtic light show in the sky.

    Thanks Mike, awesome, and allen for your feedback.

    Phil
  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-04 05:31
    A Stamp like the BS2px would talk to the MAX6969 using HIGH/LOW for the LATCH line and SHIFTOUT to provide CLK and DIN. You could tie OE to ground through a 10K resistor if you want to leave the outputs enabled all the time which I assume would be so. You'd need to tie the SET pin through a resistor to ground to determine the LED current. The MAX6969's datasheet gives the formula for SET pin resistance vs. LED current. The datasheet also shows how to connect several MAX6969 in series. Essentially, you connect all the CLK lines to one Stamp I/O pin and all the LATCH lines to another Stamp I/O pin. You connect the first MAX6969's DIN line to a 3rd Stamp I/O pin, then the DOUT pin to the next MAX6969's DIN pin and so on for as many as you have. If you use 8 MAX6969's in series, you'll have to output 8 16-bit words using one or more SHIFTOUT statements before doing a HIGH, then a LOW on the LATCH pin.

    Be sure to read thoroughly the Basic Manual's chapter on the SHIFTOUT statement. Also read the MAX6969's datasheet, particularly the sections on how it works.
  • KraZe_EyEKraZe_EyE Posts: 15
    edited 2008-12-05 01:01
    Hi flying flip,

    I assume you want the blinking action of an airplane's tail light ect?

    why not use a 555 timer to turn the LEDs on/off at a predetermined rate?
    then via a transistor; turn on power to the 555 using a single IO pin from the stamp?

    555's usually have a output current rating of 200ma so you could run more then 4 LED's if you wanted.

    Right now that 555 is set to blink 200 times a second, slower times are easy to create.

    Seems to me you guys are making this more complicated then it needs to be rolleyes.gif
    765 x 478 - 61K
  • flying_flipflying_flip Posts: 36
    edited 2008-12-05 02:36
    Krazy,

    I'm aware that I "could" just light the tails and wing tips, but I want to put on a light show !!
    And when you can get the hardware to do something unusual, you tend to want to do unusual [noparse]:)[/noparse]

    Mike, once again, Thanks.
  • flying_flipflying_flip Posts: 36
    edited 2008-12-06 00:18
    I have 6 MAX6969's on order should be here in a week or so...
    Then the fun begins.
  • Carl HayesCarl Hayes Posts: 841
    edited 2008-12-06 04:40
    As one of my pals in the International Aerobatic Club (Chapter 24, Dallas) once said -- I think he was quoting some earlier sage -- the dominant theme in airplane-building should be, "Simplificate, and add lightness".· This does not seem to be your driving ambition.· Sounds like fun, though.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · -- Carl, nn5i@arrl.net
  • flying_flipflying_flip Posts: 36
    edited 2008-12-07 01:28
    Hi Carl,

    The plane that I will be putting this into is starting to sound like the Electric Allegro-Lite (2 meter).
    The planes design is 18 ounces all up, with the ability to handle 20 oz of ballast.
    The light show version shouldn't be more than 24-28 ounces....

    It's suppose to be fun [noparse]:)[/noparse]

    Phil
  • Carl HayesCarl Hayes Posts: 841
    edited 2008-12-07 21:41
    Wish I could see it fly!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · -- Carl, nn5i@arrl.net
  • awesomeduckawesomeduck Posts: 87
    edited 2008-12-08 02:26
    I ran across the MAX6955 this weekend...it can drive 128 discrete LEDs with one chip. Yes, they are multiplexed, but it will be a lot easier to wire up than 6 MAX6969s.
  • flying_flipflying_flip Posts: 36
    edited 2008-12-21 18:31
    Well, I have the MAX6969 for a little while, did a little testing with a single, and now have wired up all 6.
    I am having issues with the first pattern that I'm coding.

    If I use this code, only 1 "set" of LEDS can be "lit" (the last set).
         SHIFTOUT Dpin1, Clk, MSBFIRST, [noparse][[/noparse]counter\16]
         SHIFTOUT Dpin2, Clk, MSBFIRST, [noparse][[/noparse]counter\16]
         SHIFTOUT Dpin3, Clk, MSBFIRST, [noparse][[/noparse]counter\16]
         SHIFTOUT Dpin4, Clk, MSBFIRST, [noparse][[/noparse]counter\16]
         SHIFTOUT Dpin5, Clk, MSBFIRST, [noparse][[/noparse]counter\16]
         SHIFTOUT Dpin6, Clk, MSBFIRST, [noparse][[/noparse]counter\16]
         PULSOUT Latch, 1
    
    



    If I use this code, all sets are active.
    I am using a shared Clock, and a shared Latch.

         SHIFTOUT Dpin1, Clk, MSBFIRST, [noparse][[/noparse]counter\16]
         PULSOUT Latch, 1
         SHIFTOUT Dpin2, Clk, MSBFIRST, [noparse][[/noparse]counter\16]
         PULSOUT Latch, 1
         SHIFTOUT Dpin3, Clk, MSBFIRST, [noparse][[/noparse]counter\16]
         PULSOUT Latch, 1
         SHIFTOUT Dpin4, Clk, MSBFIRST, [noparse][[/noparse]counter\16]
         PULSOUT Latch, 1
         SHIFTOUT Dpin5, Clk, MSBFIRST, [noparse][[/noparse]counter\16]
         PULSOUT Latch, 1
         SHIFTOUT Dpin6, Clk, MSBFIRST, [noparse][[/noparse]counter\16]
         PULSOUT Latch, 1
    
    



    Is there another way other than wiring 6 latch pins?

    Thanks,

    Phil
  • flying_flipflying_flip Posts: 36
    edited 2008-12-29 01:40
    Anybody?
  • ercoerco Posts: 20,256
    edited 2008-12-29 02:32
    Just a quickie note about running lots of LEDs with minimum complexity . Allanlane5 mentioned "clumping" them. I've wired of LOTS of strings of LEDs, and it expedites the whole process to run as many in series as you can. That is, run 2 or 3 LEDs in series with a lower-value current limiting resistor. If you have a red LED that nominally runs at 1.7 volts, you can power 3 of them in series from 5.0 volts (that's 1.67 volts apiece without any series resistor at all, but you may want a small resistor (5-10-22 ohm) as insurance). It's much more time and energy-efficient that running one resistor per LED to drop 5 volts down to 1.7. Of course, it's the same current running through all the LEDs. Low current LEDs can be VERY bright on 2 mA. So you could have all 16 lines of a Stamp ON simultaneously, sourcing a mere 32 mA total to light 48 LEDs without any extra hardware at all (except maybe 16 resistors)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • flying_flipflying_flip Posts: 36
    edited 2008-12-29 02:39
    With my current configuration (6 MAX6969) I only require 6 resisitors to run 96 or 192 LEDs.

    running 1 LED per pin on the MAX6969 gives me 16x6=92 or 2LEDs in series on each pin will be 32 X 6 = 192
    On the Stamp...
    1 shared clock line
    1 shared Latch
    1 output pin per MAX6969 (6)

    Phil
  • kelvin jameskelvin james Posts: 531
    edited 2008-12-29 18:41
    Any pacticular reason you haven't connected them in series?
    You would only need one stamp pin to control all six with the shared clock and latch.

    **
  • flying_flipflying_flip Posts: 36
    edited 2008-12-29 22:02
    In series I would have to send 6 words, each word moves to the next, to the next until they all had values.
    Each is passed on a differnet clock cycle, but I guess that the same as parallel....

    not sure.

    Phil
  • kelvin jameskelvin james Posts: 531
    edited 2008-12-30 00:02
    The whole timing sequence is pretty fast through the multiple shiftouts in series. I can't see it being a problem for the speed of switching leds, compared to parallel.

    In series, you only need to latch once after the shiftouts.
    Remember in series, the first shiftout goes to the last on the chain, and pushes back with each shiftout afterwards.

    I guess it depends on what you are trying to achieve, i think it be worth a try.


    **
  • awesomeduckawesomeduck Posts: 87
    edited 2008-12-30 01:12
    Looking at your code example from Dec 21st its clear this will not work. What is actually happening is that you are clocking zeros into the first 5 chips. Each 6969 sees all the clock pulses which are intended to only be seen by one 6969 at a time. These clock pulses are happening while the individual data pins are zeros. Therefore, you either need to run a separate LE to each chip, or you need to do as suggested above and string the 6969s together with the DIN / DOUT pins. I think this will work fine and you will not have any performance problems. Be sure to read up on the NO-OP command for when you want to update only a single 6969...you will still need to write 6 words out even in that case.

    You could also use a single MAX6955 http://datasheets.maxim-ic.com/en/ds/MAX6955.pdf
    Maybe someone with a better understanding of LEDs and multiplexing could tell us if/how many resistors are needed with the 6955...but I am guessing, if configured correctly, and with a big enough Iset value, you might not need many resistors at all.
  • awesomeduckawesomeduck Posts: 87
    edited 2008-12-30 01:18
    I forgot to mention...if you dont want to string the 6969s you can also use the same number of IO pins you are using today...just use shared clock and shared data lines...then run individual LE lines. This uses the same number of pins as your current design but the code would look like this...

    SHIFTOUT Dpin, Clk, MSBFIRST, [noparse][[/noparse]counter\16]
    PULSOUT Latch1, 1
    SHIFTOUT Dpin, Clk, MSBFIRST, [noparse][[/noparse]counter\16]
    PULSOUT Latch2, 1
    SHIFTOUT Dpin, Clk, MSBFIRST, [noparse][[/noparse]counter\16]
    PULSOUT Latch3, 1
    ...
  • flying_flipflying_flip Posts: 36
    edited 2008-12-30 04:08
    I will try series next.

    It's all on a breadboard right now, so best to get it right before burning circuit boards [noparse]:)[/noparse]

    Thanks,

    Phil
  • flying_flipflying_flip Posts: 36
    edited 2009-01-09 18:09
    Well I· made a boo boo.
    Apparently I can't count well [noparse]:)[/noparse]
    I picked up 6 MAX6969 chips, and 96 leds, only to find that that will only cover 1/2 of the wing.

    Instead of 16 bays, I have 32 bays.
    With 6 leds (1 for each color) in each bay, I come to 192 Leds, and 12 Max6969's.

    The Professionally done Circuit boards will be a godsend (and inexpensive ($60USD) for 3)
    I now need to pick up another raft of LEDs, and 6 more MAX6969's before I can proceed on the build.

    The LED circuit boards (1 per colour) will be mounted in the front portion of the wing, while the Power and Stamp boards will be placed inside the fuselage.
    Therefore I can't close up the wing, until I have the LEDs·wired to the boards.

    This is going to take a while....

    I did come across a few issues when coding for the Serial version of controlling the MAX6969's, in that one or 2 of the chips would not get values, even though later on they do....
    (looping through colors blue,yellow,red,green,white,orange,blue... the white and or orange would light after the first or second pass, not on all passes...)
    Not concerned at this point as more parts are needed, and the code will change.

    I think the final version will be a combination of Series and Parallel·for the MAX6969's
    2 Chips per colour in Series, and 6 colour/pairs in Parallel.

    With 8 leds set aside for the illumination of the tail surfaces, this plane will have at a minimum 200 leds.
    (maybe 2 leds on the propeller to light it while spinning.)

    This is going to be fun [noparse]:)[/noparse]

    Phil
    ·
  • awesomeduckawesomeduck Posts: 87
    edited 2009-01-10 14:55
    Have you thought about using the multicolor LEDs that have 4 leads and 3 independent colored LEDs in them? It would save space and weight and does not change your control circuit. I am wondering how you are going to power this all and how much it will weigh.
    Since you are redoing this, you should look at the MAX6955, I think it will make your life a LOT easier.
  • flying_flipflying_flip Posts: 36
    edited 2009-01-16 14:19
    Just about ready for "burning" the boards.
    Here is the final layout.

    The Service that I'm going to use, will do 3 identical boards, for just over $60 USD.
    I will be running 12 MAX6969's so, I need to have 4 per board (all boards will be further cut for placement in the plane)
    Each pair of 6969's will hold one color.
    They will share a clock, and share a latch, Enable will be wired to ground.

    I built in a Pin Header for both the Stamp2Px, and the DB9 connector, so that all I need to do if I want to re-program is to plug in 1 connection.

    I will also get extra of the Power supply layouts, although I only need 1 for this project, I will use 2 on my Scooter project, and have a few "spares"

    Comments welcome.

    Phil
  • flying_flipflying_flip Posts: 36
    edited 2009-01-25 22:38
    Ordered and received my boards on Friday, cut them this morning.

    They look great.
    I still need to pull in another 100 LEDs, and 6 more MAX6969, but this is going to be sweet.

    Phil
    905 x 331 - 100K
    916 x 622 - 102K
Sign In or Register to comment.