Continue to Site

# led on/off function problem

Status
Not open for further replies.

#### gauravkothari23

hi friends.
i need a help for 89s52. i have made a small project using 4x4 keypad, 10mm led, and 89s52. it has nothing to do but only on the led and also off the led on specific key press from keypad. i want to know that is it possible if i connect my 10mm led to directly to output port of 89s52. to get the output. or have to place any IC between led and 89s52 to control my led.

hi,
What is the forward voltage and operating current of the 10mm LED.?
E

Sure, you can. But current liming resistor also needed.

Hi,

Indeed it has nothing to do with 89s52, any other microcontroller will act the same.

It is a problem of voltage, current and ohm's law.

Maybe you use 5V as Vcc, and the LED is built for 5V. But this is not very likely.
Usually LEDS have a forward voltage of 2.3V. If VCC is 5V and dropout voltage of microcontroller is 0.2V, then you need a resistor in series with the LED.
5V - 2.3V - 0.2V = 2.5V across the resistor.
If you now want 0.015A through LED = through resistor, then the resistor value is 2.5V / 0.015A = 167 Ohms.
A deviation of -10%...+20% should be no problem.

Klaus

One of the major limitations of the AT89Sxx series is its limited current sourcing capabilities, Port 0 is open drain therefore can only sink current and although Ports 1, 2 and 3 have internal pullups, their IOH is limited to a few uA before the respective VOH drops significantly.

Therefore, unless you wish to employ a BJT to drive the LED to sufficient current level and brightness, it would be advantageous to sink the current, rather than attempt to source it.

Also be aware, the IOL is limited to 10mA per port pin, 26mA total for Port 0, 15mA total for PORT 1, 2, 3 and 71mA total for all output pins.

BigDog

Points: 2

### 1101287021

Points: 2
Hi,

you should be connect led on port 1,2,3 . In this port pull-up register is their .but port 0 is open drain

The brightest, most efficient LED is the best one to choose to operate at low current.

The best output is active low on port is 0 an ESR of 0.45V/3.2mA = 140 Ω. Use the voltage drop from Vcc to 3V if it is a White LED and compute the current limiting R including the driver internal 140 Ω. The LED ESR is around 10~15Ω for a 10 mm. LED when saturated.

Thus if using choosing 10 mA, (5V-3V)/10mA = 200 Ohms - 140-10 = 50 Ohms external series R.
If choosing 0 Ohms for Rs the typical White LED driver current is limited by (5V-3V)/(150Ω) ~13 mA on Port 0 by the internal open drain RdsOn.

I think one LED needs minimum forward current to light-up is (If) 10milli ampere .
76/10 ~== 7 LED can light up clear Isn't it ?

I think one LED needs minimum forward current to light-up is (If) 10milli ampere .
76/10 ~== 7 LED can light up clear Isn't it ?

LED's typically only need 2 ~3 mA to operate reliably of course at a fraction of power capacity.

10mm LED's offer no improvement in power capacity over 5mm due to the thermal insulation of epoxy and typically old technology.

ESR is 10~15 Ohms.
If max is 20 mA.continuous.

You could use all the available CPU ports 1,2,3 to combine max current (70mA) but this is rather primitive way to drive an LED.

For example this 10mm LED is an example of old technology used
https://www.digikey.com/product-sea...=1&stock=1&quantity=0&ptm=0&fid=0&pageSize=25

It is only 60mcd at 20mA, green

Whereas this green LED is almost 20,000 mcd at 30 deg at 20mA, same price, so would be over 2,000 mcd at 2mA and significantly brighter than the above 10 mm LED at 20mA.

thannara123

Points: 2