Arduino Forum

Using Arduino => LEDs and Multiplexing => Topic started by: 012anonymousxyz on Jun 03, 2013, 02:46 am

Title: Multiplexing Basics With Arduino Due - How Do I Make the LEDs brighter?
Post by: 012anonymousxyz on Jun 03, 2013, 02:46 am
I have a 4x4x4 RGB LED cube. It is set so that each layer's anodes are all connected together. So 4 i/o's per layer.
Then, each column's red cathode, green anode, and blue anode are connected vertically. So 3 cathodes times 16 columns is 48 io's.

Now the problem:
1. I find that my cube is brighter when I set every output of one color (lets say green) to high, rather than if I turn each LED on rapidly which is the essence of multiplexing. When I multiplex, they are ridiculously dim. And they are still dimmer than they should be when I set every io to high. They are just not-as dim.

I don't have the code with me (on school computer) but this is I guess what it looks like:
Code: [Select]

for(int i=2; i<=17; i++){
  digitalWrite(i, HIGH);
  delayMicroseconds(anAmount from 0 to 250ish);
  digitalWrite(i, LOW);
}

And of course in setup I turn everything else low.
The anAmount variable is there because I found that my LEDs get a slight bit brighter at 200 delay before they start blinking.

I'm not sure if delays are included in "proper" multiplexing. And I don't know why my LEDs are so dim. Something to do with power I suppose.

On a side note (I'd be happy if you answer only the above but I'd appreciate an answer to below as well):
I've also seen some crazy videos of 16x16x16 cubes. I was wondering how so many LEDs can be controlled. I already have the biggest Arduino out there and I've essentially already hit the cap on io limit.

A second thing is I want to create an expanding "sphere" of color. That is to say, the innermost 4 LEDs at the center are blue and then the outer layer becomes blue while the innermost layer becomes red and then the next outer layer becomes blue while the layer that turned blue becomes red and the innermost layer becomes green. You know... like how you see in the videos. Fast forward to 2:16

http://www.youtube.com/watch?v=3K8i0JQzx2w

Now, one approach is ultra hard-code everything. But...I've heard the proper method is to use calculus to program cubes. Now I can set up some functions that take in 3d vectors (x, y, z) and turn my cube into a 3 dimensional Cartesian grid I guess. But I'm just not sure how the whole mechanism works out. How is this possible and could someone link me a tutorial? I could only find tutorials on WHAT multiplexing is and how to do simple multiplexing.

I really really appreciate it!
Title: Re: Multiplexing Basics With Arduino Due - How Do I Make the LEDs brighter?
Post by: 3dprinter on Jun 04, 2013, 05:02 pm
When you multiplex, the LED is not on all the time --> it appears dimmer.  The more LEDs that have to share their turn for being on, the dimmer it gets. Fact of life/multiplexing.

You can partially counter this effect by using "too much current" when it is on, but you wear the LED faster, you will damage it if you occasionally leave it on (f.ex a program flaw). Not recemended.

On a 4x4x4 your mutiplexning should be have them at a 4th of their "brightest" value, if you multiplex right. Your code seem to be lighting them a 16th of the time. Rethink your wiring/multiplexing.

Others use extra chips to control the LEDs for the bigger cubes to overcome the IO pin limitation. - TLC5940 is a good example.
Title: Re: Multiplexing Basics With Arduino Due - How Do I Make the LEDs brighter?
Post by: Grumpy_Mike on Jun 04, 2013, 05:51 pm
Quote
And they are still dimmer than they should be when I set every io to high.

How do you know how bright they should be?

A multiplexed LED will always be dimmer than one on all the time. It is the ratio of on to off that determines how bright it looks. This is known as the duty cycle, so if it is only on for one 10th of the time it will only be one 10th as bright. Well not quite because of the non linearity of the eye, but if it is only on one 10th of the time it is like putting one 10th of the current through it.
Title: Re: Multiplexing Basics With Arduino Due - How Do I Make the LEDs brighter?
Post by: 012anonymousxyz on Jun 04, 2013, 05:59 pm
@Msquare
You are right. I can actually toggle the four layers instead of the 16 colomns.
Even still, how do you suppose the giant cubes do it? Just hooked up to faster processors?
Or a trick of the light with a very dark room.
Title: Re: Multiplexing Basics With Arduino Due - How Do I Make the LEDs brighter?
Post by: fungus on Jun 04, 2013, 06:29 pm

@Msquare
You are right. I can actually toggle the four layers instead of the 16 colomns.
Even still, how do you suppose the giant cubes do it? Just hooked up to faster processors?
Or a trick of the light with a very dark room.


8x8x8 cube is only 8:1 multiplexing.

For 16x16x16 maybe they light up two layers at a time. Or dim the lights before recording. It gets difficult at those sizes.
Title: Re: Multiplexing Basics With Arduino Due - How Do I Make the LEDs brighter?
Post by: runaway_pancake on Jun 05, 2013, 02:13 am
Bigger cubes could be set up as several smaller cubes in synchronisation, each managed by its own processor.
Title: Re: Multiplexing Basics With Arduino Due - How Do I Make the LEDs brighter?
Post by: 3dprinter on Jun 05, 2013, 08:51 pm
The average cube is set up multiplexed to reduce the number of wires, and for the "sexy" features that the wiring is also the matrix/supportframe. But you could also have every LED with its own wires and the support be something else.