# One resistor or seven?

Discussion in 'General Electronics Chat' started by BReeves, Nov 26, 2013.

1. ### BReeves Thread Starter Member

Nov 24, 2012
415
65
Going to have 7 switches supplying 12 volts through a resistor(s) to the LED's in 7 optoisolators feeding a micro. In normal operation only one switch will be closed at any one time but some idiot could/will press two just to see what happens.

I'm thinking I can get away with just a single current limiting resistor on the supply side instead of using a resistor for each opto. Should someone press more than one switch the code will ignore it.

Can anyone think of a good reason not to use a single resistor?

2. ### Meixner Member

Sep 26, 2011
116
22
I would do it with 1 resistor

3. ### John P AAC Fanatic!

Oct 14, 2008
1,671
241
I suppose you should consider the worst-case condition, where someone presses all the buttons at once. How much current is likely to flow then, and how hot does the resistor get? If you don't mind the invalid input to the processor, that's the only thing I can see to worry about.

4. ### Alec_t AAC Fanatic!

Sep 17, 2013
7,152
1,495
About the same as if only one is pressed.

5. ### BReeves Thread Starter Member

Nov 24, 2012
415
65
Thanks, confirms what I was thinking. Sometimes I don't trust my own judgment.

3 of the switches are in a locked cabinet, most anyone could hit at one time is 4. The software will only respond to the first input within a given time.

Guess I could set the resistor value so if two are hit the LEDs will be too dim to fire the opto. Naw, too many variables to make that practical.

6. ### Alec_t AAC Fanatic!

Sep 17, 2013
7,152
1,495
If more than one switch is pressed the LED with the lowest Vf will hog the current and be brighter than the others.

7. ### WBahn Moderator

Mar 31, 2012
20,267
5,763
That's in the long run. Initially, they may share the current much more evenly and then, as thermal runaway builds, one will hog the current from the others.

Also, no two switches are going to be pressed as exactly the same time, so one opto will be fired before the others. In most cases, the micro will respond to one of the switches (may seem like a random choice to a human that percieves things at human time scales) and ignore the others. If that is acceptable, then you are good to go.

8. ### crutschow Expert

Mar 14, 2008
16,575
4,477
If you have sufficient voltage you could connect all the LEDs in series to avoid any current hogging problem.

9. ### wayneh Expert

Sep 9, 2010
13,638
4,433
One more vote for it being OK, as long as the resistor is sized to not burn up if all switches are thrown at once. Adhering to Murphy's law is not optional.

10. ### WBahn Moderator

Mar 31, 2012
20,267
5,763
Wouldn't that defeat the very purpose, which is to have seven switches that are used to select which of the seven optoisolators get activated?

11. ### WBahn Moderator

Mar 31, 2012
20,267
5,763
If you size it for one switch, then it is sized for pretty much any number of switches. If you have a hundred LEDs and they are all turned on, then the voltage across the LEDs would only go down by something between 100mV and 200mV. So the voltage across the resistor is going to be basically the same and the total current is going to be basically the same, it is just going to be split among all of the switches that are on.

12. ### wayneh Expert

Sep 9, 2010
13,638
4,433
True enough! Should've thought about that a bit more before posting. This would make a nice exam question.

Mar 14, 2008
16,575
4,477

14. ### WBahn Moderator

Mar 31, 2012
20,267
5,763
It would, though it would probably have to be phrased pretty carefully in order to be sure that the person didn't give a valid response that was other than what was intended based on a valid, though possibly incomplete, understanding of the circuit and/or the intent.

15. ### WBahn Moderator

Mar 31, 2012
20,267
5,763
We all do it from time to time. As long as we keep each other honest, it all shakes out in the end to a net positive.

16. ### BReeves Thread Starter Member

Nov 24, 2012
415
65
It's for a photo booth, the buttons allow the guest to select options.

I wrote both the code on the micro that reads the buttons plus the code running on the computer that does all the hard stuff. Gives me allot of control over what can happen when.