Low Cost PCB's Low Cost Components

Author Topic: 4n25/35 optocoupler detect led on/off  (Read 259 times)

0 Members and 1 Guest are viewing this topic.

Offline Stealthrt

  • Contributor
  • Posts: 40
4n25/35 optocoupler detect led on/off
« on: October 18, 2017, 04:32:29 PM »
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: [Select]
pinMode(pin, INPUT_PULLUP);
please advise if this is correct or not.
 

Offline george.b

  • Regular Contributor
  • *
  • Posts: 102
  • Country: br
Re: 4n25/35 optocoupler detect led on/off
« Reply #1 on: October 18, 2017, 05:07:17 PM »
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?

Kinda, yeah. It'd be good to add a 1k to 10k resistor from pin 4 to ground.

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.

There is no relay as such inside - it's a phototransistor ;)

I also would possibly need to tell the arduino digital pin that its an input pullup like this:
Code: [Select]
pinMode(pin, INPUT_PULLUP);
please advise if this is correct or not.

Nope, if anything, you'd need a pulldown. You could save the one resistor I mentioned by setting the input as you said, then connecting optocoupler pin 5 to the digital input, and pin 4 to ground.
 

Offline eblc1388

  • Regular Contributor
  • *
  • Posts: 61
  • Country: gb
Re: 4n25/35 optocoupler detect led on/off
« Reply #2 on: October 18, 2017, 06:57:37 PM »
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?

You cannot directly connect the optocoupler inputs to the LED you want to monitor. The original LED will not be able to light anymore if you do so.

There are two possible ways to do so as shown in the image. Method#1 is the preferred method.



 

Offline george.b

  • Regular Contributor
  • *
  • Posts: 102
  • Country: br
Re: 4n25/35 optocoupler detect led on/off
« Reply #3 on: October 18, 2017, 10:21:09 PM »
You cannot directly connect the optocoupler inputs to the LED you want to monitor. The original LED will not be able to light anymore if you do so.

Ah, true, the LED in a 4N25/4N35 is infrared, with a lower forward voltage than a red LED. I didn't think of that.
 

Offline Stealthrt

  • Contributor
  • Posts: 40
Re: 4n25/35 optocoupler detect led on/off
« Reply #4 on: Yesterday at 05:38:35 PM »
im hooking the 4n25 up to the hm-10 led:
 

Online woody

  • Contributor
  • Posts: 41
  • Country: nl
Re: 4n25/35 optocoupler detect led on/off
« Reply #5 on: Yesterday at 06:06:14 PM »
I skimmed the datasheet on the HM10 for 30 seconds so I might be completely wrong, but it seems there is a command to query the status of the system LED:  AT+PIO1?

If that works it saves you a couple of components  :)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf