Hi,
I am looking for some help for my small project with a 4N35 optocoupler.
A 9V powered sensor is connected to the LED of the optocoupler (Pin 1) and GND (Pin 2).
I have calculated the Input resistor in the following way:
Forward Voltage of the 4N35 LED = 1,3V
Forward Current of the 4N35 LED = 5mA
Rforward = (9V-1,3V)/ 5mA = 1540 Ohm
I think this is correct but I have problems calculating the output resistor.
Pin 5 of the 4N35 is connected to 3V3 of my Arduino.
Pin 4 of the 4N35 is connected via a 100kOhm resistor to GND of the Arduino.
Pin 4 of the 4N35 is connected to a digital input pin.
I am not sure if the 100kOhm resistor is necessary and I am thinking about using a resistor for the digital input too.
The minimum Current Transfer Ratio of the 4N35 is 40% and my safety factor is 2 so I would calculate this resistor the following way:
Routput= (3,3 * 2)/ (5mA*0,4) = 3300 Ohm
I would be very grateful if you could tell me if this is correct or if there are any mistakes. There are so many different opinions on the interent and I am really confused.
Thank you very much for your help!
Hi,
This looks good. The 100K is a good idea so that any small leakage in the 4N35 output transistor doesn't pull the Arduino input pin up.
Does it work??
Some of us hackers would have started there...
Seriously, you are doing the right things by understanding and calculating stuff.
(Some 4N35 info on THIS: page)
This:
Pin 5 of the 4N35 is connected to 3V3 of my Arduino.
Pin 4 of the 4N35 is connected via a 100kOhm resistor to GND of the Arduino.
Pin 4 of the 4N35 is connected to a digital input pin.
Is reverse of the normal setup which is a pullup instead of pulldown.
Logic can be setup in the code. There is no reason to change the hardware.
The 100k should be from the collector (use the device names as well as pin numbers so we know you have it right) to the Vcc of your uP.
Emitter should be connected to GND.
Collector should be connected to digital input pin.
Thank you both very much for your answers! So far it works without any problems 
I am writing a short tutorial and therefor I wanted to know if it is correct what I am doing. I do not want to learn other people wrong things.
So just to clarify it for me please, is the 3300 Ohm resistor necessary between Emitter and Digital Input pin?
@raschemmel: As far as I understand you are speaking about the inverted circuit. That would mean that my Arduino input pin is High until my 9V device lights up the LED in the 4N35. This would result in a higher power consuption. My 9V device will be off most of the time and my Arduino is battery powered.
@raschemmel: As far as I understand you are speaking about the inverted circuit. That would mean that my Arduino input pin is High until my 9V device lights up the LED in the 4N35. This would result in a higher power consuption. My 9V device will be off most of the time and my Arduino is battery powered.
Ok.
That's a popular misconception. Do your Ohm's Law.
THINK ABOUT IT
An arduino (or any other input) is a HIGH impedance input (about 100 Mohms)
The transistor is OFF, so NO current can pass through the transistor, which leaves a voltage divider of 50 k from the collector to 3.3 V and 100 Mohms from the collector to GND.
Since an Atmel processor input current is in the order of nAs, your current is ?
3.3V/100050000 = ?
P = 108.8 nW