Skip to main content
added 1 character in body
Source Link
vir
  • 20.3k
  • 1
  • 17
  • 40

The "optocoupler disease" is a symptom of a few misguided design choices that manifest as a "rash" of optocouplers on the outputs of an Arduino/RPi/microcontroller. The designer usually wants to prevent damage to the Arduino from high voltage from a differently-supplied section of the circuit making it back to the GPIO pin from a damaged component, inductive kickback from a relay or motor coil, or a possibly miswired connection. This is very understandable; frying probably the most expensive part of your project is always a bad day and if there is e.g. a relay that is switching line voltage, it can be tempting to add another layer of protection between lethal voltage and the user interface. What we frequently see in practice is something like this:

schematic

simulate this circuit – Schematic created using CircuitLab

At first glance, this looks reasonable; there is what appears to be an air gap between the two parts of the circuit with the optocoupler providing the isolated signal linkage between them. The fatal flaw is in thinking that ground is always and forever 0V and forgetting that it is simply another node:

schematic

simulate this circuit

(Apologies to @andy_aka for bussing ground)

With the ground connection made explicit, the signal path between both sides of the circuit - and, critically, around the optocoupler - is more obvious. The optocoupler, when deployed in this configuration, is not providing meaningful isolation. It is doubly useless if e.g. the relay portion of the circuit is being powered from the same supply as the Arduino.

So what are the options available to the designer? One option for this example - if isolation is still desired - is to have separated grounds between the 5V and 12V sides. This removes the path for voltage transients to conduct from one side to the other. Care should be taken, however, to ensure that there are no other parts of the circuit that require grounds to be harmonized between supply domains (transistors with a gate/base supplied by one side and a source/emitter referenced to the other, for example).

Another option is to remove the optoisolator entirely; this is what is generally recommended to designers in this situation. Since the original circuit didn't have meaningful isolation, there's no need to have a component that's only for show:

schematic

simulate this circuit

D2 provides a path for the inductive kick of the relay coil, shunting it away from Q2 and the GPIO pin; the relay itself provides the isolation between the switched circuit and everything else.

When are optocouplers useful? This is very application dependent so I'll just touch on it briefly and very generally. For applications in which the designer does not have control over what is attached to the input or the output and where an overvoltage could be reasonably expected to be present, an optocoupler can be a useful addition, e (e.g. GPIO pins that are accessible to the user), an optocoupler can be a useful addition. Switchmode power supplies are another canonical application in which feedback between the low voltage and high voltage sides is required while still maintaining galvanic isolation.

The "optocoupler disease" is a symptom of a few misguided design choices that manifest as a "rash" of optocouplers on the outputs of an Arduino/RPi/microcontroller. The designer usually wants to prevent damage to the Arduino from high voltage from a differently-supplied section of the circuit making it back to the GPIO pin from a damaged component, inductive kickback from a relay or motor coil, or a possibly miswired connection. This is very understandable; frying probably the most expensive part of your project is always a bad day and if there is e.g. a relay that is switching line voltage, it can be tempting to add another layer of protection between lethal voltage and the user interface. What we frequently see in practice is something like this:

schematic

simulate this circuit – Schematic created using CircuitLab

At first glance, this looks reasonable; there is what appears to be an air gap between the two parts of the circuit with the optocoupler providing the isolated signal linkage between them. The fatal flaw is in thinking that ground is always and forever 0V and forgetting that it is simply another node:

schematic

simulate this circuit

(Apologies to @andy_aka for bussing ground)

With the ground connection made explicit, the signal path between both sides of the circuit - and, critically, around the optocoupler - is more obvious. The optocoupler, when deployed in this configuration, is not providing meaningful isolation. It is doubly useless if e.g. the relay portion of the circuit is being powered from the same supply as the Arduino.

So what are the options available to the designer? One option for this example - if isolation is still desired - is to have separated grounds between the 5V and 12V sides. This removes the path for voltage transients to conduct from one side to the other. Care should be taken, however, to ensure that there are no other parts of the circuit that require grounds to be harmonized between supply domains (transistors with a gate/base supplied by one side and a source/emitter referenced to the other, for example).

