Multiple Vdc Level Shifting... One Common Pull-up?

Hello,

I am building a simple circuit to sense if three different inputs have +12Vdc on them. I am using the circuit here: Arduino Playground - HomePage.

I have to sense three different sources of +12Vdc. I am going to use three 4N33s. In the circuit at Arduino Playground - HomePage can I use one R3 across each of the 4N33 (i.e. Arduino +5Vdc -> R3 (4k7) -> Paralleled to pin 5 of OK1, OK2 and OK3. Pin 5 of OK1, OK2 and OK3 to digitalpin 1, 2 and 3 respectively)?

I think R3 is only biasing the input of the digitalpin to high, then when current flows across the opto-coupler, you get a emitter/collector flow thus dropping then input low. Is this how it works or does R3 serve some other purpose (bias for the transistor??)

Cheers for your help.

No you can't 'share' one resistor for the 3 isolators.

However you can use no resistors if you just enable the internal pull-up resistors for each input pin you use.

do it like this for each input pin used:

pinMode(PinX, INPUT); // set pin to input mode
digitalWrite(PinX, HIGH); // enables the internal pull-up resistor

That will provide the collector current for the optoisolator's output transistor. A digitalRead of LOW means the opto is turned on and a HIGH reading means the opto is off.

Lefty

Ok that makes sense.

So by using the internal pull-up resistor, I can simply hook pin 5 of the optocoupler to an input without the need to use an external +5Vdc?

So by using the internal pull-up resistor, I can simply hook pin 5 of the optocoupler to an input without the need to use an external +5Vdc?

Correct