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.