# How much current can arduino ground absorb for 4x4 cube?

I am currently working on an LED 4x4 cube, so here is my pre planned circuit diagram.

Circuit Diagram

Cube Wiring

I am to connect 220ohm to each positive terminals.(16)
I am to use 4 transistors(2n2222) for 4 negative layers of which, collector terminal will be connected to the negative terminal layers , base will be connected to 4 analog pins through 1k ohm.

Can I run them all together?

If no?

Is there any way to make it?

Explanation with circuit diagram will highly be preferred...

With a cube wired like this, you have to multiplex by layer, so only one layer will be on at any instant, not all 4.

The atmega328 chip (assuming that is what you are using, you forgot to mention) can only source a maximum of 200mA, so you must choose your resistors to keep under that limit.

There are also limits for the current that can be sourced by groups of pins, so you should make sure you do not exceed those also.

The led series resistors must be calculated using the forward voltage of the leds. Red leds are typically 1.8~2V and blue and white leds are around 3~3.5V. Yellow and green are somewhere between.

So if your leds are red, 16 leds could draw (5-1.8 )/220×16=230mA, which could damage the arduino.

With blue leds, (5-3.2)/220×16=130mA, so probably not a problem, but they will not be as bright as the red leds.

I don't know why your simulator says 1A per layer, I think you did something wrong there.

Maybe, I did some wrong there as a very beginner , but I want to use the ultra bright blue led ones.
By the way, from where did u get the value 220 ?

Please don't mind, I am absolute begginer and just a little newbie in the field.

from where did u get the value 220

Oh alright , thats the formula of I = V/R , I didn't recognize it at first , sorry again, I know I may be annoying sometimes but pardon me please as I am a newcomer ...

So, If I make a voltage amplifier, will I be able to run all LEDs at same time then?

Also, I have solved the problem correctly now of which I made a mistake and output was 1A

I = (5 - 3.2)/700x64

If I use 700 ohm, I should be able to use all LEDs in less brightness.

No, you must try to understand the concept of multiplexing. In your cube, only 1 layer of 16 leds will be lit at the same instant. So the current is ×16, not ×64. But the code will switch between the 4 layers at such a high speed that it will appear to the eye that all layers are lit at the same time, even though they are not.

Using a technique like optical illusion , nice, then what should the 'delay();' interval be?

Will delay(10); work?

While this may be good practice for a bigger cube and presumably is the motivation for doing it "the hard way", the most sensible way to implement a 4 by 4 by 4 as such is to simply use a MAX7219.

The effect is called "persistence of vision".

If the switching between the layers is too slow, the cube will flicker visibly. You want each layer to be lit at least 50, ideally 100 times per second. That means all 4 layers lit in 10 to 20ms. Each layer must be lit for no longer than 2.5 to 5ms. So try delays in that range. Note that you cannot have delay(2.5) because delay expects an integer and the 0.5 will be ignored. You can have delay(2) or delay(3) or delayMicroseconds(2500).

When your coding skills improve, you will probably want to stop using delay() at all because it wastes useful processing time. Then you can begin using millis() or micros() instead. But delay() is ok for now.

Thank you, this helped me a lot

Option A

Option B

Well now I am confused, which blue led should I use option A or B

I actually want to use option A

But I think using option B would be better for my arduino as I don't have any external voltage source for the option A LEDs right now.

What do u think about it?

Option B might be better for a cube because they appear to have diffused lenses, which would make the cube easy to see at any angle.

As for your external voltage source, I have no idea. You posted only pictures with no specifications.

I will make another topic if I face any problem in external voltage system, let's not discuss it here OK, finally , I have to use the option B then , Thank You So Much,

Your recommendations are going to help me a lot in future

I did not say you have to use option B. I have no idea why you think you need external voltage source with A but not with B. I suspect that is a misunderstanding on your part, but you have shared no details about it. I think the 2 LEDs will have very similar specs.

bitrux:
I will make another topic if I face any problem in external voltage system, let's not discuss it here

Cross-posting - multiple posts on the same project - is strenuously discouraged here because it wastes peoples time trying to put together all the different aspects of the project if the description is spread across seemingly unrelated threads of discussion.

If you start another thread, it will be reported to a moderator and merged back to this one.

Well. OK whenever I will talk about it, I will do it here ..

By the way, in shops near me, all the LEDs which are sold are of Option A (Non diffused LEDs , Ultra bright ) so do you know the exact voltage drop of those LEDs?

I have searched many data sheets and compared them, the Vf seem to be almost 3.2 which is almost same to the diffused ones.

And what about removing the transistor at common negative layer terminals ? Instead that can I connect those pins to the analog (d14 - d19) pins?

Whether the encapsulation is diffused or not makes no difference whatsoever to the operating voltage. Why would it?

Purely a cosmetic matter.

And what about removing the transistor at common negative layer terminals ? Instead that can I connect those pins to the analog (d14 - d19) pins?

Well, you could, but without the transistor you will need to limit the layer current to 32 mg - resistors set to limit LED current to no more than 2 mA and even then the layer-to-layer brightness will fluctuate according to how many LEDs in that layer are lit.

If you want to drive the LEDs with more than 2 mA, you need the transistors.

Brother can you please review my code ?

``````#define Layer0 16
#define Layer1 17
#define Layer2 18
#define Layer3 19

int arrayOfLayers[4] = {Layer0, Layer1, Layer2, Layer3};

void setup(){

for(int x=0;x<=19;x++){

pinMode(x,OUTPUT);

}

}

void loop(){

int x,y,z;

for(x=0;x<4;x++){

digitalWrite(arrayOfLayer[x],HIGH);

for(y=0,y<=15;y++){

digitalWrite(y,HIGH);
delayMicroseconds(2);

}

digitalWrite(arrayOfLayer[x],LOW);
delayMicroseconds(2);

}

}
``````

and with transistors, I will be able to manage all 16 LEDs in one layer right?

bitrux:
I have searched many data sheets and compared them, the Vf seem to be almost 3.2 which is almost same to the diffused ones.

They will be almost the same. Only the plastic lens is different.

bitrux:
And what about removing the transistor at common negative layer terminals ? Instead that can I connect those pins to the analog (d14 - d19) pins?

Yes, you can. But those pins have a limit of 40mA before they will be damaged, so you need to make sure you keep well below that, like 20~30mA. To do that, you will need to increase the series resistors so that less than 2mA flows through each led. Obviously, less current means the cube will be less bright.