1. This forum section is a read-only archive which contains old newsgroup posts. If you wish to post a query, please do so in one of our main forum sections (here). This way you will get a faster, better response from the members on Motherboard Point.

Help! PIC Controlled LED Array Circuit - 100 LED's??

Discussion in 'Embedded' started by Scott Hooper, Nov 9, 2004.

  1. Scott Hooper

    Scott Hooper Guest

    I am new to electronics, but a programmer by trade. I am trying to
    achieve a circuit of up to 100 independently controlled LED's (not
    segmented display modules). Ideally the circuit would be controlled by
    one or more PIC microcontrollers as I have a Willem II programmer. My
    application is artistic in nature and requires the leds to be spread
    out over a wide area as opposed to being in a grid formation.

    I have heard a lot of conflicting reports about Maxim's MAX721xx chips
    for this job. Some say it's the one I want, but others (including an
    actual Maxim tech-supporter) say it's more suited to the segmented
    displays. I have experimented with this chip with little success.

    Has anybody achieved anything like this? I have scoured the Internet
    and newsgroups for literally weeks looking for a matching schematic
    and source module. I have found a few Basic Stamp modules but I'm not
    setup for that at all and would rather stick with native PIC. The only
    compiler I have is MPLab's MPASM.

    Many thanks to anyone that can help
     
    Scott Hooper, Nov 9, 2004
    #1
    1. Advertisements

  2. Scott Hooper

    Peter Guest

    This is doubtless the cheapest way to control 52 leds from a single 8 bit
    port.
    http://www.tinaja.com/glib/muse152.pdf
    I'll leave it to you to scale it up.

    Peter
     
    Peter, Nov 9, 2004
    #2
    1. Advertisements

  3. Scott Hooper

    Tim Mitchell Guest

    I have done it using 74HC595 serial to parallel chips. 8 leds off each
    chip, and you just chain them together, the whole thing becomes one big
    serial shift register requiring only 3 pins from the micro. They will
    drive low current LEDs directly or add a ULN2803 driver chip to drive up
    to 500mA per output. Cheap and it works.
     
    Tim Mitchell, Nov 9, 2004
    #3
  4. Better do some calculations first, that method is cute, but scales
    HORRIBLY.

    I suggest either the simple-Simon static drive by serial SR suggested
    by someone else, or a low multiplex ratio n x m array. No more than
    8:1 mux ratio. For example, 8 high side drivers and 16 low side
    drivers, with a timer-triggered ISR controlling the drivers would work
    nicely. At 20mA each, 100 LEDs will draw 2A maximum. The drivers could
    be as simple as 4 SOIC-8 dual MOSFETs, 2 D-MOS power shift registers,
    and 16 resistors, for driving up to 128 LEDs at full brightness.


    Best regards,
    Spehro Pefhany
     
    Spehro Pefhany, Nov 9, 2004
    #4
  5. Check out http://www.allegromicro.com/ for some nice LED driver
    chips (up to 32 channels each I believe). They are good with samples too.

    Mike Anton
     
    Michael Anton, Nov 10, 2004
    #5
  6. Scott Hooper

    Scott Hooper Guest

    Hi Tim,

    This sounds like exactly the sort of thing I'm after. I google'd that
    chip and it does sound like the chip for the job. A few questions:
    What PIC did you use? Do you have a schematic of how it goes together?
    Do you have a source module available? What language/compiler was
    used? (I did say a few questions :) ) Lastly, something confuses the
    heck out of me... I can see that you can daisy chain the 74HC595 chips
    together, but how do you tell your PIC which one to address?

    To everyone that replied, thank you very much. But I am quite the
    novice and hoping that someone can provide me with a PIC-compatible
    schematic/source-code combo

    Thanks heaps
     
    Scott Hooper, Nov 10, 2004
    #6
  7. Scott Hooper

    Neil Kurzman Guest

    Why not several PICs 1 master and the rest slaves.
     
    Neil Kurzman, Nov 10, 2004
    #7
  8. Scott Hooper

    galto Guest

    Have you looked into using some kinda FGPA?
     
    galto, Nov 10, 2004
    #8
  9. Scott Hooper

    Dorsai Guest

    (Scott Hooper) banged on the keyboard until
    producing
    Get yourself some 74154 decoder chips. 4 inputs to 16 outputs; active-low
    on the output. A couple of these as a matrix would give you 16^2
    capability for only 8 output pins (or even only 5 if you commoned the
    inputs and used a line for device select).

    --
    * * * * * * * * * * * * * * * * *
    Dorsai - Author of Erotic Fiction
    http://www.asstr.org/~Dorsai
    * * * * * * * * * * * * * * * * *
    "Making fun of born-again christians is like hunting dairy cows with a
    high powered rifle and scope." -- P.J. O'Rourke
     
    Dorsai, Nov 10, 2004
    #9
  10. Scott Hooper

    Tim Mitchell Guest

    Didn't use a pic, used an 8051. Code was 8051 assembler but it's really
    simple.

    You address the chips just by clocking the bits out. Say you're
    controlling 64 LEDs, you clock out 64 data bits (set the value to the
    data pin, take the clock pin low then high, 64 times). The first data
    bit goes to the LED furthest from the pic, then each bit goes to the
    next LED, the 64th bit going to the LED nearest the pic in the chain.

    On the 595 chip, once you've clocked all the bits into position, you
    toggle a latch line to set the bits to the outputs (display them).
     
    Tim Mitchell, Nov 10, 2004
    #10
  11. I've done 96 LEDs using a PIC 18F242 and 6 Allegro A6276 16 bit shift
    register/driver chips, which works really well. I use software
    generated PWM to allow each LED to have an independent 8 bit brightness
    level, controlled by an RS485 input.

    Martin
     
    Martin Walton, Nov 10, 2004
    #11
  12. Scott Hooper

    Scott Hooper Guest

    That sounds pretty good. Are you able to point me to a schematic &
    matching code example of that scenario?
     
    Scott Hooper, Nov 10, 2004
    #12
  13. Scott Hooper

    Dorsai Guest

    (Scott Hooper) banged on the keyboard until
    producing
    Google 74154 decoder, you'll turn up the whole datasheet for it. Can't
    help you with the code - I'm an Atmel weenie :)

    --
    * * * * * * * * * * * * * * * * *
    Dorsai - Author of Erotic Fiction
    http://www.asstr.org/~Dorsai
    * * * * * * * * * * * * * * * * *
    Yoda of Borg am I. Futile is Resistance...Assimilate you, I will...
     
    Dorsai, Nov 10, 2004
    #13
  14. Scott Hooper

    Byron A Jeff Guest

    -> I have done it using 74HC595 serial to parallel chips. 8 leds off each
    -> chip, and you just chain them together, the whole thing becomes one big
    -> serial shift register requiring only 3 pins from the micro. They will
    -> drive low current LEDs directly or add a ULN2803 driver chip to drive up
    -> to 500mA per output. Cheap and it works.
    -

    Since this would have been my suggestion I guess I'll enter here...

    -Hi Tim,
    -
    -This sounds like exactly the sort of thing I'm after. I google'd that
    -chip and it does sound like the chip for the job. A few questions:
    -What PIC did you use?

    Doesn't really matter. You could make your life a bit easier if you used a
    PIC with a SPI module as you can clock out data up to 5 Mbps. In the 18 pin
    package I almost always recommend the 16F88, which has SPI and a nanowatt
    module so you don't even need an external crystal to run it.

    - Do you have a schematic of how it goes together?

    No. But it's not too difficult to walk through. The toughest problem is that
    each of the LEDs will require an individual resistor. Look to get DIP resistor
    packs with a common end, which for 16 pin parts will give you 15 resistor ends
    per pack. You'd only need 7 of them.

    Also make sure you get 74HC595 or 74HCT595 parts. They are pretty much
    guaranteed to swing from rail to rail.

    Finally you may want to take care in driving both the latches and clocks for
    the 595s. 17 pins is a lot to drive. You may want to add a buffer between the
    PIC output pin and those inputs. For example a single 74HC04 inverter will
    give you 6 outputs so you could connect latches/clocks in groups of 3.

    Back to the circuit. The 595 is a serial to parallel converter. You clock in
    8 data items using the clock input. Then you latch them to the output using
    the latch. They can be daisy chained by using the always on Q7 output as the
    input into the next 595.

    With SPI it's pretty simple. Wire up the first data input to the SPI output and
    the other Q7 outputs to the suceeding data input of the next 595. Then wire
    all the clocks together (fanning it out with the 6 inverters described above).
    Then program the 16F88 to clock the data out. 13 writes to the SPI transmit
    buffer and you're done. You'll need another pin for the latch too (again
    fanned out with another HC04 inverter)

    Now for each LED wire the anode to a 595 output. Wire the cathode to one of
    the resistors on the resistor packs. Finally ground the common end of each
    resistor pack.

    Voila! you're ready to program.

    Of course I'd suggest testing with 16 LEDs, 2 HC595s, and a resistor pack or
    two until you're sure it works right. Then add the rest.

    BAJ

    -Do you have a source module available?

    Probably a custom project. Most folks with this many LEDs would multiplex them
    so it's not very likely that you'll see a whole lot of compatible code.

    - What language/compiler was -used? (I did say a few questions :) )

    I'm of two minds on this: PIC assembly is best because everyone knows it.
    However like all assembly languages it's a bit tough to chew on. I have a
    couple of other language possibilities on my PIC languages page here:

    http://www.finitesite.com/d3jsys/languages.html

    - Lastly, something confuses the
    -heck out of me... I can see that you can daisy chain the 74HC595 chips
    -together, but how do you tell your PIC which one to address?

    You don't. You serially clock in 112 bits which gets clocked into the 13 HC595
    which are daisy chained. So if you want to change one, you have to reclock all
    of them. But it's so simple with SPI when you have it, it's really not an
    issue.

    -
    -To everyone that replied, thank you very much. But I am quite the
    -novice and hoping that someone can provide me with a PIC-compatible
    -schematic/source-code combo

    I don't think you're going to find a lot of code hanging around, especially
    for newer chips with SPI available. While you are a novice, you have already
    been given quite a few resources, and also there are folks hanging around here
    and places like the PICLIST (www.piclist.com) that would be glad to help.

    Here's a sample of a tutorial that may help:

    http://homepages.which.net/~paul.hills/Software/ShiftRegister/ShiftRegisterBody.html

    BAJ
     
    Byron A Jeff, Nov 11, 2004
    #14
  15. Scott Hooper

    Byron A Jeff Guest

    -
    -
    -Scott Hooper wrote:
    -
    -> I am new to electronics, but a programmer by trade. I am trying to
    -> achieve a circuit of up to 100 independently controlled LED's (not
    -> segmented display modules). Ideally the circuit would be controlled by
    -> one or more PIC microcontrollers as I have a Willem II programmer. My
    -> application is artistic in nature and requires the leds to be spread
    -> out over a wide area as opposed to being in a grid formation.
    ->
    -> I have heard a lot of conflicting reports about Maxim's MAX721xx chips
    -> for this job. Some say it's the one I want, but others (including an
    -> actual Maxim tech-supporter) say it's more suited to the segmented
    -> displays. I have experimented with this chip with little success.
    ->
    -> Has anybody achieved anything like this? I have scoured the Internet
    -> and newsgroups for literally weeks looking for a matching schematic
    -> and source module. I have found a few Basic Stamp modules but I'm not
    -> setup for that at all and would rather stick with native PIC. The only
    -> compiler I have is MPLab's MPASM.
    ->
    -> Many thanks to anyone that can help
    -
    -Why not several PICs 1 master and the rest slaves.

    Because he's a novice and multichip communication isn't something that a
    novice needs to be doing.

    Keep it simple. That's the path to success. Even if there's more wiring
    involved.

    BAJ
     
    Byron A Jeff, Nov 11, 2004
    #15
  16. Scott Hooper

    Byron A Jeff Guest

    ->
    -> Get yourself some 74154 decoder chips. 4 inputs to 16 outputs; active-low
    -> on the output. A couple of these as a matrix would give you 16^2
    -> capability for only 8 output pins (or even only 5 if you commoned the
    -> inputs and used a line for device select).
    -
    -That sounds pretty good. Are you able to point me to a schematic &
    -matching code example of that scenario?

    First off all we'd do is what you'd do: Google from 74154 and PIC and hope that
    something pops up.

    Secondly this path has some serious issues involved that you need to know
    about. The concept is called multiplexing, and it's how most large displays
    are addressed. It cuts down on the number of parts reqired. but on the other
    hand is much more difficult to manage. First off you can really only turn on
    (or off) one LED at a time. So this means that you'll get a flickering display.
    Worse than that is trying to manage 128 LEDs means that each can only be on
    1/128 of the time. So that means everything is going to be really, really dim.
    To make it work you then have to delve into power electronics, which as a
    novice is somewhere you really don't want to go.

    Stick to the HC595 serial interface. Yes it means that you'll have 13 of them
    on the board along with at least 7 resistor packs. But it's easy to understand
    and each LED can be on or off completely independantly of the others.

    Also be sure to download a copy of the PIC Midrange Reference Manual off of
    Microchip's site. It'll give you pointers and example code as to how to use
    stuff.

    Good Luck.

    BAJ
     
    Byron A Jeff, Nov 11, 2004
    #16
  17. Scott Hooper

    Rich Walker Guest

    We did something like this with lighting panels with 2 separate circuits
    on each panel. The PICs were interconnected with CAN, with a local DIP
    switch to set the address of each one. The PWM outputs were used to
    drive the LEDs on the panels via a couple of MOSFETs. It was pretty nice
    to do.

    cheers, Rich.
     
    Rich Walker, Nov 11, 2004
    #17
  18. Scott Hooper

    Scott Hooper Guest


    Hi Martin,

    Would there be any chance of seeing your circuit and the code you used?

    Thanks,
    Scott Hooper
     
    Scott Hooper, Nov 11, 2004
    #18
  19. Scott Hooper

    Mike Eck Guest

    How about an LED driver IC? The MM5451 contains a 35 bit shift register,
    latches and variable current-limited output drivers. Three of these chips
    will individually control over 100 LEDs with no external drivers and no
    current limiting resistors. They cost about $2 each. What more could you
    want?

    http://www.micrel.com/product-info/products/mm5450.shtml
     
    Mike Eck, Nov 12, 2004
    #19
  20. Or this,
    http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3195

    64 discrete LEDs with the MAX6951. It's more expensive, though, and I cannot
    find it at Digikey. Anyone have any experience with the MAX6951 -- suppliers,
    availability, various performance issues, comments, etc?

    Jon
     
    Jonathan Kirwan, Nov 13, 2004
    #20
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.