LED Parameters - Page 1
Forum section: electronics / beginners

author: admiralk
author_rank: Regular Contributor
timestamp: November 29, 2019, 09:01:54 pm
content: I am working on a project where I need to light up to seven LEDs from a single micro-controller pin. I know that is not something that can generally be done, but I was looking at LEDs and foundthis onethat lists Ifas 2mA. If I understand everything correctly, I should be able to use a 1k resistor and have it work fine. Since I rarely understand everything correctly, I am wondering what I am missing.

author: Ice-Tea
author_rank: Super Contributor
timestamp: November 29, 2019, 09:38:42 pm
content: You can run any LED @2mA. The question is just how much light comes out at that current. Look at the mcd rating.I'm not sure how you're ending up with a 1k resistor? I assume 3V3 uC pin? 3V3 - 1V8 = 1,5mA? Anyways, why don't you just drive a FET or BJT to increase your current budget?

author: admiralk
author_rank: Regular Contributor
timestamp: November 29, 2019, 10:08:45 pm
content: According to the datasheet 17mcd @ IF2mA, if as I said I am reading it right. That is quite a bit more than some I was looking at that used 10mA.I got the 1K from digikey'scalculator; 5V @ 3mA.Quote from: Ice-Tea on November 29, 2019, 09:38:42 pmThat would be my preferred method, but in this case I have very limited board space.

author: Ice-Tea
author_rank: Super Contributor
timestamp: November 30, 2019, 11:03:15 am
content: Depends on your uC IO voltage, obviously.- A *lot* of red LEDs will get to that kind of mcd rating.- You can get them in smaller SMD packages if you wish- A transistor won't take a lot of space, you can get them in insanely small sizes if you wish. The additional space compared to your 7 LEDs and resistors will be distinctly 'meh'.

author: mariush
author_rank: Super Contributor
timestamp: November 30, 2019, 12:38:14 pm
content: Quote from: admiralk on November 29, 2019, 09:01:54 pmModern microcontrollers can typically output up to 50mA or so on each pin but there's usually a limitation on the total output on all pins, like for example 100-150mA through all output pins. The maximum current on each pin and overall also goes down with voltage: for ex a microcontroller may do 50mA per pin with 5v input, but only 20mA per pin if powered with 3.3v..3.6vIt's safer to just assume around 10-15mA maximum on each output pin.If you want to use a single resistor to limit the current, you can use this formula to limit the current :Input voltage - ( number of leds in series x forward voltage of led ) = Current (in A) x Resistance value.So for example, if you have2red leds with a forward voltage of2vand you power everything using5vand you want to limit at5mAthen:5v - (2 leds x 2v) = 0.005A (5mA) x Rso R = (5-4) / 0.005 = 1 / 0.005 = 200 ohms , so you'd use either two 100 ohm resistors in series, or 210 ohm (less current) or 180 ohm (a big higher current)7 leds is a bit odd.. if you can make it 8 then you can make 4 pairs of 2 leds in series, so then you'll have 4x the minimum current, 2x the forward voltage to deal with.Below is a transistor tutorial, how to use one transistor to turn on or off something. Very easy for beginners to understand.Remember though, don't use the transistor to actually limit the current to the leds, use the transistor like an on/off switch.You'll still need a resistor to limit the current.

author: admiralk
author_rank: Regular Contributor
timestamp: November 30, 2019, 02:32:22 pm
content: Quote from: Ice-Tea on November 30, 2019, 11:03:15 amI am not really sure what the mcd rating means. A similar one lists 0.6 mcd, although it also has a smaller viewing angle. The other ones I was looking at listed 2 - 4.4 mcd, but also rated up to 10mA.Yes I can get tiny transistors, but I do not want to try to solder something I cannot see. I am already not so sure about being able to solder the ICs. The additional routing could be problematic as well. This is likely to change as I realized I need to change the micro-controller again.@ mariushUsing a single resistor will not really work as this is a matrix so the amount of LEDs to light is not fixed.I am going to try multiplexing it later today today to see how that works, but would like to keep things simpler, even if I can get that to work.

