NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Basic Electronics » Current draw observations - driving LEDs with PINs

October 24, 2009
by mikedoug
mikedoug's Avatar

I read on this forum (somewhere) that you could drive an LED from an output pin w/o a resistor -- so that's how I had hooked some up. Well, let's just say that it works and doesn't blow out your LEDs -- BUT it sure consumes a TON of power. I only started looking into it because when I touched the voltage regulator (I seem to do that a lot) it was MUCH hotter than I had ever previously found it to be.

So I took a reading -- 129mA! I was only lighting one LED at a time.

Unplugging the LEDs the circuit was running 56mA.

So I decided to try a resistor in-line to drop that current. The 10 Ohm resistor did not let the LEDs light -- perhaps it dropped the voltage too low? Here's the results of my experiments:

 56mA - w/o the LEDs
129mA - w/ LEDs, 0 Ohm
101mA - w/ LEDs, 33 Ohm
 65mA - w/ LEDs, 330 Ohm (3 1K in parallel -- don't have a 330)
 62mA - w/ LEDs, 500 Ohm (2 1K in parallel)
 60mA - w/ LEDs, 1K Ohm

The brightness was acceptable at the 330 Ohm and 500 Ohm level; the 1K ohm level was too dim -- and the 33Ohm level was consuming more power than I was willing to expend on it.

Just some observations from my evening.

MikeDoug

October 27, 2009
by rusirius
rusirius's Avatar

I think you misinterpreted something... It's true you can drive an LED directly from the MCU since it can sink/source enough current... It's also true that just like the "nerds" did in the LED sign display, you can do so without a current limiting resistor...

However... You have to account for duty cycle... In the LED sign they are running a 1/10th duty cycle... In other words, each of the LED's that is "lit" is only on for 1/10th of the total time... So in other words, when you "average" it out, if you're getting 129mA constant, then you would be getting an effective 12.9mA with a 1/10th duty cycle...

Most LED's (Standard) work best at 20mA... When doing current limiting resistor calcs you always account for the voltage drop (2v typical) and then calculate for 20mA.

For example, with a 5v source voltage, and a 2v drop, leaving 3v, a 150 Ohm resistor should give 20mA of current.

However, if we modify the code and set up a loop that repeats 5 times, and only turn on the LED ONE of those five times, then we'll be seeing an effective current of 4mA.

November 03, 2009
by BobaMosfet
BobaMosfet's Avatar

To a great degree, electronics is NOT something you can just put parts together and see what happens-- in fact, doing so can get you hurt or worse.

You need to decide what you want to do first, determine the basic pieces involved (resistor, led, battery, etc), and do the math to select WHICH of those components you use.

Much time in electronics is spent finding and then comprehending and understanding datasheets for various components, so that you can safely operate them (yes, even the simple LED) without sacrificing it's lifespan or risking other components on the board-- or yourself.

Determine a components limits first, and work the math out to stay within those limits.

November 07, 2009
by mikedoug
mikedoug's Avatar

BobaMosfet,

Well thanks for pointing that all out! Only I missed the part where you actually taught about how the math works with regards to a voltage source, a resistor, and an LED. Now THAT would have been helpful. It's unnecessary now -- see my other forum thread about "Understanding LEDs" where I went through the math (as I thought it should be), tested it (with a faulty multimeter), tested with a correct multimeter, and then corrected my understanding of the math.

I'm not sorry to be a "n00b".

Oh, and since they stick these things (LEDs, batteries, resistors, and wires) in those dinky Radio Shack kits that you give kids, I'm pretty certain the most likely worst-case-scenario would have been to watch my LED (like so many of my childhood LEDs) burn out. Could it have killed me? Yes, it could. Likely?

MikeDoug

November 07, 2009
by rusirius
rusirius's Avatar

MikeDoug, I think you missed the point of his post... It's not that the LED could kill you directly... What he's saying is consider the possibilities if you were to just start plugging various components in willy nilly... You could for example end up driving the LED with some sort of special pulsing voltages that opened a rift in time and space, sucking you up into a vortex and dropping to thousands of feet into a cavernous trench whereby you would likely plummit to your death... Worse yet, that rift could cause some sort of ripple distortion in the entire fabric of the universe resulting in a catastophic collapse of the entire universe... I did that once... Trust me, you do NOT want to go there...

November 07, 2009
by rusirius
rusirius's Avatar

BTW, does anyone know when the new season of Dr. Who starts???

Post a Reply

Please log in to post a reply.

Did you know that microcontrollers have two different kinds of memory, program space (flash) and SRAM? Learn more...