[b]Help Controlling LEDS[/b]

Discussion in 'Embedded Systems and Microcontrollers' started by armyman_talha, Jan 16, 2012.

  1. armyman_talha

    Thread Starter New Member

    Jan 16, 2012
    3
    0
    Help Controlling LEDS

    I am new to Microcontrollers and wanted to become more familiar with it so that I can do big projects .... I wanted to know how to control a number of LEDs more than Output ports on Microcontroller ..

    For example ,
    Microcontroller has 32 I/O pins and i want to control 40 leds , how can I do it .?

    I want to know more and more about controlling LEDs like 6x20 led matrix display for whole word display with a software on computer or keypad attached to circuit board .

    I am using PIC16f877A and I have made a development board for it and also have a parallel port programmer .

    Anyways thanks for reading .
     
    Last edited: Jan 16, 2012
  2. ajm113

    Member

    Feb 19, 2011
    176
    5
    There are a couple of ways about doing this.

    1. Use shift registers. (You may only need to use 3-4 pins with this this method is a bit slower then others.)

    2. LED Driver (They make millions just look at the datasheets! D: )

    3. Multiplexing. (It's the brute force approach the method I think your thinking)
    http://www.youtube.com/watch?v=lZyc6ulpkyM
     
    armyman_talha likes this.
  3. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,388
    1,605
    Google Charlieplexing.
     
  4. CraigHB

    Member

    Aug 12, 2011
    127
    15
    I've heard the term before, but never looked it up. Wikipedia has a quick rundown, interesting. Funny they used the guy's first name. Says he's with Maxim, great products.
     
  5. MrChips

    Moderator

    Oct 2, 2009
    12,440
    3,361
    If you multiplex two 8-bit ports you can control 64 LEDs.
     
  6. Eric007

    Senior Member

    Aug 5, 2011
    1,044
    33
    How would you go for it? How many transistors you use? And can you control each individual LED out of 64?
     
  7. MrChips

    Moderator

    Oct 2, 2009
    12,440
    3,361
    You don't need any transistors. And really, you don't need any extra components either. But to be on the safe side I would include eight resistors, about 220-ohm, just to limit the current.

    You will be able to control each LED and create any pattern you desire. Only one LED will ever be on at a given time but it happens so fast you will think multiple LEDs are on.

    Imagine a grid of 8 horizontal wires and 8 vertical wires. The LEDs are wire at the intersection of the grid wires. (The grid wires can be as long as you wish so you can create any physical layout.)

    At any given time only one of 8 lines is a source (HIGH) and only one of the other 8 lines is a sink (LOW). Hence only one LED will be lit. You cycle through your pattern fast enough to light all the LEDs as desired.
     
    armyman_talha and Eric007 like this.
  8. MrChips

    Moderator

    Oct 2, 2009
    12,440
    3,361
    If you want to make an LED message board, then you can make it 8x32 or 8x64 LEDs etc.

    For this you will need one 8-bit port and one 5-bit or 6-bit port driving a 5-to-32 or 6-to-64 decoder.
     
    armyman_talha likes this.
  9. Eric007

    Senior Member

    Aug 5, 2011
    1,044
    33
    I will definately discuss something like this in near future when I have time...
    Btw I like learning how to do stuffs...I'm always on when it comes to MCU...
     
  10. MMcLaren

    Well-Known Member

    Feb 14, 2010
    759
    116
    May I ask what kind of brightness you might expect from the 1/64th duty cycle method you're describing? Is that 25 ma "peak" current (if you're lucky) divided by 64 = 0.78 ma "average" current per LED?
     
    Last edited: Jan 16, 2012
  11. MMcLaren

    Well-Known Member

    Feb 14, 2010
    759
    116
    Some other multiplexing methods might allow for relatively high performance (higher duty cycle and refresh rate, better brightness, fade-to-black PWM brightness control, etc.) with as little as eight, nine, or ten I/O pins.

    [​IMG]
     
    Last edited: Jan 16, 2012
  12. armyman_talha

    Thread Starter New Member

    Jan 16, 2012
    3
    0
    Thank you guys......Thanks all of you . You guys gave me a path , now i can search and learn about shift registers and decoder
     
  13. armyman_talha

    Thread Starter New Member

    Jan 16, 2012
    3
    0
    Thanks man , Thank you all guys for help
     
  14. Eric007

    Senior Member

    Aug 5, 2011
    1,044
    33
    MMclaren...I love that! We gon discuss that later...I must do one of these when I have time...
     
Loading...