Another option is to remove the optoisolator entirely; this is what is generally recommended to designers in this situation. Since the original circuit didn't have meaningful isolation, there's no need to have a component that's only for show:

schematic

simulate this circuit

D2 provides a path for the inductive kick of the relay coil, shunting it away from Q2 and the GPIO pin; the relay itself provides the isolation between the switched circuit and everything else.

When are optocouplers useful? This is very application dependent so I'll just touch on it briefly and very generally. For applications in which the designer does not have control over what is attached to the input or the output and where an overvoltage could be reasonably expected to be present, an optocoupler can be a useful addition, e.g. GPIO pins that are accessible to the user. Switchmode power supplies are another canonical application in which feedback between the low voltage and high voltage sides is required while still maintaining galvanic isolation.

The "optocoupler disease" is a symptom of a few misguided design choices that manifest as a "rash" of optocouplers on the outputs of an Arduino/RPi/microcontroller. The designer usually wants to prevent damage to the Arduino from high voltage from a differently-supplied section of the circuit making it back to the GPIO pin from a damaged component, inductive kickback from a relay or motor coil, or a possibly miswired connection. This is very understandable; frying probably the most expensive part of your project is always a bad day and if there is e.g. a relay that is switching line voltage, it can be tempting to add another layer of protection between lethal voltage and the user interface. What we frequently see in practice is something like this:

schematic

simulate this circuit – Schematic created using CircuitLab

At first glance, this looks reasonable; there is what appears to be an air gap between the two parts of the circuit with the optocoupler providing the isolated signal linkage between them. The fatal flaw is in thinking that ground is always and forever 0V and forgetting that it is simply another node:

schematic

simulate this circuit

(Apologies to @andy_aka for bussing ground)

With the ground connection made explicit, the signal path between both sides of the circuit - and, critically, around the optocoupler - is more obvious. The optocoupler, when deployed in this configuration, is not providing meaningful isolation. It is doubly useless if e.g. the relay portion of the circuit is being powered from the same supply as the Arduino.

So what are the options available to the designer? One option for this example - if isolation is still desired - is to have separated grounds between the 5V and 12V sides. This removes the path for voltage transients to conduct from one side to the other. Care should be taken, however, to ensure that there are no other parts of the circuit that require grounds to be harmonized between supply domains (transistors with a gate/base supplied by one side and a source/emitter referenced to the other, for example).

Another option is to remove the optoisolator entirely; this is what is generally recommended to designers in this situation. Since the original circuit didn't have meaningful isolation, there's no need to have a component that's only for show:

schematic

simulate this circuit

D2 provides a path for the inductive kick of the relay coil, shunting it away from Q2 and the GPIO pin; the relay itself provides the isolation between the switched circuit and everything else.

When are optocouplers useful? This is very application dependent so I'll just touch on it briefly and very generally. For applications in which the designer does not have control over what is attached to the input or the output and where an overvoltage could be reasonably expected to be present (e.g. GPIO pins that are accessible to the user), an optocoupler can be a useful addition. Switchmode power supplies are another canonical application in which feedback between the low voltage and high voltage sides is required while still maintaining galvanic isolation.

added 197 characters in body
Source Link
vir
  • 20.3k
  • 1
  • 17
  • 40

The "optocoupler disease" is a symptom of a few misguided design choices that manifest as a "rash" of optocouplers on the outputs of an Arduino/RPi/microcontroller. The designer usually wants to prevent damage to the Arduino from high voltage from a differently-supplied section of the circuit making it back to the GPIO pin from a damaged component, inductive kickback from a relay or motor coil, or a possibly miswired connection. This is very understandable; frying probably the most expensive part of your project is always a bad day and if there is e.g. a relay that is switching line voltage, it can be tempting to add another layer of protection between lethal voltage and the user interface. What we frequently see in practice is something like this:

schematic

simulate this circuit – Schematic created using CircuitLab

At first glance, this looks reasonable; there is what appears to be an air gap between the two parts of the circuit with the optocoupler providing the isolated signal linkage between them. The fatal flaw is in thinking that ground is always and forever 0V and forgetting that it is simply another node:

