One resistor or seven?

Thread Starter

BReeves

Joined Nov 24, 2012
410
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?
 

John P

Joined Oct 14, 2008
2,068
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.
 

Thread Starter

BReeves

Joined Nov 24, 2012
410
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.
 

Alec_t

Joined Sep 17, 2013
15,163
Guess I could set the resistor value so if two are hit the LEDs will be too dim to fire the opto
If more than one switch is pressed the LED with the lowest Vf will hog the current and be brighter than the others.
 

WBahn

Joined Mar 31, 2012
33,331
If more than one switch is pressed the LED with the lowest Vf will hog the current and be brighter than the others.
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.
 

wayneh

Joined Sep 9, 2010
18,183
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.
 

WBahn

Joined Mar 31, 2012
33,331
If you have sufficient voltage you could connect all the LEDs in series to avoid any current hogging problem.
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?
 

WBahn

Joined Mar 31, 2012
33,331
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.
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.
 

WBahn

Joined Mar 31, 2012
33,331
True enough! Should've thought about that a bit more before posting. This would make a nice exam question.
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.
 

Thread Starter

BReeves

Joined Nov 24, 2012
410
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.
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.
 
Top