What happens to the output of Optocoupler input voltage is negative

digital-logicmicrocontrollerpcbschematicsswitches

Here is an example of circuit using VIshay Optocoupler 4N25

5V to 3.3V GPIO Output (Inverted)

schematic http://www.savagecircuits.com/attachment.php?attachmentid=294&d=1430452949

Logic
+5V Input —> 0.0V output GPIO LOW

+0V Input —> 3.3V output GPIO High

What happens to the output if my input is -5V???

Best Answer

As was mentioned in the comments, what you stated is actually opposite of what the outcome actually is.

When you have an input of 5V, the LED is off, which means no photons to turn on the phototransistor, so the transistor is off. If the transistor is off, then your your output is 3.3V

When you apply 0V to your input, you have current flow through the LED, and photons turn on the transistor, which basically brings it down to ground, so your output is 0V. '

In order to get the optocoupler to behave the way you specified in your description, you need to change where the input is applied. If you make the anode of the LED your input node, and ground the right side of R1, you can get the circuit to work as you described in text.

So what happens when you have -5V as your input ? The thing to know is that when the LED lights up, is when the transistor turns on, and in order for the LED to light up, you need to have current flow through the LED. In this case, you do because the input is at a lower potential than the anode.

However you also have more current going through that branch now and if the resistor is not sized appropriately, you will blow your LED rendering your optocoupler dead.

But what happens if you used the alternate wiring scheme where the input is applied to the anode instead ?

When the input goes -5V, the LED is reversed biased, since the anode is at -5V and the cathode is at 0V. IF the LED can withstand -5V reverse voltage, you are ok. Otherwise, you risk breaking the LED and you now have a dead optocoupler (again).

Looking at the datasheet, the absolute max reverse voltage is 5V, so you are really pushing boundaries, so your circuit may work always, work until it suddenly dies, or just die right off the bat.