Microcontroller LED Control?

Discussion in 'Embedded Systems and Microcontrollers' started by masteropie, Jun 21, 2008.

  1. masteropie

    Thread Starter Member

    May 17, 2008
    26
    0
    Hello.
    What is the best way to scan a bar of 60 LEDs from on to off then back on again via trigger pulses. Like this:
    -power on
    -all led's on
    -trigger pulse
    -led 60 on
    -led 1 off
    -trigger pulse
    -led 1 on
    -led 2 off
    -trigger pulse
    -led 1 on
    -led 2 off
    -etc.

    So the microcontroller will need 60 outputs and 1 input? Any recommendations on a model? What is involved in this?
     
  2. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Your sequence doesn't seem to make sense. You start with all 60 LEDs on, and then you receive a trigger pulse. Then you say you want LED 60 on, but it's already on. LED 1 off makes sense.
    The next trigger sequence makes sense, but the 3rd is a repeat of the 2nd - there would be no visible effect.

    What exactly is the sequence you are trying to create? That will have a great bearing upon what kind of peripheral IC's you'll need.

    And is it simply a single long bar of 60 LEDs?
     
  3. masteropie

    Thread Starter Member

    May 17, 2008
    26
    0
    For simplicity well just say they all start off, just a matter of programming. Each pulse moves the on led one place right. At the end it returns to the left and starts all over seamlessly.

    I have a very simple encoder to makes a pulse every rotation when you spin it. I was thinking it would be cool to control this big bar of LED's i have with it.
     
  4. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    OK, have a look at the attached.

    It allows for individual control of 36 LED's using 8 output lines from a uC. All LEDs should be the same type. Resistors should limit current to 20mA if you're using a PIC; calculate the LED resistors as you would normally, then divide the result by two:
    Rlimit = ( (Vsupply - Vf(LED) ) / I(LED) ) / 2
    This is because current comes out one pin and goes in another; the two resistors in the path will be in series.

    You need to light 60 LED's - just add more pins and LEDs in the manner I have shown. The next pin will add 10 LED's; the one after that, 12 more for 58.

    To turn on just one LED, set all of the uC's pins to input mode except for the two lines that connect to the anode and cathode of the LED to be illuminated.

    You could produce interesting patterns by turning an LED on for a bit, then turning it off and turning another LED on somewhere else - repeat.
     
    Last edited: Jun 22, 2008
  5. masteropie

    Thread Starter Member

    May 17, 2008
    26
    0
    Ahhh, great!

    Thanks!
     
Loading...