EEVblog Electronics Community Forum
Electronics => Beginners => Topic started by: Mpegger on December 07, 2022, 11:21:19 am
-
I'm wiring 4 LEDs to a Raspberry Pi that turn on individually when there's activity on a assigned cpu core. I want to keep the module as small as possible so I wanted to wire the LEDs in a parallel fashion with a common resistor and ground, even though each LED is an individually powered circuit. Is this mixed series/parallel circuit even possible? How would I calculate what size resistor I would need to use if it is possible?
-
Unless only one led is lit at a given time, you can't, current will be shared between leds, so they get dimmer as you Enable more leds.
You can't overcome this by lowering the resistor, then enabling only one led would burn it.
-
Possible, yes, advisable no, as David just commented.
You'd have to choose the resistor to suit the case when only one LED is on so that the lesser of the max currents for a Pi I/O pin and for the LED is not exceeded. Then when more LEDs turn on the available current would roughly share between them, all becoming dimmer. However the one with the lowest Vf will hog more of the current, and as Vf is temperature dependent, even if you carefully select LEDs from a larger batch for closely matched Vf, the one that's been on the most will be warmer, so will draw more current and stay warmer and brighter. TLDR: Its a mess!
However, as you can get an array of four SMD resistors in a package as small as 1.4mm x 0.6mm (Panasonic EXB resistor array series) (https://mediap.industry.panasonic.eu/assets/imported/industrial.panasonic.com/cdbs/www-data/pdf/AOC0000/AOC0000C14.pdf), bite the bullet and give each LED its own series resistor.
-
There are LEDs that have internal resistors like:
https://www.sparkfun.com/products/14563 (https://www.sparkfun.com/products/14563)
-
Or, you could have only one LED turned on at a time, and multiplex if multiple LEDs must *appear* to be on at the same time.
-
I figured as much. I was hopeing that maybe there was some secrect sauce that would allow such a circuit to be possible, but I guess I'll have to use more resistors in the mix. Thanks for the confirmation of what I had hoped I was wrong in my thinking.
-
Given that resistors cost about the same as thin air, put one in each leg.
-
As Peabody noted, its possible to get good results and uniform brightness with only a single resistor if you multiplex the LEDs. Additionally you can save a GPIO pin by charlieplexing them. As three GPIOs can support six charlieplexed LEDs and you only need four, if you omit the LEDs between two of the GPIOs you can get away with a single current limiting resistor in series with the common GPIO, chosen not to exceed the pin's max. continuous current. Use high brightness LEDs as their max. duty cycle will only be 25%. Sequencing the GPIOs to light the desired LEDs will require a high priority background or interrupt driven task. If you don't want to write that yourself, I'd lay good odds that the pigpio (https://abyz.me.uk/rpi/pigpio/) daemon controlled by the wave functions in the pigpio library could handle the sequencing for you.