I have optically isolated inputs on one of my projects (4n32 opto-isolators).
I currently have 3 possible voltages to 'trigger' them by having 3 pins with different resistors in series for 5v, 12v and 24v inputs (plus the opto isolators 0v pin).
This take up quite a lot of PCB space and limits me to 3x certain voltages.
On my next PCB design, I am thinking of using a simple 3 pin input with a different method.
The 0v for the opto isolator, a direct 3.3v input pin to the opto-isolator with a relevant resistor in series, and then a L78L33C 3.3v regulator on a third pin to give me a 5v-30v input.
Does this seem like a reasonable idea for a multi-voltage input?
Not sure exactly what resistor to feed the 4n32 opto-isolator with. 120r seemed like a reasonable choice.
Because for 4x opto-inputs I have 12x resistors and 16 input screw terminals.
This cuts the footprint down to 4 resistors and 12 input screws terminals, but more importantly, the input is over a wider range.... not tied to certain voltages.
Why do people answer with WHY? Not asking about my PCB layout, I am asking about the concept
You mentioned the PCB layout. You also mentioned an uncertainty that you had. So I wanted to tease out the cause of the uncertainty. It's very easy to understand why I ask why.
No design or design technique is good or bad in isolation. It's in context.
Try a 2k2 resistor.
At 3.3V input the input current will be 1mA. The output current is, according to the datasheet, at least 0.5mA, enough to trigger the processor. At 30V input the current will be 10mA and the heat dissipation will be 13mW, where the maximum of the device is 70mW.
Now you have an input that takes anything from 3 to 30V with only 1 resistor.
The worrying thing is the heat from the resistor. That will be 300mW, so you need a 0.5W resistor.
I used a Holtek HT7533-1 3.3v regulator with a 10uf cap across the input. I then put a 120r resistor on the output to the Opto-isolator.
This seems to work well and give me 3.3v - 30v DC input.
The reason for multiple voltage input is I build projects that frequently use 5v, 12v or 24v. I didn't want individual inputs for these voltages, as it takes up board space. This is a 'multi-function' board.
Just drawing the schematic now. I'll post that when done
The arduino internal pull-up is about 20K (to Vcc) and VIL needs to be below about 1V to register as a good "LOW"
so you need to pull a current of over 0.25mA:
Or with your external pull-up to 3.3V 3.3V - 1.0V = 2.3V/10k = .23mA
so lets try to pull 1mA.
A 1k input resistor will give
3.3 - 1.5 = 1.8V / 1k = 1.8mA
30V - 1.5 = 28.5V /1k = 28.5mA
So it seems to me all you need is that one resistor.
This cuts the footprint down to 4 resistors and 8 input screws terminals, but more importantly, the input is over a wider range.... not tied to certain voltages.
OK. So I have two options then. I can use a 1206 footprint, 2W resistor, or stick with my 3.3v regulator.
I Changed the reg to another one I had that actually seems to work well from 3.3v to 40v (that is it's spec).
Ridiculously, I can buy 3 voltage regs for the cost of one 2w resistor.
PCB footprint wise, there isn't a lot in it, as the reg is sot23 footprint.