author: mariush
author_rank: Super Contributor
timestamp: November 30, 2019, 03:16:17 pm
content: If you're so space constrained you could use resistor arrays :https://www.digikey.com/products/en/resistors/resistor-networks-arrays/50?FV=69%7C411897%2C-8%7C50&quantity=10&ColumnSort=1000011&page=1&stock=1&pageSize=25Either through hole, or surface mount (but they'll be harder to solder)May want to consider chips like ULN2003A, 7 powerful transistors (with their resistors) in a single package:https://www.digikey.com/products/en/discrete-semiconductor-products/transistors-bipolar-bjt-arrays/277?FV=-8%7C277&quantity=10&ColumnSort=1000011&page=1&k=uln2003a&pageSize=25&pkeyword=uln2003aYou can also get 2 npn transistors in a small package (without base resistors though) :https://www.digikey.com/product-detail/en/on-semiconductor/BC846BDW1T1G/BC846BDW1T1GOSCT-ND/1967038ps that board could also do with a better layout... i see just in a few seconds some ways to reduce the number of traces

author: admiralk
author_rank: Regular Contributor
timestamp: November 30, 2019, 10:31:30 pm
content: The dual transistors might be an option, I will have to see what it looks like when I redo the board for the new micro.I am sure the current layout could be improved, but except for the resistors the components are pretty much locked in to their positions. Regardless, it is all going to change since at the very least the VCC pin is moving to the opposite side of the chip; pin 20 instead of 11.

author: mariush
author_rank: Super Contributor
timestamp: December 01, 2019, 12:36:18 am
content: Here's some other suggestions.As far as I can see from the circuit board picture, it seems like you're trying to make a big digit out of 20 leds (7 on each side, 2 for each small segment, so 20 leds in total)Well the basic approach would be to use a resistor for each led, but you can go further by going with a simple led driver, for example one with 8 channels.Let's say you go with 16-SOIC as you can get drivers with same pinout from multiple vendors:STP08DP05MTR (datasheet) :https://www.digikey.com/product-detail/en/stmicroelectronics/STP08DP05MTR/497-6118-1-ND/1654043TLC5917 (datasheet:https://www.digikey.com/product-detail/en/texas-instruments/TLC5916IDR/296-22710-1-ND/1726512You can split the leds into 3 regions, 2 with 8 and the 3rd with 4 leds (maybe the dot if you want to add it).With the led driver, you set the current for all with a single resistor, so now you only need a microcontroller with 4 input pins (possibly less) to shift in the data in the driver, and 3 pins to sequentially enable only one group of leds at a time (shift data in, turn off power, power on group of leds, enable/latch driver and the 8 leds will turn on .. .wait some time, turn off, shift data for the next group of 8 leds, turn group on , enable driver, repeatSo basically 4 for driver, 3 for power, and maybe 1-4 pins for input (0..15 is doable with 4 io pins) or maybe you want to make each micro listen on i2c ?You also have 16 channel drivers in TSSOP 24 package, 8mm x 4.5mm :https://www.digikey.com/product-detail/en/stmicroelectronics/STP16CPC26TTR/497-11985-1-ND/2772290You can basically split the leds into 10 and 10 and switch between groups... only 2 transistors required then.Note that you also have such drivers from Chinese companies, LCSC.com has you covered.The pinouts may be different though.example same pinout as the 16 channel driver above, but different package qsop24, 6 cents each :https://lcsc.com/product-detail/LED-Drivers_Shenzhen-Sunmoon-Micro-SM16106SC_C121618.html

author: Raj
author_rank: Frequent Contributor
timestamp: December 01, 2019, 02:09:45 am
content: I think, it's better to use light pipes with single led than multiple leds, for a single segment... But why not use neopixel

author: admiralk
author_rank: Regular Contributor
timestamp: December 01, 2019, 06:44:51 pm
content: I have made 7 segment displays using rectangular LEDs, that was rather simple. In this case, I do not really have segments. This one is based onthis display.If I understand those driver correctly, they are basically shift registers that can source a good amount of current. If so, that might actually do the trick.

author: admiralk
author_rank: Regular Contributor
timestamp: December 07, 2019, 07:48:13 pm
content: It looks like I can just use regular LEDs, as long as I do not light more than 2 at a time. It complicates the code a bit more than I would like, but saves the added expense of specialized components.