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).
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.
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.
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?
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.
I stumbled upon this article about using a transistor as a switch:
It's an excellent article, but without knowledge, you should start a few chapters earlier. Anyway, at the end there is a list of darlington transistors, which I think should be used to switch layers in the cube.
What you want is a low output current from the arduino to switch a high current from the layer. The TIP121 can switch 5A with a base current of 10mA. If switched on, the darlington transistor has a base-emittor voltage drop of 1.4 Volt. The Arduino output should deliver 10mA, so the base resistor should be 5v-1.4V = 3.6V, R=3.6V / 10mA = 360 Ohm.
It also reads that when used at 20% of its rated current (5*0.2 = 1A) you can use it without a heatsink.
So your 8x8x8 cube uses about 8x8x20mA = 1.2A, but briefly. I would use no heatsink. Good luck.