• Skip to main content
  • Skip to primary sidebar

Homemade Circuit Projects

Need circuit help? Post them in the comments! I've answered over 50,000!

Blog | Categories | About | Contact | Calculators-online
You are here: Home / Electronics Theory / How to Connect a Relay through an Opto-Coupler

DIY Circuits | Learn Basics | Arduino Coding




How to Connect a Relay through an Opto-Coupler

Last Updated on June 14, 2022 by Swagatam 56 Comments

In the following post I have explained how to drive a relay by using an isolated method, or through an optocoupler device. We will learn three methods, first method is by connecting relay directly with the optocoupler output pins, second method is by using external PNP transistors, and third method is by using external NPN transistors. Any standard optocoupler such PC817, TIL111, or MCT2E can be used in the discussed circuit diagrams.

The question was asked by one of the interested members of this blog, Miss Vineetha.

Before studying the proposed design, let's first understand how an opto coupler works.

How an Opto-Coupler Works

An opto-coupler is a device  which encapsules an LED and a photo-transistor inside a hermetically sealed, water proof, light proof package in the form of an 8 pin IC (resembling a 555 IC).

The LED is terminated over a couple of pin outs, while the three terminals of the photo-transistor is terminated over the other three assigned pin outs.

The idea of operating a relay with an optocoupler is simple, it's all about providing an input DC from the source which needs to be isolated to the LED pin outs via a limiting resistor (as we normally do with usual LEDs) and to switch the photo transistor in response to the applied input triggers.

The above action illuminates the internal LED whose light is detected by the photo-transistor causing it to conduct across its relevant pin outs.

The photo-transistor output is normally used for driving the preceding isolated stage, for example a relay driver stage.

Connecting Relay Directly with an Optocoupler

In the following circuit diagram we can see how a relay can be connected directly connected with the collector of the optocoupler's internal transistor.

Remember, although the above connection diagram looks simple and easy, you must ensure that the relay coil resistance is not below 300 ohms, otherwise the optocoupler may heat up and get destroyed.

So if you want to use the above configuration and connect the relay directly with the optocoupler, then you have to first measure the coil resistance of the relay and make sure it is higher than 300 ohm.

This is because, most optocouplers cannot handle more than 50 mA current as the load current, therefore the relay coil must have a relatively high resistance so that it does not pass more than 30 or 40 mA current.

The following concepts show how a relay driver can be configured with an optocoupler using transistors. As shown in the following circuit diagrams, the relay driver may consist a NPN transistor or a PNP transistor.

An external transistor is recommended in a situation where the relay coil resistance is low, below 300 ohms and the relay requires a higher amount of current above 50 mA.

Using PNP Transistor

As can be seen diagram below, a PNP relay driver is connected with the optocoupler. When it's a PNP transistor such as a BC557, the base terminal of the transistor is coupled with the collector terminal of the optocoupler's internal transistor, the emitter is connected with the positive line and the collector pin is configured with the relay.

The freewheeling diode associated with the relay safeguards the transistor from back EMF voltage spikes generated by the relay coil.

The resistor values are not critical, any resistor value between 4k7 and 22K can be used for the two resistors.

Using NPN Transistor

The next diagram below shows how to integrate an NPN relay driver stage with an optocoupler. If an NPN transistor such as a BC547 is used in the relay driver, the switching voltage is received from the emitter of the optocoupler's internal transistor.

Thus, the base of the BC547 NPN transistor can be seen connected with the emitter of the optocoupler transistor, emitter of the BC547 is connected with the ground line, and collector of the BC547 is configured with the relay. The diode has the same function as explained in the previous paragraph.

The resistor value is not critical, any value between 1K and 10K can be used.

You'll also like:

  • 1Understanding Capacitor Codes and Markings
  • inverting transistorCalculating Transistor as a Switch
  • hysteresis in reed switchReed Switch – Working, Application Circuits
  • Astable Multivibrator Circuit Diagram Using IC 4093 NAND Gate2C ImageAstable Multivibrator Circuit Using NAND Gates

Filed Under: Electronics Theory Tagged With: Connect, Coupler, Opto, Relay, through

About Swagatam

I am an electronics engineer and doing practical hands-on work from more than 15 years now. Building real circuits, testing them and also making PCB layouts by myself. I really love doing all these things like inventing something new, designing electronics and also helping other people like hobby guys who want to make their own cool circuits at home.

And that is the main reason why I started this website homemade-circuits.com, to share different types of circuit ideas..

If you are having any kind of doubt or question related to circuits then just write down your question in the comment box below, I am like always checking, so I guarantee I will reply you for sure!

Previous Post: « High Voltage Transistor MJE13005 – Datasheet, Application Notes
Next Post: 5 Simple Alarm Circuits for Protecting your Home/Office from Theft »

Reader Interactions

Comments

VM says:
October 28, 2015 at 6:57 pm

Hi Bro!