schematic

simulate this circuit

(Apologies to @andy_aka for bussing ground)

With the ground connection made explicit, the signal path between both sides of the circuit - and, critically, around the optocoupler - is more obvious. The optocoupler, when deployed in this configuration, is not providing meaningful isolation. It is doubly useless if e.g. the relay portion of the circuit is being powered from the same supply as the Arduino.

So what are the options available to the designer? One option for this example - if isolation is still desired - is to have separated grounds between the 5V and 12V sides. This removes the path for voltage transients to conduct from one side to the other. Care should be taken, however, to ensure that there are no other parts of the circuit that require grounds to be harmonized between supply domains (transistors with a gate/base supplied by one side and a source/emitter referenced to the other, for example).

Another option is to remove the optoisolator entirely; this is what is generally recommended to designers in this situation. Since the original circuit didn't have meaningful isolation, there's no need to have a component that's only for show:

schematic

simulate this circuit

D2 provides a path for the inductive kick of the relay coil, shunting it away from Q2 and the GPIO pin; the relay itself provides the isolation between the switched circuit and everything else.

When are optocouplers useful? This is very application dependent so I'll just touch on it briefly and very generally. For applications in which the designer does not have control over what is attached to the input or the output and where an overvoltage could be reasonably expected to be present, an optocoupler can be a useful addition, e.g. GPIO pins that are accessible to the user. Switchmode power supplies are another canonical application in which feedback between the low voltage and high voltage sides is required while still maintaining galvanic isolation.

The "optocoupler disease" is a symptom of a few misguided design choices that manifest as a "rash" of optocouplers on the outputs of an Arduino/RPi/microcontroller. The designer usually wants to prevent damage to the Arduino from high voltage from a differently-supplied section of the circuit making it back to the GPIO pin from a damaged component, inductive kickback from a relay or motor coil, or a possibly miswired connection. This is very understandable; frying probably the most expensive part of your project is always a bad day and if there is e.g. a relay that is switching line voltage, it can be tempting to add another layer of protection between lethal voltage and the user interface. What we frequently see in practice is something like this:

schematic

simulate this circuit – Schematic created using CircuitLab

At first glance, this looks reasonable; there is what appears to be an air gap between the two parts of the circuit with the optocoupler providing the isolated signal linkage between them. The fatal flaw is in thinking that ground is always and forever 0V and forgetting that it is simply another node:

schematic

simulate this circuit

(Apologies to @andy_aka for bussing ground)

With the ground connection made explicit, the signal path between both sides of the circuit - and, critically, around the optocoupler - is more obvious. The optocoupler, when deployed in this configuration, is not providing meaningful isolation. It is doubly useless if e.g. the relay portion of the circuit is being powered from the same supply as the Arduino.

So what are the options available to the designer? One option for this example - if isolation is still desired - is to have separated grounds between the 5V and 12V sides. This removes the path for voltage transients to conduct from one side to the other. Care should be taken, however, to ensure that there are no other parts of the circuit that require grounds to be harmonized between supply domains (transistors with a gate/base supplied by one side and a source/emitter referenced to the other, for example).

Another option is to remove the optoisolator entirely; this is what is generally recommended to designers in this situation. Since the original circuit didn't have meaningful isolation, there's no need to have a component that's only for show:

schematic

simulate this circuit

When are optocouplers useful? This is very application dependent so I'll just touch on it briefly and very generally. For applications in which the designer does not have control over what is attached to the input or the output and where an overvoltage could be reasonably expected to be present, an optocoupler can be a useful addition, e.g. GPIO pins that are accessible to the user. Switchmode power supplies are another canonical application in which feedback between the low voltage and high voltage sides is required while still maintaining galvanic isolation.

The "optocoupler disease" is a symptom of a few misguided design choices that manifest as a "rash" of optocouplers on the outputs of an Arduino/RPi/microcontroller. The designer usually wants to prevent damage to the Arduino from high voltage from a differently-supplied section of the circuit making it back to the GPIO pin from a damaged component, inductive kickback from a relay or motor coil, or a possibly miswired connection. This is very understandable; frying probably the most expensive part of your project is always a bad day and if there is e.g. a relay that is switching line voltage, it can be tempting to add another layer of protection between lethal voltage and the user interface. What we frequently see in practice is something like this:

