Go Down

### Topic: 4x4x4 cube, PIN power limitations (Read 2485 times)previous topic - next topic

#### Rex_247

##### Feb 17, 2012, 09:27 am
I am going to be building an 8x8x8 LED cube. Whilst I am waiting on PSU, LEDs etc. I thought I would try a 4x4x4 to practice cube construction and basics with progamming. I also thought I could power this from the Arduino - here comes my question.

I am using a USB powered UNO. I look at the following two guides and the equipment list is essentially LED's, 16 resistors and Arduino (no external power supply, no transistors for ground).

http://www.instructables.com/id/The-4x4x4-LED-cube-Arduino/
http://www.instructables.com/id/Arduino-4x4x4-LED-Cube

I understand the concept of lighting 1 layer at a time, no problem. However, in these projects, one of the PINS is being switched to low to create a ground - I've got a few concerns around this that I just can't get my head round and would really appreciate some input

1) In theory, only 1 layer will be light at one time - so 16 LEDs each with a current source from an individual PIN, but with a common sink PIN. How does the maths for this work? Is the sink limit for a single pin not being exceeded. I think the source limit is +40ma per pin with a limit of 200ma for the chip. I also think the sink limit for a pin is -40ma where as the GND are -200ma each, but I cant get any further than this.

2) I THINK a better option may be to use a transistor to connect the layer to the GND pin, but it would still be subject to some limits - or does this not make any diference?

3) If more than 1 layer was light by accident (either during a software programming error, or perhaps when Arduino is booting) would this not damage the Arduino chip?

I appreciate this isn't a support site for Instructables and that I may be missing some fundemental knowledge here, but I would be really grateful if someone could explain.

#### ArnieNFW

#1
##### Feb 17, 2012, 10:22 am
Hi. I did exactly the same: build a small cube waiting for the parts to arrive. I build a 3x3x3 though. And will build a 9x9x9 (uneven, because I want to have a center pole).
You should use a transistor to switch to the ground. The new led colors have specs like 3,2-3,5V and a current around 20mA. (4x4) x 20mA = 320mA and that's a LOT more than 40mA which the I/O ports can deliver.

It gets worse, though. When a led is partly switched on there is briefly a current-flow much more than 20mA. The leds I use, have this specs: 3.2V, 20mA and with a duty cycle of 1/20, 180mA !!! So if they are switched on 0.05 secs per sec, there is a current of 180mA (in that 0.05 sec).

So you should use a transistor. I use a BC547b with a 1kOhm resistor on the base.

#### Rex_247

#2
##### Feb 17, 2012, 12:34 pm
Thanks for your reply. I thought transitors to switch to ground is the better option, but I still don't see the maths. In your example, does this mean you are sending 320ma to the ground pin of the arduino, which still exceeds the 200ma limit I understood there was. Is it just the case that this is better than exceeding the 40ma limit of a pin set to low? Because the transistor isnt reducing the current is it?

#### ArnieNFW

#3
##### Feb 17, 2012, 02:57 pmLast Edit: Feb 17, 2012, 06:36 pm by ArnieNFW Reason: 1
The leds of one layer are all indivually switched to + and all together switched to the ground. If you use a I/O port to switch to the ground without transistor, all current (4x4x20mA) will flow through that port. I understand the max is 40mA. I am not an Arduino expert (look to the nr of posts I made), but I did look into this.
The mentioned transistor is just a remote switch, like a relais is. A relais is used to switch high voltage/high current/remote locations with low ../../. I guess you know what I mean. A relais wont switch very fast, so a transistor will be used. A HIGH on the base will switch an (NPN) transistor to the ground, not a great explenation, but it'll do for this. Actually, a NOT port in a chip is just that: a transistor and a resistor.
Look at instructables, led cube 8x8x8: http://www.instructables.com/id/Led-Cube-8x8x8/
Step 30, picture number 3. You see the transistors in the diagram. Actually, they use 2 parallel transistor. It's not the best idea (like two leds parallel): current will likely flow through the transistor with the lowest resistance.
The resistor on the base is just used to get the current flowing a little lower. As said, I use 1kOhm: 5Volt - 0.7Volt (transistor to the ground) / 1kOhm = 5mA.
As you can see, english is not my mother tongue. Please ask if I did not make myself clear.

#4