Go Down

### Topic: Multiple Vdc Level Shifting... One Common Pull-up? (Read 949 times)previous topic - next topic

#### aous

##### Feb 28, 2011, 03:45 am
Hello,

I am building a simple circuit to sense if three different inputs have +12Vdc on them.  I am using the circuit here: http://arduino.cc/playground/uploads/Learning/Level_shifting_4_arduino.pdf.

I have to sense three different sources of +12Vdc.  I am going to use three 4N33s.  In the circuit at http://arduino.cc/playground/uploads/Learning/Level_shifting_4_arduino.pdf 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??)

#### retrolefty

#1
##### Feb 28, 2011, 03:53 am
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

#### aous

#2
##### Feb 28, 2011, 04:05 am
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?

#### retrolefty

#3
##### Feb 28, 2011, 07:44 am
Quote
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

Go Up

Please enter a valid email to subscribe

To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy