Author Topic: Questing about simplifying LED schematic  (Read 5339 times)

0 Members and 2 Guests are viewing this topic.

Offline SjoerdTopic starter

  • Newbie
  • Posts: 8
  • Country: nl
Questing about simplifying LED schematic
« on: November 17, 2024, 10:47:31 am »
Hi guys,

I'm new here.

Last year I got an arduino for my birthday and loving it but now that I'm starting to do "more advanced" things with it, I just notice my knowledge about basic electronics is nowhere to be found. When it come to digital connectivity I think I'm good but when it comes to hook up analog components such as led, resistor and capacitors and such I fail to understand.

Situation:
Im working on some user-input logic around a 74hc165 to capture 4 push buttons and 4 on/off sensors.
- The 4 push buttons are going through a 74hc14 first before they are fed into the 74hc165
- The 4 on/off are high 12v so the go to a optocouple first (also because its an entire different circuit and want to keep them seperated - I'm using pc847 for that with an 1k resistor in series of the signals.)

To see what signals are high/low I added 8 led's + 330 Ohm resistor to the 8 inputs of the like this (attachment 1),
2438639-0

But I was wondering if that could be simplified but using only one resister (attachment 2)
2438643-1

Or maybe - this way of "debugging" the inputlines is totally wrong?!

Regards,
Sjoerd

« Last Edit: November 17, 2024, 10:58:59 am by Sjoerd »
 

Offline Andy Chee

  • Super Contributor
  • ***
  • Posts: 2132
  • Country: au
Re: Questing about simplifying LED schematic
« Reply #1 on: November 17, 2024, 11:11:46 am »
Definitely do NOT combine the LEDs like the second image!

The first image is the correct approach.
 

Offline SjoerdTopic starter

  • Newbie
  • Posts: 8
  • Country: nl
Re: Questing about simplifying LED schematic
« Reply #2 on: November 17, 2024, 11:24:22 am »
Thank you, then my own logic to add resistors to each led is sound. I'm currently going to "transfer" the wiring from the breadboard to EasyEDA and already got like 18x 330Ohm, 12x 1k Ohm en 12x 10k Ohm and sometimes I come across schematics where there is actually only one 330 Ohm resistor is being used - so i guess they should reconsider.

A question tho (I want to learn here to instead of taking it for granted)
Why should I not go for the 2nd approach?

Regards
Sjoerd
 

Offline Analog Kid

  • Super Contributor
  • ***
  • Posts: 5015
  • Country: us
  • DANDY fan (Discretes Are Not Dead Yet)
Re: Questing about simplifying LED schematic
« Reply #3 on: November 17, 2024, 11:33:42 am »
You can use a common resistor (like your 2nd diagram) if and only if only 1 LED will ever be lit at a time. Otherwise you'll end up with too much current through each, since the resistor value is correct only for a single LED. It won't be that much with just two LEDs, but with a bunch more there's a real risk of "letting the magic smoke out" from overcurrent.

So individual resistors is the way to go.
 
The following users thanked this post: wraper, RAPo, Sjoerd

Offline SjoerdTopic starter

  • Newbie
  • Posts: 8
  • Country: nl
Re: Questing about simplifying LED schematic
« Reply #4 on: November 17, 2024, 11:40:59 am »
Ah
Check !
When everything is finished, one led is always on. 2 or 3 LEDs will be on quite frequently too and we don't want smoke :-)
Thank you for the explanation.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 14132
Re: Questing about simplifying LED schematic
« Reply #5 on: November 17, 2024, 12:41:21 pm »
The problem isn't so much letting the magic smoke out (unless you make the single current limiting resistor too small), its cross-talk between the data pins via the LEDs junction capacitance (which affects fast changing signals), and uneven illumination of the LEDs.  Worst case (but unlikely unless you use different color LEDs), one LED with a low Vf may steal all the current extinguishing all the other LEDs.  Best case, every additional LED lit causes all the lit LEDs to get dimmer, and some dimmer than others.

Individual resistors avoid this problem.
 
The following users thanked this post: janoc, tooki, RAPo

Offline PGPG

  • Super Contributor
  • ***
  • Posts: 1344
  • Country: pl
Re: Questing about simplifying LED schematic
« Reply #6 on: November 17, 2024, 01:19:10 pm »
Otherwise you'll end up with too much current through each, since the resistor value is correct only for a single LED. It won't be that much with just two LEDs, but with a bunch more there's a real risk of "letting the magic smoke out" from overcurrent.
This resistor sets the same current if one LED is on or 8 LEDs are on. So when 8 LEDs are on each one (ideally) will get 1/8 of that current what is certainly not a reason to 'magic smoke'.
The problem with this solution is that the more LEDs are on they shine less brightly and because voltage drop at each LED can be little different their brightness will be different - some LED even switched on can get so little current that you sill not see it.
 
The following users thanked this post: tooki

Offline PGPG

  • Super Contributor
  • ***
  • Posts: 1344
  • Country: pl
Re: Questing about simplifying LED schematic
« Reply #7 on: November 17, 2024, 02:12:27 pm »
when it comes to hook up analog components such as led, resistor and capacitors and such I fail to understand.
...
- The 4 push buttons are going through a 74hc14

Look into 74HC14 datasheet:
https://www.diodes.com/assets/Datasheets/74HC14.pdf
In table at page 4 see VOH for IOH=-4mA for VCC=4.5V. According to it you can assume that output voltage will be no smaller than 3.84V. It is 0.66V lower than VCC (4.5-3.84=0.66). About the same voltage drop (not voltage, but voltage drop) will be for VCC=5V so you can expect (in worst case) 5-0.66=4.34V at output loaded with 4mA when VCC is 5V.
You have no guarantee that output drop is linear - you can not assume that for 8mA load you will get voltage drop of 2x0.66=1.32V. For 8mA you can even get output being so small that it will not be read by next IC as logic 1 state.
You are simply not sure what will be if you load HC14 output with higher than 4mA current.

If your VCC is 5V and typical red LED voltage drop is about 1.8V then you assumed ( 5-1.8 )/330 = about 10mA for each LED. How it is to 74HC14 output load capacity?

Even what I have written it have a chance to work because I took the worst case parameter from datasheet and with output voltage being lower the LED current will also be lower.
But learn from start to design electronic the way giving you 100% chance of working as you want it.

Notice that for VOL (with the same load, but in opposite direction) voltage drop is only 0.33V - two times smaller. It is typical for digital ICs that they have 'stronger' 0 than 1. So if you want to take some current from them it is better to take it from 0 state than from 1 state.

I'm using pc847 for that with an 1k resistor in series of the signals.

I'm more curious about this your solution. Were you exactly used these resistors. Show schematic. I expect here more problems with your LEDs being driven from these signals.
You can find what is going on in analog circuits using Spice to simulate it.
In 2017 I decided that KiCad reached the level of used by me for years professional PCB design program (Protel 3) and moved to KiCad to design my PCBs. KiCad has also integrated Spice simulator but I spend with it only few days half year ago just top check that it works. From my point of view it is good to have the same tool to draw schematic to make PCB and to draw schematic to simulate it. You learn one drawing tool and not two.
« Last Edit: November 17, 2024, 02:18:05 pm by PGPG »
 

Offline MrAl

  • Super Contributor
  • ***
  • Posts: 2314
Re: Questing about simplifying LED schematic
« Reply #8 on: November 17, 2024, 02:39:05 pm »
Hi guys,

I'm new here.

Last year I got an arduino for my birthday and loving it but now that I'm starting to do "more advanced" things with it, I just notice my knowledge about basic electronics is nowhere to be found. When it come to digital connectivity I think I'm good but when it comes to hook up analog components such as led, resistor and capacitors and such I fail to understand.

Situation:
Im working on some user-input logic around a 74hc165 to capture 4 push buttons and 4 on/off sensors.
- The 4 push buttons are going through a 74hc14 first before they are fed into the 74hc165
- The 4 on/off are high 12v so the go to a optocouple first (also because its an entire different circuit and want to keep them seperated - I'm using pc847 for that with an 1k resistor in series of the signals.)

To see what signals are high/low I added 8 led's + 330 Ohm resistor to the 8 inputs of the like this (attachment 1),
(Attachment Link)

But I was wondering if that could be simplified but using only one resister (attachment 2)
(Attachment Link)

Or maybe - this way of "debugging" the inputlines is totally wrong?!

Regards,
Sjoerd

Hi,

This is actually a very common question.

The best way is to use one resistor per LED as others have pointed out.  This is the ONLY way if the LEDs are different colors with different voltage drops.
If all the LEDs are the same, you might get away with one resistor, but as each LED comes on it will mean all of them will be a little darker so you won't get the full brightness.

There's another problem though, two actually.
The first is that 330 Ohms is too small.  The IC will not be able to put out that much current anyway.
The second is that with several 330 Ohm resistors and so many LEDs, the total current out of the IC will be too high, meaning it's even possible the IC chip may blow out.

With any LED driver setup like this, you have to consider both the individual currents through each LED, and also the sum of all the currents for any that will be turned 'on' simultaneously.  For example, if 4 of the LEDs can be on at the same time and the current through each LED is 5ma, that's a total of 20ma for the IC chip.  It will try to draw 20ma through the power supply pins.  That could be too high.  But imagine if you had 10ma through each LED and 8 of them turned on, the IC would see 80ma which could be too high.  20ma through each pin would mean 160ma, far too high.
With that particular IC chip though, it would probably be impossible to draw 10ma from each output pin.  Maybe 5ma but maybe less than that.  That means the chip could get hot.

Also, sometimes you can get a lot more current in one output state than the other.  You may be able to get more current if you drive the cathodes low instead of driving the anodes high.  You have to check the type of chip you are using to determine this.  With 330 Ohm resistors through even one output may be overloaded with just one LED on.

Typical series resistor values used for bright LEDs is 1k but you can even go higher and still be able to see what the state of each output is.  The LED should still light up enough to see.  You may even be able to use up to 10k.  That's something to be tried with your setup.  Connect a 1k to 10k resistor in series with an LED and see how bright it gets.  You can go from there with the other LEDs.

Now you can see why we have LED driver chips, and their only purpose is to drive LEDs.  You could connect the driver chip to the outputs of your original IC chip, then connect the LED's to the outputs of the driver chip.  In some cases you do not need resistors because the IC driver takes care of the current levels.  In other cases you still need series resistors, and they may be able to go lower like 470 Ohms.  That should provide plenty of brightness, maybe even too much brightness for looking at directly.
Note the newer LEDs are very bright and need much less current, while the very old LEDs are very dim and need more current.  Get the modern ones they sometimes call them "super bright" LEDs.


 

Offline SjoerdTopic starter

  • Newbie
  • Posts: 8
  • Country: nl
Re: Questing about simplifying LED schematic
« Reply #9 on: November 17, 2024, 03:57:09 pm »
How a rather small question leads to more questions - love it..

As I said I got it on a breadboard and slowly drawing it into easyeda but I'm also new to that program as well - If you like I can make a picture of the breadboard (if interested that is), but the 4 12v on/off lines are for now also push buttons attached to a 5v line. Also i dont have any leds hooked up to the 74hc14 since I only use that for debouncing the switches.

So the pc847 - Currently the 4 inputlines are 5v (not able to test is yet with 12v) and since an optocoupler is a led I figured "if it's a led it needs a current limiting resistor" so euhm 5v is 330 ohm and 12v is 1k (I guessed)

I never worked with any schematics program. I know about easyeda from youtube creators.Do you recommend kicad?

 

Offline PGPG

  • Super Contributor
  • ***
  • Posts: 1344
  • Country: pl
Re: Questing about simplifying LED schematic
« Reply #10 on: November 17, 2024, 07:36:55 pm »
I never worked with any schematics program. I know about easyeda from youtube creators.Do you recommend kicad?

If you start to learn easyeda I certainly recommend to select KiCad. But take in mind, that I have never even seen easyeda.
I just believe now there is no better than KiCad free PCB design tool.
« Last Edit: November 18, 2024, 10:31:08 am by PGPG »
 

Offline MrAl

  • Super Contributor
  • ***
  • Posts: 2314
Re: Questing about simplifying LED schematic
« Reply #11 on: November 18, 2024, 10:09:28 am »
How a rather small question leads to more questions - love it..

As I said I got it on a breadboard and slowly drawing it into easyeda but I'm also new to that program as well - If you like I can make a picture of the breadboard (if interested that is), but the 4 12v on/off lines are for now also push buttons attached to a 5v line. Also i dont have any leds hooked up to the 74hc14 since I only use that for debouncing the switches.

So the pc847 - Currently the 4 inputlines are 5v (not able to test is yet with 12v) and since an optocoupler is a led I figured "if it's a led it needs a current limiting resistor" so euhm 5v is 330 ohm and 12v is 1k (I guessed)

I never worked with any schematics program. I know about easyeda from youtube creators.Do you recommend kicad?

Hi,

If you mean schematics for drawing the circuit diagram and simulating the circuit, then you can try LT Spice which is free and a lot of people use it so you can share schematics.  That allows other people to test out your design too.
 

Offline PGPG

  • Super Contributor
  • ***
  • Posts: 1344
  • Country: pl
Re: Questing about simplifying LED schematic
« Reply #12 on: November 18, 2024, 10:27:51 am »
But take in mind, that I have never even seen easyeda.

I decided to make a short look what easyeda is.
My first impression is that you work somewhere there and not at your PC. It is not for me. I'm too old for such solutions :). I just prefer to myself take care of my files and not let it to someone else.
I don't know what are the rules for example if some day someone will just say: "We finish offering this and we just disappearing." What happens with all your work?

It also looks for me that in free version you can't use your private libraries.
What !?
I am using only my own libraries to be sure that I take care of everything.

I see easyeda is simply not for me, but may be it is really good piece of software.

With KiCad everything works at my PC. If at any moment someone will decide to close that project (may be a commercial firm will find a way to close competition - don't know if it is possible, but...) I will have its last version working. Maybe I'm oversensitive, but even impossible things sometimes happen in this world.
 

Offline Analog Kid

  • Super Contributor
  • ***
  • Posts: 5015
  • Country: us
  • DANDY fan (Discretes Are Not Dead Yet)
Re: Questing about simplifying LED schematic
« Reply #13 on: November 18, 2024, 08:23:45 pm »
I second that suggestion of downloading LTspice. It's free, lots of people use it so its files can be shared, it's easy to learn, and it's not in the "cloud". What's not to like?
 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 15995
  • Country: ch
Re: Questing about simplifying LED schematic
« Reply #14 on: November 18, 2024, 11:38:57 pm »
So individual resistors is the way to go.
That conclusion is correct.

You can use a common resistor (like your 2nd diagram) if and only if only 1 LED will ever be lit at a time. Otherwise you'll end up with too much current through each, since the resistor value is correct only for a single LED. It won't be that much with just two LEDs, but with a bunch more there's a real risk of "letting the magic smoke out" from overcurrent.
But that rationale is wrong. The resistor is there to limit current, and it’ll limit to the same limit no matter how many LEDs are in parallel. But how the current divides can be unpredictable (due to manufacturing tolerances between individual LEDs) and even if it divides perfectly, at some point, too little current will flow per LED for them to light up.
 

Offline Analog Kid

  • Super Contributor
  • ***
  • Posts: 5015
  • Country: us
  • DANDY fan (Discretes Are Not Dead Yet)
Re: Questing about simplifying LED schematic
« Reply #15 on: November 19, 2024, 10:39:41 pm »
You can use a common resistor (like your 2nd diagram) if and only if only 1 LED will ever be lit at a time. Otherwise you'll end up with too much current through each, since the resistor value is correct only for a single LED. It won't be that much with just two LEDs, but with a bunch more there's a real risk of "letting the magic smoke out" from overcurrent.
But that rationale is wrong. The resistor is there to limit current, and it’ll limit to the same limit no matter how many LEDs are in parallel. But how the current divides can be unpredictable (due to manufacturing tolerances between individual LEDs) and even if it divides perfectly, at some point, too little current will flow per LED for them to light up.

You're right: I stand (sit, actually) corrected.
 
The following users thanked this post: tooki

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 17264
  • Country: de
Re: Questing about simplifying LED schematic
« Reply #16 on: November 20, 2024, 09:23:11 am »
The LED part is better with separate resistors. 1 common resistor would work, but the LEDs would get less bright when more than 1 LED is on at the same time. 7 extra resistors is anyway not that much to worry about.
Modern LEDs are quite efficient. 330 ohms cause rather bright LEDs. The current could be a bit much to directly drive from the optocouplers.

The input part may drop the HC14 gates. With a shift register they are sampled anyway and one get debouncing this way.
The optocouplers may want antiparallel diodes as protection  (the LEDs may not like 12 V in the wrong direction).
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 14132
Re: Questing about simplifying LED schematic
« Reply #17 on: November 20, 2024, 12:59:04 pm »
For breadboarding, I'm quite fond of DIL package LED bargraph modules + an 11 pin SIP 10x 1K resistor array.   That gives you ten LEDs with individual resistors in only 11 rows (both sides of center)  of the breadboard.  At 5V the load is around 3mA per LED - OK for most CMOS outputs, and much less at 3.3V.  The common pin of the resistor arrray saves a lot of wiring.   Depending on which side of the LEDs you put the resitor array, you can wire them active high or active low. (Active low is preferred, as most logic families pull low better than they pull high, either with higher current capability, or lower voltage drop or both.)

https://mou.sr/4fZdlDj ten led DIL bargraphs

https://mou.sr/4hYn1j1 10x 1K SIL resistor array
 
The following users thanked this post: tooki

Offline Analog Kid

  • Super Contributor
  • ***
  • Posts: 5015
  • Country: us
  • DANDY fan (Discretes Are Not Dead Yet)
Re: Questing about simplifying LED schematic
« Reply #18 on: November 20, 2024, 06:48:03 pm »
FWIW, I use 220Ω resistors on circuits with 5V supply, with no problems.
 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 15995
  • Country: ch
Re: Questing about simplifying LED schematic
« Reply #19 on: November 20, 2024, 07:59:22 pm »
FWIW, I use 220Ω resistors on circuits with 5V supply, with no problems.
Again, your LED knowledge is outdated.

Traditionally, indicator LEDs were driven at around 20mA, which gave a nice pleasant, visible indicator. But with the insane efficiency of many (not all, but many) modern LEDs, 20mA is often too much. In many cases, way, way too much!

The “worst” LEDs in this regard are modern “true” green LEDs (around 525nm, almost emerald green, rather than the ~550nm yellowish green that was ubiquitous in the past), since they are both electrically efficient, but also closer to our eyes’ peak sensitivity than blue or red LEDs. I am using those as power LEDs on devices at work, and I run them at 0.5mA. (Not a typo: half a milliamp. 18k ohm dropper resistor from 12V supply, ~3V forward voltage of the LED.) If I run those at 20mA, they are literally very uncomfortable to look at.

What happens when you run many modern LEDs at 20mA is the blindingly bright power LEDs that literally light up the bedroom when you’re trying to go to sleep, as we saw in a lot of products from around 2010, when engineers had not yet gotten used to modern LEDs and kept running them at 20mA.

The upshot being that you cannot make blanket statements like “I use 220 ohms for 5V with no problems” anymore, because that can be fine for some LEDs and completely unusable for others. There is no getting around either testing every LED model you buy to determine an optimal dropper resistor value, or using only LEDs with very thorough datasheets that let you determine exactly what current to drive them with to get a desired, known amount of light output.
« Last Edit: November 20, 2024, 08:03:37 pm by tooki »
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 22458
  • Country: gb
  • 0999
Re: Questing about simplifying LED schematic
« Reply #20 on: November 20, 2024, 08:05:44 pm »
FWIW, I use 220Ω resistors on circuits with 5V supply, with no problems.
Again, your LED knowledge is outdated.
To be fair, perhaps he has a load of old LEDs in stock. There are plenty of old dim red, yellow and green LEDs still made and I've still got some blue, white and violet LEDs from the 1990s to early 2000s, which need to be hammered to be very bright.
 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 15995
  • Country: ch
Re: Questing about simplifying LED schematic
« Reply #21 on: November 20, 2024, 08:54:48 pm »
FWIW, I use 220Ω resistors on circuits with 5V supply, with no problems.
Again, your LED knowledge is outdated.
To be fair, perhaps he has a load of old LEDs in stock. There are plenty of old dim red, yellow and green LEDs still made and I've still got some blue, white and violet LEDs from the 1990s to early 2000s, which need to be hammered to be very bright.
Did you miss where I said the following? I think it should be quite evident that I am aware of the existence of a) old LEDs, and b) inefficient LEDs still made today.

Traditionally, indicator LEDs were driven at around 20mA, which gave a nice pleasant, visible indicator. But with the insane efficiency of many (not all, but many) modern LEDs, 20mA is often too much. In many cases, way, way too much!

And
The upshot being that you cannot make blanket statements like “I use 220 ohms for 5V with no problems” anymore, because that can be fine for some LEDs and completely unusable for others.
That was the crux of the matter: blindly applying the guidelines of yesteryear is not a reliable method today.


P.S. The reason I started my reply to Analog Kid with “Again, your LED knowledge is outdated” is this other thread:
Yes, but in that case he'll have the same problem as with any other "high-efficiency" (i.e., 3.2V) LED: it might light directly from a 3-volt supply but will probably go out after the batteries droop a few tenths of a volt.
No it won't, because modern high efficiency red LEDs have a much lower voltage drop than white LEDs.

Thanks for that; obviously my knowledge of LEDs is a bit out of date. I didn't realize that one could now get high-brightness LEDs at <3V Vf.
 

Offline Analog Kid

  • Super Contributor
  • ***
  • Posts: 5015
  • Country: us
  • DANDY fan (Discretes Are Not Dead Yet)
Re: Questing about simplifying LED schematic
« Reply #22 on: November 20, 2024, 10:39:55 pm »
FWIW, I use 220Ω resistors on circuits with 5V supply, with no problems.
Again, your LED knowledge is outdated.
To be fair, perhaps he has a load of old LEDs in stock. There are plenty of old dim red, yellow and green LEDs still made and I've still got some blue, white and violet LEDs from the 1990s to early 2000s, which need to be hammered to be very bright.

That is exactly the case. The last time I bought any (non-super-bright) LEDs was quite some time ago.

So evidently I'm a bit behind the times here. Good to know.

BTW, my post was not mean to advise anyone else that they'd be perfectly OK with a 220Ω resistor @ 5V, just that that's been my experience so far.
 

Offline SjoerdTopic starter

  • Newbie
  • Posts: 8
  • Country: nl
Re: Questing about simplifying LED schematic
« Reply #23 on: November 23, 2024, 12:41:01 pm »
Okay,

Some of you said "show the schematics" and then "use KiCAD" so I had to learn kicad first and then transfer that what was on the breadboard to KiCAD - It's likely that I made some mistakes. I already noticed I'm missing one of the caps on the 74hc14 and there are no decoupling caps at all. Also the breadboard uses 5v on the "12v sensor input" (don't have a proper lab power-supply but its on it's way as we speak)

So here is the breadboard
2444255-0

And here is are schematics - I hope "I did a good job" since is kinda my first attempt  :)
2444259-1

And before any starts off with "that's all wrong" and such - the breadboard and what I tried to accomplish works - the code in de arduino works, even the receiver works. It's just more like - did I added the analog stuff correctly - Also the optocouplers are there because those input or from an entire different circuit and different ground and I want/need to keep it that way and I learned that using optocouplers would do the trick :) I'm here also to learn  :-+

« Last Edit: November 23, 2024, 12:49:53 pm by Sjoerd »
 

Offline PGPG

  • Super Contributor
  • ***
  • Posts: 1344
  • Country: pl
Re: Questing about simplifying LED schematic
« Reply #24 on: November 23, 2024, 01:53:40 pm »
And before any starts off with "that's all wrong" and such

1. You should not drive HC14 inputs through serial capacitors as you are not sure what the input state is after some time. Debounce circuit will have RC low pass filters (R in serie, C to GND).
2. Bi-directional LED is driven from Vcc/2. The better would be to connect it with one resistor in serie between two output pins.
3. Are you sure you will need transoptors at inputs? Do the sensors will have separate supply?
« Last Edit: November 23, 2024, 01:55:41 pm by PGPG »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->