schematic

simulate this circuit – Schematic created using CircuitLab

At first glance, this looks reasonable; there is what appears to be an air gap between the two parts of the circuit with the optocoupler providing the isolated signal linkage between them. The fatal flaw is in thinking that ground is always and forever 0V and forgetting that it is simply another node:

schematic

simulate this circuit

(Apologies to @andy_aka for bussing ground)

With the ground connection made explicit, the signal path between both sides of the circuit - and, critically, around the optocoupler - is more obvious. The optocoupler, when deployed in this configuration, is not providing meaningful isolation. It is doubly useless if e.g. the relay portion of the circuit is being powered from the same supply as the Arduino.

So what are the options available to the designer? One option for this example - if isolation is still desired - is to have separated grounds between the 5V and 12V sides. This removes the path for voltage transients to conduct from one side to the other. Care should be taken, however, to ensure that there are no other parts of the circuit that require grounds to be harmonized between supply domains (transistors with a gate/base supplied by one side and a source/emitter referenced to the other, for example).

Another option is to remove the optoisolator entirely; this is what is generally recommended to designers in this situation. Since the original circuit didn't have meaningful isolation, there's no need to have a component that's only for show:

schematic

simulate this circuit

D2 provides a path for the inductive kick of the relay coil, shunting it away from Q2 and the GPIO pin; the relay itself provides the isolation between the switched circuit and everything else.

When are optocouplers useful? This is very application dependent so I'll just touch on it briefly and very generally. For applications in which the designer does not have control over what is attached to the input or the output and where an overvoltage could be reasonably expected to be present, an optocoupler can be a useful addition, e.g. GPIO pins that are accessible to the user. Switchmode power supplies are another canonical application in which feedback between the low voltage and high voltage sides is required while still maintaining galvanic isolation.

added 569 characters in body
Source Link
vir
  • 20.3k
  • 1
  • 17
  • 40

The "optocoupler disease" is a symptom of a few misguided design choices that manifest as a "rash" of optocouplers on the outputs of an Arduino/RPi/microcontroller. The designer usually wants to prevent damage to the Arduino from high voltage from a differently-supplied section of the circuit making it back to the GPIO pin from a damaged component, inductive kickback from a relay or motor coil, or a possibly miswired connection. This is very understandable; frying probably the most expensive part of your project is always a bad day and if there is e.g. a relay that is switching line voltage, it can be tempting to add another layer of protection between lethal voltage and the user interface. What we frequently see in practice is something like this:

schematic

simulate this circuit – Schematic created using CircuitLab

At first glance, this looks reasonable; there is what appears to be an air gap between the two parts of the circuit with the optocoupler providing the isolated signal linkage between them. The fatal flaw is in thinking that ground is always and forever 0V and forgetting that it is simply another node:

schematic

simulate this circuit

(Apologies to @andy_aka for bussing ground)

With the ground connection made explicit, the signal path between both sides of the circuit - and, critically, around the optocoupler - is more obvious. The optocoupler, when deployed in this configuration, is not providing meaningful isolation; itisolation. It is doubly useless if e.g. the relay portion of the circuit is being powered from the same supply as the Arduino.

So what are the options available to the designer? One option for this example - if isolation is still desired - is to have separated grounds between the 5V and 12V sides. This removes the path for voltage transients to conduct from one side to the other. Care should be taken, however, to ensure that there are no other parts of the circuit that require grounds to be harmonized between supply domains (transistors with a gate/base supplied by one side and a source/emitter referenced to the other, for example).

Another option is to remove the optoisolator entirely; this is what is generally recommended to designers in this situation. Since the original circuit didn't have meaningful isolation, there's no need to have a component that's only for show:

schematic

simulate this circuit

When are optocouplers useful? This is very application dependent so I'll just touch on it briefly and very generally. For applications in which the designer does not have control over what is attached to the input or the output and where an overvoltage could be reasonably expected to be present, an optocoupler can be a useful addition, e.g. GPIO pins that are accessible to the user. Switchmode power supplies are another canonical application in which feedback between the low voltage and high voltage sides is required while still maintaining galvanic isolation.