I made this circuit (BC557) to drive an automotive relay. As this is to be used in an automotive application, the signal trigger voltage and also the relay driving voltage comes from the same battery source. Only the signal trigger is controlled so that it is turned on as required.

I am attaching a link to the changes that I made in this circuit diagram. I have made the ground common for both the trigger signal voltage and the driving battery voltage.

https://drive.google.com/file/d/0B7h83BRbOTR0N2NfUE1MWmtkb1k/view?usp=sharing

When I connected this circuit, the BC557 is conducting the full voltage without even the trigger signal volt wire connected. The relay I used was 50 ohm 30 Amps automotive relay. When this relay was connected it turned on without triggering the optocoupler.
When I connected a double coil relay with effective 100 ohms resistance, the relay did not turn on without the trigger, but when i connected the trigger signal wire then it turned on, but it does not turn back off even after removing the signal trigger wire.

Also the BC557 gets pretty hot within a few seconds. I tested all the components and they are all OK,

What am I doing wrong?

Also what changes should I make so that this circuit can be used with automotive relays and also noting that the driving source is same as the signal source?

Thanks for your help.

Regards,

Reply
Swagatam says:
October 29, 2015 at 7:34 am

Hi Bro, your circuit is absolutely correct, and there's no way the BC557 can conduct without a trigger unless:

1) your BC557 is faulty or connected the wrong way.

2) the opto is faulty or the input is leaking voltage to the opto LED.

confirm the second point by disconnecting the opto LED cathode from the ground line. If this corrects the issue then the problem could be due to a leakage voltage to the LED…check the trigger input to stop this leakage.

If the above does not solve the issue, then you may try disconnecting the opto transistor emitter and check the response…if this stops the relay driver conduction would indicate a faulty opto or an incorrectly connected opto.

By the way BC557 is not suitable fro driving a 50 ohm relay, you must use a 8550, or a 2n2907 or any similar 1 amp (C/E) PNP transistor for this.

Reply
White Dragon says:
April 26, 2015 at 6:44 pm

sir. how can i drive a 12v relay with pc817 opto coupler with 2n2222 to isolate 220AC voltage from PIC MCU?
can you please help me?

Reply
Swagatam says:
April 27, 2015 at 11:39 am

…I think I got it….you can try the second circuit from the above article, the BC547 can be replaced with 2n2222

Reply
Swagatam says:
April 27, 2015 at 11:36 am

White dragon, can you please explain the link between 220V and the MCU, meaning how the 220V is related to the MCU circuit?

Reply
Swagatam says:
November 17, 2013 at 8:39 am

you can use triac or an ssr in place of a relay

Reply
Back to Newest

Need Help? Please Leave a Comment! We value your input—Kindly keep it relevant to the above topic! Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

circuit simulator image



Subscribe to get New Circuits in your Email



Categories

  • Arduino Projects (93)
  • Audio and Amplifier Projects (133)
  • Automation Projects (17)
  • Automobile Electronics (101)
  • Battery Charger Circuits (85)
  • Datasheets and Components (109)
  • Electronics Theory (149)
  • Energy from Magnets (27)
  • Games and Sports Projects (11)
  • Grid and 3-Phase (20)
  • Health related Projects (27)
  • Home Electrical Circuits (13)
  • Indicator Circuits (16)
  • Inverter Circuits (95)
  • Lamps and Lights (159)
  • Meters and Testers (71)
  • Mini Projects (28)
  • Motor Controller (68)
  • Oscillator Circuits (28)
  • Pets and Pests (15)
  • Power Supply Circuits (91)
  • Remote Control Circuits (50)
  • Renewable Energy (12)
  • Security and Alarm (64)
  • Sensors and Detectors (106)
  • SMPS and Converters (34)
  • Solar Controller Circuits (60)
  • Temperature Controllers (43)
  • Timer and Delay Relay (49)
  • Voltage Control and Protection (42)
  • Water Controller (36)
  • Wireless Circuits (30)





Other Links

  • Privacy Policy
  • Cookie Policy
  • Disclaimer
  • Copyright
  • Videos
  • Sitemap



People also Search

555 Circuits | 741 Circuits | LM324 Circuits | LM338 Circuits | 4017 Circuits | Ultrasonic Projects | SMPS Projects | Christmas Projects | MOSFETs | Radio Circuits | Laser Circuits | PIR Projects |

Social Profiles

  • Twitter
  • YouTube
  • Instagram
  • Pinterest
  • My Facebook-Page
  • Stack Exchange
  • Linkedin



Recent Comments

  • Swagatam on 9 Simple Solar Battery Charger Circuits
  • Gagana on 9 Simple Solar Battery Charger Circuits
  • Swagatam on Arduino 2-Step Programmable Timer Circuit
  • Swagatam on Simple Buck-Boost Converter Circuits Explained
  • Swagatam on IC IR2111 H-Bridge MOSFET, IGBT Driver IC: Full Datasheet, Circuit Diagram

© 2026 · Swagatam Innovations