driving LED's direct with IO Pin

Go To Last Post
16 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi @ all!

Do anybody have experiences with driving LED's direct by the IO-Pins with PWM? Is it useful? Or could the AVR or the LED be damaged?
I don't like to use a resistor, because I have exactly no space and 5LEDs!

regards

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think this subject has cropped up before, a search of these forums may reveal something. For my part, I wouldn't want to risk it. I have no scientific reasons, it just don't seem fittin'.

Four legs good, two legs bad, three legs stable.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can hook a LED directly to an i/o (red), because the i/o will saturate (max. 40mA), LED won't blow. (I have only tested red LEDs)

8)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I will control it with PWM! The Question is, if the LED and the AVR will be damaged, during the ON cycle...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This depends strongly on the type of the LED.
Please refer to the data sheet of the LED if
such huge pulse currents are allowed for short
time periods.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, as was said, this has been discussed to death in other threads and opinions vary. My opinion is that you have to account for the case where the micro locks up while powering the LED thus frying it and the micro pin attached to it. So if you decide to do it without a resistor please tell me what company you are working for so I can avoid their products.

Smiley

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How about using a single resistor then having just 1 LED switched on at any one time.
i.e. make each one flash (or not flash) sequentially so it looks like more than 1 LED is on at once.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sparkymark567 wrote:
How about using a single resistor then having just 1 LED switched on at any one time.
.

I think the key would be to imagine the worst case senario - the program counter gets foobed and the micro trys to run a data table as code and dies just as it has turned on all 5 pins to the LED's. Depending on the port, the pins can source or sink 10 or 20 mA. So the resistor would need to be sized accordingly. But I suppose this would work okay as it is done frequently in LED matrix applications.

Smiley

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

smileymicros wrote:
So if you decide to do it without a resistor please tell me what company you are working for so I can avoid their products.

Thanks :twisted:

@ sparky would be possible! But honestly said, I'm not 100% sure at the moment how much
space I really have!
I just wanted to know, if anybody had tried it or if anybody has experiences with that!

thanks to all!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The 40 mA per pin is NOT a current limit. It's an Absolute Maximum Rating. It is your responsibility to externally limit the current so that the Absolute Maximum Rating is not exceeded.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In case the micro locks up, the watchdog will reset it, no LEDs or micro fried!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

monstrum123 wrote:
In case the micro locks up, the watchdog will reset it, no LEDs or micro fried!

And if the watchdog gets run over?

Smiley

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

monstrum123 wrote:
In case the micro locks up, the watchdog will reset it, no LEDs or micro fried!
It's been stated before, running an LED without a limiting resistor usually works. If you want to build something that usually works, be our guest.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Lots of hardware designs contain passive components, especially resistors and diodes, put in to protect the system from rare flaws. A fellow named Muntz sold the cheapest TV's in America at one time because he would get the prototypes and start cutting off passives and looking at the TV operation that resulted. He was not an engineer, but he lowered the costs so much that he could undersell anybody. The term 'Muntzing' came to be used by some EE's for the process of lowering costs by removing everything that you can and still have a system that works (for a while). It didn't take long for folks to learn that Muntz TVs were unreliable pieces of crap and the company folded.

Yes, you can get by without the resistors and the watchdog will probably protect your circuit. Quality is not about 'getting by'.

Smiley

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

LEDs with built in resistors if you don't have space?? I would not even think of using a led without a limiting resistor!

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The answers for the OP'er are: yes you can do it. But let's clarify, only do it with anode at the I/O pin and cathode to ground. There is no danger of driving more current into the LED than the pin can deliver. The spec sheet says how much. Voltage drops if it "tries" to deliver more and you have a self-limiting voltage of the LED itself. It works, try it. And yes, I have done it. All the time. Here's one page that is a simple case of PWM driving a bi-color LED in just this way.
http://members.shaw.ca/ccv/goril...

Regards,
Scott