The "optocoupler disease" is a symptom of a few misguided design choices that manifest as a "rash" of optocouplers on the outputs of an Arduino/RPi/microcontroller. The designer usually wants to prevent damage to the Arduino from high voltage from a differently-supplied section of the circuit making it back to the GPIO pin from a damaged component, inductive kickback from a relay or motor coil, or a possibly miswired connection. This is very understandable; frying probably the most expensive part of your project is always a bad day. What we frequently see in practice is something like this:

schematic

simulate this circuit – Schematic created using CircuitLab

At first glance, this looks reasonable; there is what appears to be an air gap between the two parts of the circuit with the optocoupler providing the isolated signal linkage between them. The fatal flaw is in thinking that ground is always and forever 0V and forgetting that it is simply another node:

schematic

simulate this circuit

(Apologies to @andy_aka for bussing ground)

With the ground connection made explicit, the signal path between both sides of the circuit - and, critically, around the optocoupler - is more obvious. The optocoupler, when deployed in this configuration, is not providing meaningful isolation; it is doubly useless if e.g. the relay portion of the circuit is being powered from the same supply as the Arduino.

So what are the options available to the designer? One option for this example - if isolation is still desired - is to have separated grounds between the 5V and 12V sides. This removes the path for voltage transients to conduct from one side to the other. Care should be taken, however, to ensure that there are no other parts of the circuit that require grounds to be harmonized between supply domains (transistors with a gate/base supplied by one side and a source/emitter referenced to the other, for example).

Another option is to remove the optoisolator entirely; this is what is generally recommended to designers in this situation. Since the original circuit didn't have meaningful isolation, there's no need to have a component that's only for show:

schematic

simulate this circuit

The "optocoupler disease" is a symptom of a few misguided design choices that manifest as a "rash" of optocouplers on the outputs of an Arduino/RPi/microcontroller. The designer usually wants to prevent damage to the Arduino from high voltage from a differently-supplied section of the circuit making it back to the GPIO pin from a damaged component, inductive kickback from a relay or motor coil, or a possibly miswired connection. This is very understandable; frying probably the most expensive part of your project is always a bad day and if there is e.g. a relay that is switching line voltage, it can be tempting to add another layer of protection between lethal voltage and the user interface. What we frequently see in practice is something like this:

schematic

simulate this circuit – Schematic created using CircuitLab

At first glance, this looks reasonable; there is what appears to be an air gap between the two parts of the circuit with the optocoupler providing the isolated signal linkage between them. The fatal flaw is in thinking that ground is always and forever 0V and forgetting that it is simply another node:

schematic

simulate this circuit

(Apologies to @andy_aka for bussing ground)

With the ground connection made explicit, the signal path between both sides of the circuit - and, critically, around the optocoupler - is more obvious. The optocoupler, when deployed in this configuration, is not providing meaningful isolation. It is doubly useless if e.g. the relay portion of the circuit is being powered from the same supply as the Arduino.

So what are the options available to the designer? One option for this example - if isolation is still desired - is to have separated grounds between the 5V and 12V sides. This removes the path for voltage transients to conduct from one side to the other. Care should be taken, however, to ensure that there are no other parts of the circuit that require grounds to be harmonized between supply domains (transistors with a gate/base supplied by one side and a source/emitter referenced to the other, for example).

Another option is to remove the optoisolator entirely; this is what is generally recommended to designers in this situation. Since the original circuit didn't have meaningful isolation, there's no need to have a component that's only for show:

schematic

simulate this circuit

When are optocouplers useful? This is very application dependent so I'll just touch on it briefly and very generally. For applications in which the designer does not have control over what is attached to the input or the output and where an overvoltage could be reasonably expected to be present, an optocoupler can be a useful addition, e.g. GPIO pins that are accessible to the user. Switchmode power supplies are another canonical application in which feedback between the low voltage and high voltage sides is required while still maintaining galvanic isolation.

Source Link
vir
  • 20.3k
  • 1
  • 17
  • 40
Loading