Electronics dynamically control a bunch of LEDs?

Discussion in 'Modding' started by mcshaggy, 15 Jun 2004.

  1. mcshaggy

    mcshaggy What's a Dremel?

    Joined:
    28 Mar 2004
    Posts:
    184
    Likes Received:
    1
    how can you control about 50 LEDs and program different sequences for them to do? or even be able to turn one led on at a time. anything along those lines.
    i guess thats a pretty broad question but any ideas will be appreciated
     
  2. BlackMan

    BlackMan Minimodder

    Joined:
    12 Sep 2003
    Posts:
    325
    Likes Received:
    0
    well i would think that you could use a pic controlled circuit that should do it, but 50 led's is a lot
     
  3. FourDee

    FourDee What's a Dremel?

    Joined:
    6 Mar 2004
    Posts:
    136
    Likes Received:
    0
  4. mcshaggy

    mcshaggy What's a Dremel?

    Joined:
    28 Mar 2004
    Posts:
    184
    Likes Received:
    1
    my german is limited and it sucks :/ i cant figure out 99% of whats being said there. i know 50 LEDs is a lot... heh. theres 64 pin pics right? i dont think id ever be able to solder something like that, or afford it.
     
  5. cpemma

    cpemma Ecky thump

    Joined:
    27 Nov 2001
    Posts:
    12,328
    Likes Received:
    55
    Use the power of the matrix, 64 leds only need a 16 bit word to decide which ones light up.

    Lots of ideas at Computer Christmas and Discolitez.
     
  6. mcshaggy

    mcshaggy What's a Dremel?

    Joined:
    28 Mar 2004
    Posts:
    184
    Likes Received:
    1
    the matrix? you mean like have all the anodes connected in rows and cathodes in columns? with that having 2 leds lit could possibly cause other LEDs to light up that you dont want lit, right? maybe youre talking about some other way though
     
  7. whypick1

    whypick1 The über-Pick

    Joined:
    17 Oct 2002
    Posts:
    2,014
    Likes Received:
    2
    Code:
      1 2 3 4 5 6 7 8
    A O O O O O O O O
    B O O O O O O O O
    C O O O O O O O O
    D O O O O O O O O
    E O O O O O O O O
    F O O O O O O O O
    G O O O O O O O O
    H O O O O O O O O
    
    It's that simple. Errantly turning on LED isn't a problem at all. For example, if I want to turn on the 2nd LED from the left on the top column, then (assuming #s go to anodes and letters to cathodes) all you'd have to do is turn output 2 high, and output A low (I'm reffering to TTL output levels, so high = 5v, low = GND), the other #s are kept low and the other letters high. 2A is the only LED that's biased correctly, as the others in column 2 see both 5v on both leads, and the rest in row A have both leads grounded. Heck, this could even be controlled by the parallel port with the help of a couple of ICs to sample and hold the // port's D outputs. Since it's an 8-bit output, one clock cycle would contain the data for the rows, and the other for the columns. The sample + hold ICs would be there to keep the data for the appropriate part of the matrix while the port sends out the data for the other one. Add a buffer capable of driving the LEDs directly, some resistors, and a basic program for controlling // output, and you've got 64 LEDs with almost unlimited amount of patterns at your control.
     
  8. mcshaggy

    mcshaggy What's a Dremel?

    Joined:
    28 Mar 2004
    Posts:
    184
    Likes Received:
    1
    well now thats the type of setup i was originally thinking of but i thought that say using your example of 1-8 and A-H and light 2b and 4d:
    Code:
      1 2 3 4 5 6 7 8
    A O O O O O O O O
    B O X O O O O O O
    C O O O O O O O O
    D O O O X O O O O
    E O O O O O O O O
    F O O O O O O O O
    G O O O O O O O O
    H O O O O O O O O
    
    wouldnt that also make b5 light? or not? im guessing not since you say it works, but i dont understand why it wouldnt light

    edit; you can have more than one on at a time with this setup, right?
     
  9. whypick1

    whypick1 The über-Pick

    Joined:
    17 Oct 2002
    Posts:
    2,014
    Likes Received:
    2
    Ok, this is another one of those times where what I'm thinking is right in my head doesn't jibe with reality. With what you just described, both 4B and 2D will light up, as all four are intersections between active columns and rows. One way around this is to oscillate between having 4D and 2B active really really fast so that the eye can't tell only one is on at a time. If they aren't on at the same time, there's no chance of other LEDs being errantly active.
     
  10. mcshaggy

    mcshaggy What's a Dremel?

    Joined:
    28 Mar 2004
    Posts:
    184
    Likes Received:
    1
    oscillating makes sense, but that would be a nightmare to do :worried: say i have an instance like i described above except with maybe 5 LEDs lit at a time down a diagonal like that. even with just the two i dont see how id be able to easily have whatever program controls it know that the two have to be oscillated opposite eachother\

    i could just settle with having a random LED lighting type thing, then it wouldnt matter if unwanted LEDs lit. i could also have an LED runner or have all on. i suppose i could just be a lot less picky than i really am and use this method. one question though, how many could i keep on at a time? wouldnt that be hard to program, having say 64 (all) on at a time? i dont know much of anything about parallel ports and the way you send data through them, but that seems like a lot.

    hoo i wish i was smarter in this newfangled electronics shtuff.
     
  11. SteveyG

    SteveyG Electromodder

    Joined:
    23 Nov 2002
    Posts:
    3,049
    Likes Received:
    8
    Code:
      1 2 3 4 5 6 7 8
    A O O O O O O O O
    B O O O O O O O O
    C O O O O O O O O
    D O O O O O O O O
    E O O O O O O O O
    F O O O O O O O O
    G O O O O O O O O
    H O O O O O O O O
    It's pretty simple to multiplex a display. All you need to do is cycle through all the columns, making 1 to 8 high in sequence (only one high at at time). At the time that one column is high, you'd make whichever row the LED(s) you want illuminated in that column low.

    It's easy to do this this a microcontroller. You could even program a microcontroller to decode a serial input from your computer to control your LED's.
     
  12. mcshaggy

    mcshaggy What's a Dremel?

    Joined:
    28 Mar 2004
    Posts:
    184
    Likes Received:
    1
    easy for someone who knows what their doing ;)
     
  13. mcshaggy

    mcshaggy What's a Dremel?

    Joined:
    28 Mar 2004
    Posts:
    184
    Likes Received:
    1
    so aside from resistors, maybe a capacitor, and the pic, would i need any other ICs? also what kind of pic would i be looking at. i know basically.... NOTHING about pics and looking at them gives me a headache because it looks like theres so many different kinds. im starting to wonder if undertaking something like this is a good idea :grr: i dont know anything about pics or how to program them
     
  14. SteveyG

    SteveyG Electromodder

    Joined:
    23 Nov 2002
    Posts:
    3,049
    Likes Received:
    8
    A PIC could be used on it's own to control the LED's without problems. You may end up adding an EEPROM if you want lots and lots of patterns programmed in though.

    I think I'm going to experiment with a similar idea, but with one of those pre-built 5x7 LED matrices, so when I finally get chance I'll post up the results.
     
  15. fg0d

    fg0d Banned

    Joined:
    18 Jan 2004
    Posts:
    779
    Likes Received:
    0
    well. shaggs. welcome to bit-tech.. the only thing i would say to you is use the search, this questions been asked alot :) :Search: and gl
     
  16. Hazer

    Hazer In time,you too will be relixalated

    Joined:
    14 Apr 2003
    Posts:
    957
    Likes Received:
    2
    Uh, never seen THIS asked before.

    One thing to note: This scheme will work, but each and every LED will require a diode in series. Since the voltage swing will be 5V, you dont want to constantly push the reverse voltage on the LEDs without a little extra buffering.

    On a side note: I would use 8 8bit latches. You would need 8 lines for sending the data out. Each latch (74HC573) would have its enable line controlled by a 3:8 decoder (74HC138). This would mean 3 more lines from the PIC to address them.

    Finally, one last line to enable the 3:8 decoder. You put a 8bit pattern (say row A) on your port (say port B). Then move your addressing for your first latch on portA (0x00). Lastly, you enable the decoder (bsf PORTA, 5) and latch the entire row in. Bring the enable low (bsf PORTA, 5) and do over again by changing the 8bit pattern on PORTB, incrementing the address, and keep going. This would fly through in microseconds.

    PS: I was reading PIC articles so I forgot this was not PIC specific. But guess what? You have an 8bit output on the parralel port, with 4 more selective outputs. Just enough to do this at 1MHz speed (74HC chips handle that very well).

    Oh Shaggs, look at my Sig and you can get a rough idea of what you can do.
     
  17. Hazer

    Hazer In time,you too will be relixalated

    Joined:
    14 Apr 2003
    Posts:
    957
    Likes Received:
    2
    OT: How many times must I whore my site before it gets stickied?


    :naughty: :naughty: :naughty: :naughty:

    :waah: :waah: :waah: :waah:

    :eeek: :eeek: :eeek: :eeek:

    :D :hehe: :D :hehe: :D :hehe: :D
     
  18. mcshaggy

    mcshaggy What's a Dremel?

    Joined:
    28 Mar 2004
    Posts:
    184
    Likes Received:
    1
    hazer, 80% of your post went somewhere 6 miles above my head. :worried: why would there be a reverse voltage going over the LED? and as fa as all that 8-bit latch stuff, i think i understand but not really.

    i will however take a look at your site when i get a chance.

    this project is going to take me months :grr:
     
  19. Hazer

    Hazer In time,you too will be relixalated

    Joined:
    14 Apr 2003
    Posts:
    957
    Likes Received:
    2
    Using the matrix example from before: Say you wanted to light up C3. You would bring row C high on the anode. In order to light just C3 LED, you must then bring column 3 low on the cathode, while keeping all other rows high. so for C3, your anode is high, your cathode is low and your LED lights. Well, all the other LEDs on column 3 have thier anodes high and thier cathodes high (they stay unlit). Still no problem here.

    But what about all the other LEDs? Only row C is high, so this means all other rows (A, B, D-G) have thier anodes low. All columns except for 3 have thier cathodes high. This means that 56 of your LEDs are now seeing reverse voltage. Depending on the LEDs your using, this may not be a problem. Then again, it might be a problem.

    Regardless, it takes at least 16 lines to control this matrix when 8 parallel latches need less. Later today, I might post up a quick example of the latch diagram.....
     
  20. cpemma

    cpemma Ecky thump

    Joined:
    27 Nov 2001
    Posts:
    12,328
    Likes Received:
    55
    It's already No.2 in the Useful Links, you want it higher up than Google? :D :naughty:

    Electronics4Idiots : Hazer's Tutorials - noobs start here :thumb: :read: :clap:

    The matrix example I had in mind was like this 8-channel 10-high spectrum analyser,

    [​IMG]

    The display is multiplexed, so only 1 column is in play at a time (led cathodes high or low), and only the leds in that column have high anodes, all others are effectively floating, so the reverse voltage problem doesn't apply AFAICS. ;)
     
    Last edited: 17 Jun 2004

Share This Page