Ask MAKE: Using an optocoupler

Ask MAKE: Using an optocoupler

Ask MAKE is a weekly column where we answer reader questions, like yours. Write them in to mattm@makezine.comor drop us a line on Twitter. We can’t wait to tackle your conundrums!


Matt writes in:

We are working on a project to control a CW ham radio keyer using a computer, and are concerned about protecting the computer from the radio. We heard that an opto-isolator could be used for this, but aren’t sure how to go about it.

Good question! An opto-coupler is a device that can be used to electrically isolate two circuits, so that a voltage spike or other problem on one side will not destroy the circuit on the other side. A common use for them is when you want to interface a computer to an AC-powered device, such as a light or a motor. Usually, the opto-coupler will not be used to control the device directly, and instead will just transfer a signal from one circuit to another.


So, how does it work? You can think of an optocoupler as a combination of an LED and a phototransistor. To send a signal, the transmitting side power the internal LED, just as you would power a regular LED. This lights up and causes the phototransistor on the other to start conducting current. You can think of it as kind of a switch at this point, and use it to turn on a low-power device directly, or turn on a relay to turn on a higher-powered device. The above circuit diagram should work for an automatic keyer. Choose the resistor based on your microcontroller voltage and the current draw of the optocoupler chip that you use. One thing to remember is that the output is polarized, so you have to make sure to connect it up so that the high voltage side is on the collector, and the low voltage side on the emitter. Good luck with your keyer!

4 thoughts on “Ask MAKE: Using an optocoupler

  1. Mike Yancey says:

    These conventional optocouplers (4N26…4N35) are great for isolating these different grounds.

    However, if you’re building a morse keyer to use on modern radios (regular + shorted to ground), but you also occasionally wish to key up an older, tube radio that may use negative keying (-70V to ground), or just higher voltages, you can try a HSR412 coupler.

    It’s used in the same manner, but it’ll handle different polarities and voltages up to 400V (HSR312 – 250V, HSR412 – 400V). They’re a bit more expensive, but it saves the extra part-count of a relay.

    Mike Y
    Dallas, Texas

    1. Matt Mets says:

      Cool, thanks for the tip! I’ve run into a slightly similar situation when designing wireless flash triggers for cameras, where older ones had voltages on the trigger lines that could be 100’s of volts… my solution was to stick with new ones ;-)

Comments are closed.

Discuss this article with the rest of the community on our Discord server!