Coldfire, driving LED's direct, good or bad?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Coldfire, driving LED's direct, good or bad?

2,187 Views
Bloodhound
Contributor I

Hi All,

 

I've seen in the MCF51JM docs the drive strength registers for the outputs. The data sheet says each pin can sink 25mA. Ignoring the max current the MCU should draw overall for now, is it really a good idea to drive an LED directly from the port? 

 

I've often used a digital FET for ease of use to control LED's off a micro, I'd be interested to hear some opinions with regards to the parts/real estate savings made in driving the LED's directly is worth the risk (if there is one).

 

Thanks,

Ross

Labels (1)
0 Kudos
6 Replies

489 Views
paulm
Contributor I
This is a technique I use from time to time. It depends on how many LEDs you need, the odd 1 or 2 should be fine, but an entire bank would probably be very bad.
If you really need this route, the high brightness LEDs can run on miniscule current - but watch out for leakage currents.
0 Kudos

489 Views
admin
Specialist II

> The data sheet says each pin can sink 25mA.

See the datasheet of your LED.

The typical LED needs 5..10 mA to be bright enough. The brightness is also depends upon % of lit time vs total time. 

I'd prefer the chain:

pin----->led----->resistor------>Vcc

I use 390 Ohm resistor for 3.3 V Vcc and my LED.

0 Kudos

489 Views
admin
Specialist II

In the other words,  load current, which is less than the specified 25 mA, doesn't damage the microcontroller pin driver.

Note, that a datasheet usually limits the total current of all pin due to overheating.

 

Example of calculation of the needed resistor:

R = (Vcc - Vol - Vled) / I

With the supply voltage Vcc=3.3 V, output low pin voltage Vol=0.3 V, LED saturation voltage  Vled=1.5 V, and the desired LED current 5 mA:

R = (3.3 V - 0.3 V - 1.5 V) / 5 mA = 0.3 kOhm

0 Kudos

489 Views
d_vara
Contributor III

I have make this several times. And it works right.

You must connect a resistor in series with led.

It would be the next assembly:

pin------>resistor------>led------->ground.

 

You must calculate the resistor proper value according to:

 

R=Vout(hight)/I(led)

 

If you don´t know the current of led, you consider 0,01 A.

 

Good luck.

0 Kudos

489 Views
Bloodhound
Contributor I

Thanks, I understand you also need the series resistor. The question was more along the lines of driving the LED directly from the micro being a good or bad idea as opposed to the micro switching a transistor (very low current) and then the transistor turns on the LED (20mA or so).

 

I remember reading an AVR datasheet years ago that said it is best to get the micro to sink the current if driving an LED directly, so the opposite what you have: pin----->resistor----->led------>Vcc , pin grounds to turn on LED.

 

Cheers,
Ross

 

0 Kudos

489 Views
d_vara
Contributor III

Your idea is right, and it is better than my idea for the chip. It´s better sink current.

But, you look at that, when you output "1" logic, you are going to view the led turns off.

 

It is recommended  to use a transistor because it increase safety. The chip suffer less stress.

0 Kudos