Go Down

Topic: Optocoupler turns on but doesn't turn off (Read 5112 times) previous topic - next topic


I am trying to get Arduino to press a button on a wireless remote using an optocoupler. When I call digitalWrite(2, HIGH) the optocoupler goes into ON mode but it will stay on and not turn off even if call digitalWrite(2, LOW) is called.

I've connected the parts in this manner ...
Arduino Digital Output 2 -> 1000 ohm resistor -> optocoupler -> remote button (positive)
Arduino Digital GND <- remote button (negative)

I can't get the optocoupler into OFF mode, it just stays on. My assumption was that digitalWrite(2, HIGH) would trigger the optocoupler ON mode and digitalWrite(2, LOW) would turn it off. However, I am beginning to believe that something else might be required for the trigger the optocoupler's OFF mode? I also tried issuing ON twice, but it remained in ON state.

I am using a DVE (Vishay) K3023P optocoupler (http://www.datasheetsite.com/extpdf.php?q=http%3A%2F%2Fwww.ortodoxism.ro%2Fdatasheets%2Fvishay%2F83505.pdf)

Any thoughts? Thanks in advance!


Any chance you forgot "pinMode(2, OUTPUT);"?

The Aussie Shield: breakout all 28 pins to quick-connect terminals


You have picked the wrong type of opto-isolator. The one you have is an optically coupled triac. A triac is designed to switch AC voltages, no DC voltage. A triac once triggered will not turn off unless the source voltage is removed or the voltage polarity reverses. You need a standard opto-isolator that uses a npn transistor for it's output side.



The device that you have is designed for AC use not DC.  It's quite likely that the device will stay on until the AC CYCLE crosses zero again... which won't happen in a DC circuit... so it stays on.  

See,  triac is like two SCRs wired back to back, (so I guess  you need to understand what SCR's do)  The device  can pass current on both halves of the AC waveform. So, when triggered, it "latches" until the AC Voltage swings back to zero (or almost zero).

Dang... slow again...


Wow, those are some real quick responses! Didn't know what a triac was, but I do now! Thank you!


Thanks again for all your help earlier!

I am experiencing a new problem. I bought a new optocoupler (http://denethor.wlu.ca/pc200/data_sheets/4N25_f.pdf) and placed this into my circuit as follows ...

Arduino Digital Output 2 -> 470 ohm resistor -> 4N25 optocoupler LED anode

My code looks like this ...

Code: [Select]

void loop() {
    digitalWrite(2, HIGH); 
    digitalWrite(2, LOW); 

However, when I measure the resistance of the emitter and collector pins on the optoisolator it reads "70" ohms for 2 seconds and then "0" ohms for 2 seconds but never -0.00. From what I understand, -0.00 is a continuity and since there is none, the button on my remote control is never "pressed".

What might be causing this to happen? Thanks in advance!


What might be causing this to happen? Thanks in advance!

Probably just a fluke ( a pun, a littler meter joke! ) of your meter indication Vs the transistor response. The main thing is you are seeing a change, so I would just go ahead and wire the emitter/collector across your remotes switch contacts and see if it works. It will be polarity sensitive so you might have to switch it around if it doesn't work at first.



It will be polarity sensitive so you might have to switch it around if it doesn't work at first.

That was it! I reversed the connection to my remote and now everything works perfectly! It's funny because I've been trying everything else all evening! I will need to add "checking polarity" to my troubleshooting checklist. Thank you Lefty!

Yes, I have heard good things about Fluke multimeters. Maybe when I learn enough to appreciate a good multimeter I will invest in one!


I have 3 multimeters... one is a Fluke.  Even though the others have extra features (like cap meter or frequency meter) Fluke is still my favorite.

Go Up