I'm new to electronics and have been getting rather into my Arduino. But I don't just like following an instructable to do something. I like to know the math behind it and how it works inside. Now from my understanding the Arduino (Uno R3 for me), has a 200 mA max current. The LEDs I used have a 20 mA current. Now with 64 LEDs, wouldn't this fry my Arduino? This also applies to my LCD screen with a 160 mA current. Am I missing a key secret to going over amperage?
The current limit you quote is the maximum current that the main chip on the Arduino can tolerate through its 5V or GND pins.
As the chip itself consumes (round numbers demonstrate the theory) say 50mA that leaves 150mA in total that can be sourced or sunk through IO pins.
If you want to supply 20mA per LED (that is actually overkill - you can use considerably less and have very little difference in brightness) that means you can have, illuminated at any one time, (150 / 20 = ) 7.5 LEDs.
To increase the number of LEDs you can drive at once you can:
- Reduce the current by increasing the resistor values.
- Use multiplexing so that, although it looks like all LEDs are on at once, only a few are actually on at once.
- Use external LED driving circuitry (transistors, LED driver shift registers, etc).
All this pertains purely to the current that passes through the main chip itself. It does not pertain to any current you draw from the 5V or 3.3V pins. The maximum current through those pins is limited by the voltage regulator they are attached to, and also by the voltage that you are supplying the board with (the higher the voltage, the more voltage has to be dropped, and so the more heat is generated per mA drawn).
The 5V regulator has around 800mA limit when supplied with 6.5V. If supplied with 12V the limit is considerably less (since it will get too hot and go into thermal shutdown). You subtract what you are drawing through the chip (maximum 200mA) and that is how much current you have available.
The 3.3V regulator is driven from the 5V regulator, so any current drawn from the 3.3V pin must also be subtracted from what is available on the 5V pin.
I'm assuming you're talking about an 8x8x8 cube.
The 200mA is for all IO. The regular 5v line can supply 500mA. Since you don't have 64 pins available, you are not supplying the leds via the Arduino directly. Probably using some shift register, or led driver chips for the 64 (cathode) columns. For the 8 levels you'd use some PNP transistors or P-channel mosfets.
So the Arduino won't drive any led directly, so it will only use a few tens of milli-amps. Since you'll draw around 1.3A when all leds are lid, you should power the external components directly from the power supply, instead of via the Arduino. Or you'll hit the 500mA limit.
So the Arduino is just pushing the levers, and not doing any of the hard work (crane analogy).