• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Electrical Engineering News and Products

Electronics Engineering Resources, Articles, Forums, Tear Down Videos and Technical Electronics How-To's

  • Products / Components
    • Analog ICs
    • Battery Power
    • Connectors
    • Microcontrollers
    • Power Electronics
    • Sensors
    • Test and Measurement
    • Wire / Cable
  • Applications
    • 5G
    • Automotive/Transportation
    • EV Engineering
    • Industrial
    • IoT
    • Medical
    • Telecommunications
    • Wearables
    • Wireless
  • Learn
    • eBooks / Handbooks
    • EE Training Days
    • Tutorials
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • White Papers
    • Educational Assets
    • Design Guide Library
    • Digital Issues
    • Engineering Diversity & Inclusion
    • LEAP Awards
    • Podcasts
    • DesignFast
  • Videos
    • EE Videos and Interviews
    • Teardown Videos
  • EE Forums
    • EDABoard.com
    • Electro-Tech-Online.com
  • Bill’s Blogs
  • Advertise
  • Subscribe

Protecting an MCU: Build your own optocoupler

January 21, 2019 By Scott Thornton 2 Comments

Microcontrollers are widely used for controlling transistors and relays. Transistors and relays are used for actuating or (energizing) equipment with a higher voltage than an MCU can handle. For example, fans, lights, television, door locks, furnaces, and appliances can be automated using an MCU, however, most operate at higher voltages compared to the voltage tolerances as designated in an MCU’s Input/Output (I/O) specification. Microcontrollers used in Arduinos, Microchip’s PICs, and STMicroelectronics’ MCUs usually operate in the range of 3 – 5 VDC. When high voltage equipment is controlled by (and electrically connected to) an MCU, the high voltage equipment produces back EMF headed towards the MCU’s circuit and adds noise to the signals. These noisy signals can cause circuits to malfunction or cause permanent damage.

Another major challenge is protecting sensitive circuits from the risk of receiving electrical surges. High voltage equipment, powered by a high voltage source, can initiate an electrical surge. If a sensitive circuit is exposed to an electrical surge, the components can burn up immediately. In engineering slang, this means an electrical surge can “let out the magic smoke.”

To reject back EMF, noise, and electrical surges from entering an MCU circuit, optocouplers are often used. Optocouplers create a safe connection between high voltage equipment and microcontrollers with a means of complete electrical insulation. In case the high voltage circuit induces an electrical surge, the surge remains only on the output side of the optocoupler, and the circuit at input side remains safe and unaffected, as both sides are electrically isolated. Optocouplers are also called photodiodes, optoisolators, photocouplers, photo relays, and optical isolators.

Internal view of a phototransistor-based optocoupler

Phototransistor-based optocouplers contain an  Infrared Emitting Diodes (IRED) on the input side and a phototransistor on the output side. Both sides are optically connected, and there is no electrical connection between the input and output side. When a voltage signal is passed on the input side, the IRED turns on, and the light that the IRED emits then falls on the receiving phototransistor, resulting in current flow through the phototransistor’s collector and emitter. [i]

Figure 1: Internal connection diagram of a phototransistor based optocoupler consisting of an IRED at left and a phototransistor on the right. (Source: sharp-world.com)

How to make optocouplers at home

Although many optocouplers are fairly cheap and readily available online, they can be developed at home using an LED, a light dependent resistor, and an opaque tube, perhaps made with duct tape.

Figure 2: Basic components for making an optocoupler at home. (Source: Author)

The phototransistor and LED are inserted inside the tube, facing towards each other. Tightly enclose the tube so that the phototransistor cannot be affected by an external light source. It is recommended to use an internally reflective tube, however, as a non-reflective tube might absorb LED light, affecting the efficiency of the optocoupler. This simple design can be used in hobby projects, functioning quite well as a standard optocoupler. [ii]

 

[i] https://www.cel.com/pdf/appnotes/an3020.pdf

[ii] https://www.autodesk.com/products/eagle/blog/how-an-optocoupler-works/

 

You Might Also Like

Filed Under: FAQ, Featured, Microcontroller Tips, Microcontrollers Tagged With: basics, FAQ

Reader Interactions

Comments

  1. Andy from Workshopshed says

    January 28, 2019 at 11:35 am

    One trick for alignment is to use heatshrink tubing.

    Log in to Reply
    • Norman ELLIOTT says

      February 15, 2019 at 3:07 am

      If you wrap a little aluminium foil around them and then use heat shrink tubing you will get the best coupling. Of course you will need to make sure the foil doesn’t short out the leads.

      Log in to Reply

Leave a Reply Cancel reply

You must be logged in to post a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

EE Engineering Training Days

engineering

Featured Contributions

zonal architecture

Addressing zonal architecture challenges in the automotive industry

zonal architecture

Addressing zonal architecture challenges in the automotive industry

A2L refrigerants drive thermal drift concerns in HVAC systems

Why outdoor charging demands specialized battery connectors

How Li-ion batteries are powering the shift in off-highway equipment

More Featured Contributions

EE Tech Toolbox

“ee
Tech Toolbox: 5G Technology
This Tech Toolbox covers the basics of 5G technology plus a story about how engineers designed and built a prototype DSL router mostly from old cellphone parts. Download this first 5G/wired/wireless communications Tech Toolbox to learn more!

EE Learning Center

EE Learning Center
“ee
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.
“bills
contribute

R&D World Podcasts

R&D 100 Episode 10
See More >

Sponsored Content

Designing for Serviceability: The Role of Interconnects in HVAC Maintenance

From Control Boards to Comfort: How Signal Integrity Drives HVAC Innovation

Built to Withstand: Sealing and Thermal Protection in HVAC Sub-Systems

Revolutionizing Manufacturing with Smart Factories

Smarter HVAC Starts at the Sub-System Level

Empowering aerospace E/E design and innovation through Siemens Xcelerator and Capital in the Cloud

More Sponsored Content >>

RSS Current EDABoard.com discussions

  • sim7090g
  • MIC2309 I-LIM Pin Voltage/Current for Resistor Wattage Selection
  • How to transfer usb cdc data using DMA? (stm32f407)
  • How to create custom diode and add its netlist into Ansys circuit designer schematic?
  • MoM capacitor at 36 GHz

RSS Current Electro-Tech-Online.com Discussions

  • the point I don't understand about signal systems
  • I Wanna build a robot
  • More fun with ws2812 this time XC8 and CLC
  • Epson crystal oscillators
  • Impact of Tariffs on PCB Fab
Search Millions of Parts from Thousands of Suppliers.

Search Now!
design fast globle

Footer

EE World Online

EE WORLD ONLINE NETWORK

  • 5G Technology World
  • Analog IC Tips
  • Battery Power Tips
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • Electro-Tech-Online Forums
  • Engineer's Garage
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips

EE WORLD ONLINE

  • Subscribe to our newsletter
  • Teardown Videos
  • Advertise with us
  • Contact us
  • About Us

Copyright © 2025 · WTWH Media LLC and its licensors. All rights reserved.
The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media.

Privacy Policy