4n25/35 optocoupler detect led on/off

Status
Not open for further replies.

StealthRT

Member
Hey all i am just wondering if my drawing below is correct in order to have an arduino detect an on or off led on another board using a optocoupler?



My thoughts of the above drawing is that when the led is on it will trigger the relay inside and send 5v to the arduino digital pin to read. 0v if the relay inside is not connected.

I also would possibly need to tell the arduino digital pin that its an input pullup like this:
Code:
pinMode(pin, INPUT_PULLUP);
please advise if this is correct or not.
 
It might work if you use the Opto coupler's transistor to pull the Arduino's input pin to ground. If the opto is off, the internal pull-up in the Arduino pulls the input pin high. If the opto is on, it sinks current, and pulls the input pin low.
 
You should use a separate current limiting resistor in case the LED in the opto has a higher on voltage than the one it's in series with.

Mike.
 
If you connect your opto directly across the blue LED (Vf ≈3.3V) it will hog all the current and the blue LED will never light. If that is ok then do it that way. If not then connect the opto in series with a resistor between PIO1 and Gnd. Check data sheets for current available on PIO1 and needed by opto.

Mike.
 
if you current mirro your led ? perhaps by some ratio to opto input ... would be quite fast (i assume)
your source by https://www.google.ee/

◄click to follow
to get - the image applies to https://www.vishay.com/docs/81864/4n25x000.pdf -- ****
then it takes to check the https://www.farnell.com/datasheets/2047068.pdf
to see that the company uses to mark the product from the same family so thet the text is oriented from least / highest pin no. toward the middle ones ...
so it takes one to two test to tell which is the case with 4N25
----------
note **** the datasheet shows characteristic graphs starting from 100µA iR-Led (Transmitter) current (IFW at legends) which has proven to be the case and in practice for xx817xx -s
----------
with uno
 
Last edited:
You could hitch up the opto like this and still have the blue LED light :
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…