0

I'm rather new to Arduino. I've been performing some current consumption measurements lately, with a INA219 current sensor, on the blue LEDs from a starter kit.

I plugged three LEDs, on pins 2, 3, and 4 of my Arduino UNO, and wrote a simple script:

digitalWrite(led1, 1);
delay(2000);
digitalWrite(led2, 1);
delay(2000);
digitalWrite(led3, 1);
delay(2000);
digitalWrite(led1, 0);
digitalWrite(led2, 0);
digitalWrite(led3, 0);

Which turns on the leds one by one, and finally turn them off at once. I measured the current consumption of the first LED, and measured that:

  • When it's the only one on, LED 1 consumes ~23.5 mA
  • When the second one is on, LED 1 consumes ~21.7 mA
  • When the third one is on, LED 1 consumes ~20.2 mA

Could you please tell me why it behaves that way ? Is there any source I should read that would formalize that ?

Thank you

6
  • 1
    First of all, it's better to not exceed 20 mA per LED, so increase your resistor values. Second, although 40 mA is the maximum rating for GPIOs, 20 mA is advised. Note, there is also a maximum per port (in case you want to add more LEDs). This both doesn't explain your problem though. Feb 21 '20 at 13:03
  • Ok, I will add some resistors in the future, I don't want to break anything. Thanks Feb 21 '20 at 13:07
  • You mean you don't use resistors now? Please do immediately before you break your gpios and or leds Feb 21 '20 at 13:10
  • 1
    Oops. So now I did add some 220ohms resistors on each leds, and performed some new measurements on my LED1. The difference of current consumed by my LED1 when more LEDs are on is way smaller now: 4.4mA alone, 4.3mA when LED2 is also on, and 4.2ma when LED3 is on. There's still a difference though Feb 21 '20 at 13:15
  • I see the problem already has been answered. If you do not use a resistor, the maximum current will flow through the leds. It seems you have a non ideal power source, if it would be (giving much high current), probably you would have broken some components. But with the formula of st2000 you can now calculate your resistor in such a way not to exceed 20 mA. Feb 21 '20 at 13:44
1

If using a constant voltage source it is advisable to use current limiting resistors in series with LEDs.

If these LEDs are different colors that may explain the different current readings.

Or, if all LEDs are of the same color and you are powering the project from a source with internal resistance (a battery), the more current you draw the lower the supply voltage. This may show up as a reduced incremental current increase.

Or, if using a poor power source or operating at the current capacity of the power supply - again - this may show up as a reduced incremental current increase.

Note that different generations of LEDs operate at slightly different voltages. But, in general, RED, GREEN & BLUE LEDs of the same generation operate at slightly increasing voltages respectively. Details can be found here in this wikipedia.com page:

Typically, the forward voltage of an LED is between 1.8 and 3.3 volts. It varies by the color of the LED. A red LED typically drops 1.8 volts, but since both voltage drop and light frequency increase with band gap, a blue LED may drop from 3 to 3.3 volts.

Use the LED current (Iled) and voltage (Vled) specifications to determine the proper resistor value for a given supply voltage (Vbatt).

The following equation from this article should prove useful for this calculation:

enter image description here

2
  • Hi, thanks a lot for your answer. I will thoroughly read those references. My three blue LEDs are exactly the same, this is the corresponding tech spec: arduino.cc/documents/datasheets/LED(blue).pdf I tried with a different power supply (USB this time) and find similar current drop when more leds are turned on. Feb 21 '20 at 13:42
  • With out current limiting resistors you are operating outside of specifications. This may include the processor operating outside of specifications. This may also include any on board regulator operating outside of specifications. So it becomes difficult to specify an exact cause for your observations. Also note, a moderately stressed LED will likely only permanently dim. So it may be difficult to tell if an LED has been operated outside of specifications. It looks like these LEDs need a current limiting resistor of (5 - 3.2) / 0.02 ohms when driven by an 5 volt Arduino board.
    – st2000
    Feb 22 '20 at 14:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.