Author Topic: LED Parameters  (Read 1343 times)

0 Members and 1 Guest are viewing this topic.

Offline admiralkTopic starter

  • Regular Contributor
  • *
  • Posts: 178
  • Country: us
LED Parameters
« on: November 29, 2019, 09:01:54 pm »
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 found this one that lists If as 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.
 

Offline Ice-Tea

  • Super Contributor
  • ***
  • Posts: 3070
  • Country: be
    • Freelance Hardware Engineer
Re: LED Parameters
« Reply #1 on: November 29, 2019, 09:38:42 pm »
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?

Offline admiralkTopic starter

  • Regular Contributor
  • *
  • Posts: 178
  • Country: us
Re: LED Parameters
« Reply #2 on: November 29, 2019, 10:08:45 pm »
According to the datasheet 17mcd @ IF 2mA, 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's calculator; 5V @ 3mA.

Anyways, why don't you just drive a FET or BJT to increase your current budget?

That would be my preferred method, but in this case I have very limited board space.
 

Offline Ice-Tea

  • Super Contributor
  • ***
  • Posts: 3070
  • Country: be
    • Freelance Hardware Engineer
Re: LED Parameters
« Reply #3 on: November 30, 2019, 11:03:15 am »
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'.


Offline mariush

  • Super Contributor
  • ***
  • Posts: 5029
  • Country: ro
  • .
Re: LED Parameters
« Reply #4 on: November 30, 2019, 12:38:14 pm »
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 found this one that lists If as 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.

Modern 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.6v
   
It'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 have 2 red leds with a forward voltage of 2v and you power everything using 5v and you want to limit at 5mA then:

5v - (2 leds x 2v) = 0.005A (5mA) x R 

so  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.



« Last Edit: November 30, 2019, 12:41:17 pm by mariush »
 

Offline admiralkTopic starter

  • Regular Contributor
  • *
  • Posts: 178
  • Country: us
Re: LED Parameters
« Reply #5 on: November 30, 2019, 02:32:22 pm »
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'.

I 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.
881862-0

@ mariush 
Using 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.
 

Offline mariush

  • Super Contributor
  • ***
  • Posts: 5029
  • Country: ro
  • .
Re: LED Parameters
« Reply #6 on: November 30, 2019, 03:16:17 pm »
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=25

Either 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=uln2003a

You 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/1967038

ps  that board could also do with a better layout... i see just in a few seconds some ways to reduce the number of traces
« Last Edit: November 30, 2019, 03:18:34 pm by mariush »
 

Offline admiralkTopic starter

  • Regular Contributor
  • *
  • Posts: 178
  • Country: us
Re: LED Parameters
« Reply #7 on: November 30, 2019, 10:31:30 pm »
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. 
 

Offline mariush

  • Super Contributor
  • ***
  • Posts: 5029
  • Country: ro
  • .
Re: LED Parameters
« Reply #8 on: December 01, 2019, 12:36:18 am »
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/1654043
TLC5917 (datasheet : https://www.digikey.com/product-detail/en/texas-instruments/TLC5916IDR/296-22710-1-ND/1726512

You 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, repeat
So 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/2772290
You 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
« Last Edit: December 01, 2019, 12:54:48 am by mariush »
 

Offline Raj

  • Frequent Contributor
  • **
  • Posts: 694
  • Country: in
  • Self taught, experimenter, noob(ish)
Re: LED Parameters
« Reply #9 on: December 01, 2019, 02:09:45 am »
I think, it's better to use light pipes with single led than multiple leds, for a single segment... But why not use neopixel
 

Offline admiralkTopic starter

  • Regular Contributor
  • *
  • Posts: 178
  • Country: us
Re: LED Parameters
« Reply #10 on: December 01, 2019, 06:44:51 pm »
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 on this 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.
 

Offline admiralkTopic starter

  • Regular Contributor
  • *
  • Posts: 178
  • Country: us
Re: LED Parameters
« Reply #11 on: December 07, 2019, 07:48:13 pm »
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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf