Go Down

Topic: Help check my (basic) understanding (Read 1 time) previous topic - next topic

vtterp

I am new to this world of the arduino (and electronics in general to be more precise) and have spent some time trying to wrap my head around many of the concepts.  After much reading I've decided to jump into building a 3x3x3 cube (wanted to do a 4x4x4 but think a 3x3 is more prudent for a first project). 

I've gone ahead a purchased a number of blue LED's from eBay which have the following specs - 3.0-3.4v, 3.22v typical, 24mA max, 13000 mcd.  In trying to calculate the resistors I need I've both used an online "calculator" and more importantly tried to apply Ohm's law as I understand it... And, this is where I need my understanding to be checked.

I understand that the Arduino Uno works at 5V.  So, if I am applying  Ohm's law correctly, I need to calculate the "voltage drop" (which I am equating to the remaining voltage after the LED), and divide by the current I want the circuit to draw (in this case based on what the LED can handle):

R=V/I
R=(5 - 3.2)/.02A == 90ohm resistor required (this uses an avg voltage of the LED and assumes a chosen 20mA current)

So, I think I should be rounding up to a 100ohm resistor to prevent more than 20mA going through the LED.  This is consistent with what the calculators are returning.  I assume rounding up to a higher resistor will simply limit the current available for use by LED resulting in an imperceptibly dimmer LED.

What I am not 100% on is how the the arduino's output current plays into this (or if it does at all).  I understand that the max input or output the pins can handle is 40mA.  I assume that it is the resistor that limits the current from the pin, hence an additional reason for choosing 20mA in the above equation.  So, hypothetically if I used a smaller resistor more current would flow through the LED potentially damaging it and the in/output pin. 

Eg. - using an imaginary 10ohm resistor
I=V/R
I=1.8/10 = .18 amps or 180mA == damage to the LED and i/o pin

Does all of this sound right?

CaptainJack

You got it pretty much right.

Arduino pins can supply 40 mA with a total of 200 mA for the entire atmega328 chip. However, with a 100 Ohm resistor and a single led connected to a pin, the 40 mA maximum is not an issue.

However... 3x3x3 = 27 leds, drawing each 20 mA makes 20x27 = 540 mA which is more than your arduino can supply. I suggest using a led driver, transistor, mosfet, whatever makes you happy.

I build an 8x8x8 ledcube which was fed of 595 shift registers. No, not what they are intended for, yes, pushing the limits on how much current they can supply, and mostly: yes, a very convenient hack.

So first find it how you want to supply power for your 27 leds. Each pin of a 595 register typically supplies 30-35 mA. This will do for you. To drain a plane of 9 leds, use a transistor. If you want more advice it might help to post your proposed schematic for your ledcube.

Cheers !

Jack

retrolefty

#2
Jan 29, 2013, 07:42 pm Last Edit: Jan 29, 2013, 07:44 pm by retrolefty Reason: 1
Quote
However... 3x3x3 = 27 leds, drawing each 20 mA makes 20x27 = 540 mA which is more than your arduino can supply. I suggest using a led driver, transistor, mosfet, whatever makes you happy.


Keep in mind that most all led cube designs never try and turn on all the leds on at any single instant of time, but rather a 'level' at a time so for a 3x3x3 design there would never be more then 9 leds drawing current at any given instant, so no problem for the arduino 5v pin suppling that total current. It's the multiplexing timing that can make it appear that all 27 leds can be on at the same time, but it's simply an optical allusion as the human eye can't resolve faster time spans.

Lefty

fungus


Does all of this sound right?


Yes...but bear in mind that some of your LEDs might only need 3.0V.

If you use the 'correct' resistor for 3.2V then the 3.0V LEDs might receive much more than 20mA. This is because a LED doesn't have a constant resistance. The resistance of a LED varies with the voltage across it and drops away exponentially as you approach the 'optimum' (in this case when you get 20mA). At 20mA a tiny error in voltage can produce a massive error in current, enough to hurt the LED.

To light up a LED safely you should either:
a) Use a circuit which controls current, not voltage (eg. A LED driver chip).
b) Aim for less than maximum current, eg. 15mA (the LED resistance curve is much flatter here so errors don't matter as much).

This page has more info: http://www.thebox.myzen.co.uk/Tutorial/LEDs.html
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

retrolefty

Quote

If you use the 'correct' resistor for 3.2V then the 3.0V LEDs might receive much more than 20mA.


I think you are over stating the case. If a led with a nominal 3.2vdc Vc rating was actually 3.0 Vf then the
90 ohm resistor would limit the current to 22 ma, hardly a thing to be concerned about, right? There can be more then that much variation in the arduino boards Vcc voltage depending on the USB voltage allowance of 4.75 to 5.25 vdc standard.

Lefty

Go Up