Shop OBEX P1 Docs P2 Docs Learn Events
3x3x3 Led cube — Parallax Forums

3x3x3 Led cube

BritannicusBritannicus Posts: 98
edited 2012-04-06 00:37 in BASIC Stamp
I've been tackling a very simple project building a 3x3x3 led cube and running it from a 555 timer and a 4020 binary counter, this provides outputs which essentially switch on and off strings of 3 LEDs in patterns. I thought this was cool for a couple of hours and a £2 investment.....

then I looked at youtube and got jealous !

I now want to build a larger matrix - or at least a 3x3 where each LED is able to be operated independantly of the rest (instead of 3's) . I'd like my BS2 to do this, but the little rascal of course has only 16 pins! .

So here's the question - I'm seeing people building much more complex arrays and wondering - my original thought was to have a series of 3 buffers, each get the same 9 pin outs, but then I use 3 further pins to decide whether the buffer is on or not. Of course this doesn't work well enough to give me all 27 variables - most permutations would not be available. This would allow me to at least have any one single LED illuminated, and have planes and strings though, bu tnot the full 134,217,728 variations from all off to all switched on.

How can I drive any permutation of LEDS (from say 27 for a 3x3) from only 16 pins. Is there a cheap IC that I can, for instance, that would take a serial input and create a parallel 27 bit output ??

I'm looking at LED sceens and thinking these use far more options so there must be a way to crack it ?

C'mon guys - you've never let me down for brilliant solutions in the past - what can be achieved here. I was stunned by some of he 3d renditions on the 100 x 100 x 100 cubes - but that's a bit beyond my budget

Comments

  • ZootZoot Posts: 2,227
    edited 2012-03-08 12:29
    Use shift registers (i.e. 74HC595), daisy chained. This will let you control many, many outputs (LEDs) with just three pins. You can even get shift registers with built in darlington transistor buffers to drive LEDs very brightly. You use SHIFTOUT with these devices; there are good examples in the Stamp documentation.
  • Martin_HMartin_H Posts: 4,051
    edited 2012-03-08 12:53
    If you use row column addressing with three pins as level (row) selectors and nine pins as LED (column) selectors you should be able to drive the whole thing with 12 pins.

    If you Charlieplex (http://en.wikipedia.org/wiki/Charlieplexing) you can drive n*n-n pins, but the wiring can get pretty hairy. I used a combination of row column addressing with charlieplexing for my LED Marquee to drive 192 LED's. Here's the thread:

    http://forums.parallax.com/showthread.php?136152-LED-Marquee-Module-for-Gadget-Gangster-Platform-%28w-video%29&highlight=rgb+matrix

    An LED cube isn't that much different, just a different topology.
  • ZootZoot Posts: 2,227
    edited 2012-03-08 14:29
    LED cubes don't really lend themselves to charlieplexing, because the structure itself is the wiring.
  • Martin_HMartin_H Posts: 4,051
    edited 2012-03-08 19:01
    Zoot wrote: »
    LED cubes don't really lend themselves to charlieplexing, because the structure itself is the wiring.

    This will drive me crazy now trying to think of a way to get this working. With my marquee I Charlieplexed alternate columns by alternately biasing the diodes. Couldn't you do the same thing with levels in a cube?
  • ercoerco Posts: 20,256
    edited 2012-03-08 19:19
    Martin_H:

    Whatever you do, don't become obsessed by this. Do NOT allow it to become your singular-focus object of fixation. I forbid it!
  • ZootZoot Posts: 2,227
    edited 2012-03-08 19:52
    Martin -- it's not that it *can't* be done, but you'd need extra wiring above and beyond the grid structure of a "regular" LED cube, which has no "wiring" per se; the actual LED pins form the grid of the cube.
  • Martin_HMartin_H Posts: 4,051
    edited 2012-03-09 07:04
    erco wrote: »
    Martin_H:

    Whatever you do, don't become obsessed by this. Do NOT allow it to become your singular-focus object of fixation. I forbid it!

    Curse you Erco!
    Zoot wrote: »
    Martin -- it's not that it *can't* be done, but you'd need extra wiring above and beyond the grid structure of a "regular" LED cube, which has no "wiring" per se; the actual LED pins form the grid of the cube.

    Zoot, this is what I'm thinking:

    LED_cube.jpg
    739 x 460 - 73K
  • BritannicusBritannicus Posts: 98
    edited 2012-03-12 05:44
    Hi Guys,

    As always loads of help .....

    Charlieplexing seems a wonderfully elegant solution, but I figurethat the shift register seems simpler for a very small investment in this case .

    However Charlieplexing is so elegant I want to understand it better ... I'm kinda still trying to get my head areound the permutations involved - I'm still looking at the wikipedia article and thinking to myself - If Pin 1 is High and Pin 3 is 0V - won't LED 1,3 and 6 all light whatever the state of PIN 2 ? - I'm missing something very obvious
    .

    3_Pin_Charlieplexing.png
  • Martin_HMartin_H Posts: 4,051
    edited 2012-03-12 06:37
    However Charlieplexing is so elegant I want to understand it better ... I'm kinda still trying to get my head areound the permutations involved - I'm still looking at the wikipedia article and thinking to myself - If Pin 1 is High and Pin 3 is 0V - won't LED 1,3 and 6 all light whatever the state of PIN 2 ? - I'm missing something very obvious

    Charlieplexing confused me at first too. It works because a pin can have three states: output high, output low, and input. In your three pin example two pins will be set to output high or low state, while the third will be set to input. When a pin is in input state it and the LED's the source or sink from it effectively drop out of the circuit. The more pins you add the more complex the wiring, but the concept remains the sample. The LOL shield is able to drive a decent size matrix using this technique. The downside is complex wiring and you can only light one LED at a time, so you sweep through the LED's quickly to display your image.

    But you don't have to go all in line the LOL shield does. In the marquee and my example above I used it as a way to half the number of pins used in one axis of a row column scheme. I'm pretty sure I could pull off a 4 x 4 x 4 cube with 12 pins.
  • ZootZoot Posts: 2,227
    edited 2012-03-19 10:05
    Britannicus -- not sure why you wouldn't just use 9 pins for Anodes (one pin for each led in a "layer") and then 3 pins for the Cathodes of each layer? Talkiing about regular multiplexing here.

    In a regular LED cube where the led pins themselves form nearly all wiring and structure for the cube, all cathodes of a layer are tied together, and then the anode of each led in a layer is tied to the anode of the led above/below.

    Each cathode layer is brought low (one a time) and the appropriate anode(s) for the leds lit in that layer are brought high. Then the cathode for that layer is brought high (to turn it off) and the next layer is done.

    In some of my cubes (depending on the controller and how many leds in a layer) I sometimes add a transistor on each cathode pin to handle current consumption. For a 3x3x3 you need 12 pins. For a 4x4x4 you need 20 (though at that point shift registers for the anodes is a better idea as it brings the pin count down to 7 pins and makes current consumption a trivial issue.

    Martin_H -- charlieplexing is a great schema, but I'm still not sure it lends itself to LED cubes, where the structure of the cube *is* the wiring. The wiring for cplexing would be complex enough that I don't see how you would get a clean looking cube?
  • Martin_HMartin_H Posts: 4,051
    edited 2012-03-19 10:13
    Zoot wrote: »
    Martin_H -- charlieplexing is a great schema, but I'm still not sure it lends itself to LED cubes, where the structure of the cube *is* the wiring. The wiring for cplexing would be complex enough that I don't see how you would get a clean looking cube?

    In my diagram above I alternately biased the levels, so a single level pin controls two levels. Otherwise the wiring is like a normal cube. If you didn't do the alternate biasing by levels, but within a level I think it would have more impact.
  • BritannicusBritannicus Posts: 98
    edited 2012-03-19 13:14
    As always guys a ton of stuff to get my head round here - solving the problem isn' tthe fun bit, it's what you learn on the way - I'm going to have Soo much fun on this one - off to think of a way to build a really clean 4 X 4 now (welll not quite straight away - got to fit out my 6 year old's bedroom - He's got Down's syndrome and loves lights so he's going to have the coolest ever night light.... 4X4 and twinkling !! ) - I'll keep you posted

    cheers A
  • BritannicusBritannicus Posts: 98
    edited 2012-04-02 08:15
    Zoot Quote "Britannicus -- not sure why you wouldn't just use 9 pins for Anodes (one pin for each led in a "layer") and then 3 pins for the Cathodes of each layer? ".

    HI Zoot - just trying to get my head round this, as I think there's something I dont understand - from what you say I don't think you would be able to get every combination to light.

    If i connect every layer to a common cathode ( A top, B middle, C bottom) then I number each vertical from 1 to 9 I can refer to each LED by 1A 9B etc.


    So if I want 1B only to light - I set anode 1 to Hi and cathode B to low leaving A and C at high - this will light only 1B, I can get my head round that.


    So if I want 1B to light at the same time as 2 A I have a problem - Anode 1 and 2 have to be high, and Cahode B and A have to be low, BUT - in that case 1A and 2B should also light shouldn't they because they share common cathodes / anodes?. 1C and 2C won't light of course, because I keep C at High.

    So I can't have every one of the various options from 1 on to all on and every permutation between. Have I missed something very obvious ? (I ususally do !)
  • ZootZoot Posts: 2,227
    edited 2012-04-02 10:23
    With multiplexing (and this applies to LED cubes, or 7-segment multidigit displays, LED scrollers, etc), you make each common set of cathodes LOW, and light whichever anodes in that layer need to be on, then the cathodes are all brought high (or input) and then the next layer is done, then the next).

    You don't light two leds in different layers at once (you can't). Basically, each layer is active 1/3 of the time (for your 3x3). The trick is to all this fast enough so that the eye is fooled into thinking all layers active at once. I generally try to get the rate to at least 300 hz to avoid "flicker".

    This article may help: http://en.wikipedia.org/wiki/Multiplexed_display
  • BritannicusBritannicus Posts: 98
    edited 2012-04-06 00:37
    Cheers Zoot - thanks for that _ I can see how that would work... thought there was something I was missing :-)
Sign In or Register to comment.