0

I want to turn ON/OFF this LED by one of this Nucleo's digital outputs.

The LED voltage drop is given as 2.2V and rated current given as 20mA.

Is my sizing the series resistor Rs correct?:

Nucleo digital output voltage is 3.3V so for 20mA current:

I = 20mA = (3.3V - 2.2V) / Rs

Rs = 55 Ohm.

Does that mean a 68 Ohm standard resistor suffice?

ty_1917
  • 988
  • 1
  • 7
  • 21
  • I've used a lot of various panel mount LEDs from RS. The forward voltage was not according to some datasheet, but according to "we mounted whatever cheap LED we happened to find on Alibaba this time". The forward voltage, clear/diffused lens, viewing angle, brightness - everything was different from batch to batch. I would strongly recommend you to not buy panel-mount LEDs from RS. – Lundin Sep 05 '22 at 13:38
  • Other than that, you most definitely don't want to specify in some stone age LED with just 30-50mcd. Specify something with many hundred mcd then increase the series resistance. Same price or cheaper, better availability, much lower current consumption. You almost never want to run LEDs at the specified 20mA but more likely around 5mA at most. – Lundin Sep 05 '22 at 13:40
  • Modern LEDs are very very bright at 20mA. – user253751 Sep 05 '22 at 15:56

3 Answers3

1

In theory, assuming the LED actually has the stated voltage drop, yes, a 68R resistor is fine.

That said ~20mA is a moderately high current. Particularly just to light up a panel light. If we look at the MCU datasheet, we find:

Current rattings

You have a total IO current budget of only 80mA. Depending on what you plan on doing with the rest of the MCU, you may need to think about this.

In practice a panel led rarely needs to be spectacularly bright. It may light up fine at ~5mA; and there are much lower-current LEDs available. (For prototyping I normally chuck in a 150 R resistor and stop worrying about it). Some experimentation with the particular LED in question, or a transistor buffer, might be warranted. Particularly if you have multiple LEDs and their forward voltages are all off-spec and you want them to look equally bright...

2e0byo
  • 433
  • 2
  • 7
1

Max current sourced/sunk by any I/O pin is 25mA but the more current you source from an I/O pin, the more it will be pulled down below Vdd and the more current you sink to an I/O pin, the more it will be pulled up above Vss.

20mA is typically the maximum current that can be passed by a "typical" LED and an LED would normally be driven with less current. So redo your calculation for an LED current of say, 6mA. The LED will still be pretty well illuminated at 6mA.

But, bear in mind that when you've calculated your new resistor value for 6mA with a Vdd of 3.3 V, the actual LED current will turn out to be less because the LED and resistor load will pull the port pin down to a voltage below Vdd.

1

The formula for picking a resistor is:

R = ( Vsupply - Vforward ) / I

where Vforward is the diode forward voltage.


The resistance doesn't need to be exact, so yes 68R will work fine.

However, you almost never want to run LEDs at the specified 20mA. Driving them with a PWM or a constant current of 5mA would be the normal way. But notably you could pick a diode with 10 times the brightness and then also add 10 times the series resistance, to draw far less current.

30-50mcd is old technology, it's not hard to find LEDs with some 300-500mcd instead or brighter yet. Just be careful and don't pick one with forward voltage close to 3.3V or nothing will work.

Lundin
  • 20,162
  • 1
  • 26
  • 76