22

I'm designing an Arduino style board with built-in LEDs for several of the pins. To simplify assembly of the board and save on components, I was wondering whether it would be safe for those LEDs to share a single resistor, as in this diagram:

schematic

Obviously, the power dissipated through the resistor (3mA per pin @ 3V) is not a real problem. The reason I was hesitating is that LEDs in a parallel configuration should not share resistors, but is it safe to think that separate microcontroller pins don't count as a common anode, even if both pins are high?

2
  • While not part of your question, generally speaking, if at all possible it is preferable to drive the cathode of the LED rather than the anode, as most microncontrollers and other IC's are better at driving negative outputs than positive, as N-channel FET's work better than P-channel ones. Aug 18, 2014 at 16:14
  • 1
    @ChrisStratton, I've heard this before, but what are the practical implications of "better"? Faster switching speed? Closer to theoretical voltage? (I want these LEDs for diagnostic purposes, so having them active low is semantically undesirable anyway). Aug 18, 2014 at 23:23

2 Answers 2

18

Can two LEDs attached to different pins share their resistor?

  • can : yes
  • should : probably not

Your resistor act here as a current limiter, say to 3mA

If you light one LED at a time, you give 3mA to that LED If you light 2 LEDs, you give 3mA for both of them (more of less 1.5mA each) If you light 3 LEDs, you give 3mA for all of them (on average 1mA each)
Things are even a little bit more subtle, as different LED might have different forward voltage, so one LED might very well drain 10% more current than an other.

As "Amps made LED bright", less Amp is less light. On LED light with that setup will give "full light on", and more LED you add, less would bright each one.


As an edit to that answer, there is one case I might consider that arrangement for "multi-LED lighting". This is if you are multiplexing your LEDs

That is lighting only one at a time, but cycling fast enough from one LED to the next so that the human eye would see them all lit at once.

1
  • 1
    Ah yes, that I had not properly considered, and for my purposes, it's a fatal objection. Aug 18, 2014 at 23:19
19

Your circuit is safe from the electronic viewpoint, so long as the LEDs used can withstand a back-emf of 4v or so.

If only one LED is on at a time, all will be sweet. But if two or more are on, the brightness will drop and the brightness between LEDS will probably be inconsistent. The forward voltage drop of individual LEDS tend to vary a little, so one is likely to hog most of the available current.

A separate resistor per LED is probably best.

2
  • 1
    Mixing colors will give even wost results. If you have a blue and a red led (both ON), the blue led will not light up (or extremely dim), since blue leds have a higher voltage drop.
    – Gerben
    Aug 18, 2014 at 15:37
  • If one is making many thousands of something and there will never be any need to light more than one LED, using a shared resistor may save a half a penny each, which could add up to real money. On the other hand, even if the application won't require lighting multiple LEDs being able to do so can be nice during debugging. It's possible to make it look as though multiple LEDs are lit simultaneously, with predictable brightness, if one rapidly cycles among them, but sometimes during debugging it's more useful to be able to independently control the LEDs directly.
    – supercat
    Aug 18, 2014 at 15:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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