relay switch circuit

Relay Switch Circuit

Relays are electromechanical devices that use an electromagnet to operate a pair of movable contacts from an open position to a closed position. The advantage of relays is that it takes a relatively small amount of power to operate the relay coil, but the relay itself can be used to control motors, heaters, lamps or AC circuits which themselves can draw a lot more electrical power.

The electro-mechanical relay is an output device (actuator) which come in a whole host of shapes, sizes and designs, and have many uses and applications in electronic circuits. But while electrical relays can be used to allow low power electronic or computer type circuits to switch relatively high currents or voltages both “ON” or “OFF”, some form of relay switch circuit is required to control it.

The design and types of relay switching circuits is huge, but many small electronic projects use transistors and MOSFETs as their main switching device as the transistor can provide fast DC switching (ON-OFF) control of the relay coil from a variety of input sources so here is a small collection of some of the more common ways of switching relays.

NPN Relay Switch Circuit

A typical relay switch circuit has the coil driven by a NPN transistor switch, TR1 as shown depending on the input voltage level. When the Base voltage of the transistor is zero (or negative), the transistor is cut-off and acts as an open switch. In this condition no Collector current flows and the relay coil is de-energised because being current devices, if no current flows into the Base, then no current will flow through the relay coil.

If a large enough positive current is now driven into the Base to saturate the NPN transistor, the current flowing from Base to Emitter (B to E) controls the larger relay coil current flowing through the transistor from the Collector to Emitter.

For most bipolar switching transistors, the amount of relay coil current flowing into the Collector would be somewhere between 50 to 800 times that of the required Base current to drive the transistor into saturation. The current gain, or beta value ( β ) of the general purpose BC109 shown is typically about 290 at 2mA (Datasheet).

NPN Relay Switch Circuit

npn relay switch circuit


Note that the relay coil is not only an electromagnet but it is also an inductor. When power is applied to the coil due to the switching action of the transistor, a maximum current will flow as a result of the DC resistance of the coil as defined by Ohms Law, (I = V/R). Some of this electrical energy is stored within the relay coil’s magnetic field.

When the transistor switches “OFF”, the current flowing through the relay coil decreases and the magnetic field collapses. However the stored energy within the magnetic field has to go some where and a reverse voltage is developed across the coil as it tries to maintain the current in the relay coil. This action produces a high voltage spike across the relays coil that can damage the switching NPN transistor if allowed to build up.

So in order to prevent damage to the semiconductor transistor, a “flywheel diode”, also known as a freewheeling diode, is connected across the relay coil. This flywheel diode clamps the reverse voltage across the coil to about 0.7V dissipating the stored energy and protecting the switching transistor. Flywheel diodes are only applicable when the supply is a polarized DC voltage. An AC coil requires a different protection method, and for this an RC snubber circuit is used.

NPN Darlington Relay Switch Circuit

The previous NPN transistor relay switch circuit is ideal for switching small loads such as LED’s and miniature relays. But sometimes it is required to switch larger relay coils or currents beyond the range of a BC109 general purpose transistor and this can be achieved using Darlington Transistors.

The sensitivity and current gain of a relay switch circuit can be greatly increased by using a Darlington pair of transistors in place of a single switching transistor. Darlington Transistor pairs can be made from two individually connected Bipolar Transistors as shown or available as one single device with standard: Base, Emitter and Collector connecting leads.

The two NPN transistors are connected as shown so that the Collector current of the first transistor, TR1 becomes the Base current of the second transistor TR2. The application of a positive base current to TR1 automatically turns “ON” the switching transistor, TR2.

NPN Darlington Relay Switch Circuit

npn darlington relay switch circuit


If two individual transistors are configured as a Darlington switching pair, then a small value resistor (100 to 1,000Ω’s) is usually placed between the Base and Emitter of the main switching transistor, TR2 to ensure that it turns fully OFF. Again a flywheel diode is used to protect TR2 from the back emf generated when the relay coil is de-energised.

Emitter Follower Relay Switch Circuit

As well as the standard Common Emitter configuration for a relay switch circuit, the relay coil can also be connected to the Emitter terminal of the transistor to form an Emitter Follower circuit. The input signal is connected directly to the Base, while the output is taken from the Emitter load as shown.

Emitter Follower Relay Switch Circuit

emitter follower relay switch circuit


The Common Collector, or Emitter Follower configuration is very useful for impedance matching applications because of the very high input impedance, in the region of hundreds of thousands of Ohms while having a relatively low output impedance to switch the relays coil. As with the previous NPN relay switch circuit, switching occurs by applying a positive current to the base of the transistor.

Emitter Darlington Relay Switch Circuit

This is the Darlington transistor version of the previous Emitter Follower circuit. A very small positive Base current applied to TR1 causes a much greater Collector current to flow through TR2 due to the multiplication of the two Beta values.

Emitter Darlington Relay Switch Circuit

emitter darlington relay switch circuit


The Common Emitter Darlington relay switch circuit is useful to provide current gain and power gain with the voltage gain approximately equal to unity. Another important characteristic of this type of Emitter Follower circuit is that it has a high input impedance and a low output impedance, which make it ideal for impedance matching to large relay coils.

PNP Relay Switch Circuit

As well as switching relay coils and other such loads with NPN Bipolar Transistors, we can also switch them using PNP Bipolar Transistors. The PNP relay switch circuit is no different to the NPN relay switching circuit in terms of its ability to control the relays coil. However, it does require different polarities of operating voltages. For example, the Collector-Emitter voltage, Vce , must be negative for the PNP type to cause current flow from the Emitter to the Collector.

PNP Relay Switch Circuit

pnp relay switch circuit


The PNP transistor circuit works in opposite to the NPN relay switching circuit. Load current flows from the Emitter to the Collector when the Base is forward biased with a voltage that is more negative than that at the Emitter. For the relays load current to flow through the Emitter to the Collector, both the Base and the Collector must be negative in respect to the Emitter.

In other words, when Vin is HIGH the PNP transistor is switched “OFF” and so too is the relay coil. When Vin is LOW, the Base voltage is less than the Emitter voltage, (more negative) and the PNP transistor turns “ON”. The Base resistor value sets the Base current, which sets the Collector current that drives the relay coil.

PNP transistor switches can be used when the switching signal is the reverse for an NPN transistor, for example the output of a CMOS NAND gate or other such logic device. A CMOS logic output has the drive strength at logic 0 to sink sufficient current to turn the PNP transistor “ON”. Then current sinks can be turned into current sources by using PNP transistors and a power supply of opposite polarity.

PNP Collector Relay Switch Circuit

The operation of this circuit is the same as the previous relay switching circuit. In this relay switch circuit, the relay load has been connected to the PNP transistors Collector. The ON-OFF switching action of the transistor and coil occurs when Vin is LOW, transistor “ON” and when Vin is HIGH, transistor “OFF”.

PNP Collector Relay Switch Circuit

pnp collector relay switch circuit


We have seen that either an NPN bipolar transistor or an PNP bipolar transistor can operate as a switch for relay switching, or any other load for that matter. But that there are two different conditions that need to be understood as the current flows in two different directions.

So in an NPN transistor, a HIGH voltage with respect to the Emitter is applied to the Base, current flows from the Collector to the Emitter and the NPN transistor switches “ON”. For a PNP transistor, a LOW voltage with respect to the Emitter is applied to the Base, current flows from the Emitter to the Collector and the PNP transistor switches “ON”.

N-channel MOSFET Relay Switch Circuit

MOSFET relay switching operation is very similar to Bipolar Junction Transistor (BJT) switch operation seen above, and any of the previous circuits can be implemented using MOSFETs. However, there are some major differences in the operation of the MOSFET circuits with the main ones being that MOSFETs are voltage operated devices, and as the Gate is electrically isolated from the Drain-Source channel, they have very high input impedances so the Gate current for a MOSFET is zero, therefore a base resistor is unnecessary.

MOSFETs conduct through a conductive channel with the channel initially being closed, transistor “OFF”. This channel gradually increasing in conductive width as the voltage applied to the Gate terminal is slowly increased. In other words, the transistor operates by enhancing the channel as the Gate voltage increases and for this reason the this type of MOSFET is called an Enhancement MOSFET, or E-MOSFET.

N-channel Enhancement MOSFETs (NMOS) are the most commonly used type of MOSFET as a positive voltage on the Gate terminal switches the MOSFET “ON” and zero or a negative voltage on the Gate switches it “OFF”, making ideal as MOSFET relay switch. Complementary P-channel Enhancement MOSFETs are also available which, like the PNP BJT work with opposite voltages.

N-channel MOSFET Relay Switch Circuit

n-channel mosfet relay switch circuit


The above MOSFET relay switch circuit is connected in a common-source configuration. With zero voltage input, LOW condition, the value of VGS, there is insufficient Gate drive to open the channel and the transistor is “OFF”. But when VGS is increased above the MOSFETs lower threshold voltage VT, the channel opens, current flows and the relay coil is operated.

Then the enhancement mode MOSFET operates as a normally open switch making it ideal for switching small loads such as relays. E-type MOSFETs have high “OFF” resistance but moderate “ON” resistance (OK for most applications), so when selecting one for a particular switching application, its RDS value needs to be taken into consideration.

P-channel MOSFET Relay Switch Circuit

The P-channel Enhancement MOSFET (PMOS) is constructed the same as for the N-channel Enhancement MOSFET except that it operates with negative Gate voltages only. In other words, A P-channel MOSFET operates in the same fashion but with opposite polarities as the Gate must be more negative than the Source to turn “ON” the transistor by being forward-biased as shown.

P-channel MOSFET Relay Switch Circuit

p-channel mosfet relay switch circuit


In this configuration, the P-channels Source terminal is connected to +Vdd and the Drain terminal is connected to ground via the relays coil. When a HIGH voltage level is applied to the Gate, the P-channel MOSFET will be turned “OFF”. The turned “OFF” E-MOSFET will have a very high channel resistance and acts nearly like an open circuit.

When a LOW voltage level is applied to the Gate, the P-channel MOSFET will be turned “ON”. This will cause current to flow through the low resistance path of e-MOSFETs channel operating the relay coil. Both N-channel and P-channel e-MOSFETs make excellent low voltage relay switching circuits and can easily be interfaced to a wide variety of digital logic gates and micro-processor applications.

Logic Controlled Relay Switch Circuit

The N-channel, enhancement-type MOSFET is extremely useful as a transistor switch because in its “OFF” state (with zero Gate bias) its channel has a very high resistance blocking current flow. However, a relatively small positive voltage greater than the threshold voltage VT, on its high impedance Gate causes it to begin conducting current from its Drain terminal to its Source terminal.

Unlike the Bipolar Junction Transistor which requires a Base current to turn it “ON”, the e-MOSFET only requires a voltage on the Gate as due to its insulated Gate construction, zero current flows into the Gate. Then this makes the e-MOSFET, either N-channel or P-channel ideal to be driven directly by typical TTL or CMOS logic gates as shown.

Logic Controlled Relay Switch Circuit

logic controlled relay switch circuit


Here the N-channel E-MOSFET is being driven by a digital logic gate. The output pins of most logic gates can only supply a limited amount of current, typically no more than about 20 mA. As e-MOSFETs are voltage operated devices and consume no Gate current, we can use a MOSFET relay switch circuit to control high power loads.

Micro-controller Relay Switch Circuit

As well as digital logic gates, we can also use the output pins and channels of micro-controllers, PIC’s and processors to control the outside world. The circuit below shows how to interface a relay using a MOSFET switch.

Micro-controller Relay Switch Circuit

micro-controller relay switch circuit

Relay Switching Circuit Summary

In this tutorial we have seen how we can use both Bipolar Junction Transistors, either NPN or PNP and Enhancement MOSFETs, either N-channel or P-channel as a transistor switching circuit.

Sometimes when building Electronic or Micro-controller circuits we want to use a transistor switch to control a high-power device, such as motors, lamps, heating elements or AC circuits. Generally these devices require larger currents or higher voltages than a single power transistor can handle then we can use a relay switching circuit to do this.

Bipolar transistors (BJT’s) make very good and cheap relay switching circuits, but BJT’s are current operated devices as they convert a small Base current into a larger load current to energise the relay coil.

However, the MOSFET switch is ideal as an electrical switch as it takes virtually no Gate current to turn “ON”, converting a Gate voltage into a load current. Therefore, a MOSFET can be operated as a voltage-controlled switch.

In many applications bipolar transistors can be substituted with enhancement-type MOSFETs offering faster switching action, much higher input impedance, and probably less power dissipation. The combination of a very high Gate impedance, very low power consumption in its “OFF” state, and very fast switching capability makes the MOSFET suitable for many digital switching applications. Also with zero Gate current its switching action can not overload the output circuit of a digital gate or micro-controller.

However, because the gate of an E-MOSFET is insulated from the rest of the component, it is especially sensitive to static electricity which could destroy the thin oxide layer on the Gate. Then special care should be taken either when handling the component, or when it is in use and that any circuit using e-MOSFETs includes appropriate protection from static and voltage spikes.

Also for additional protection of either BJT’s or MOSFETs, always use a flywheel diode across and relay coil to safely dissipate the back emf generated by the transistors switching action.


Join the conversation!

Error! Please fill all fields.

What's the Answer *

  • H
    Hasan Yahya

    It seem that this article is still difficult to be understood, especially for a beginner, if ” Relay” showed as a rectangular box. How it work, consist of what component, and material is, can constitute the questions. Thank in advance to author.

  • C
    Craig Bowman

    I wonder if the world would be different?
    I am asked to draw the pcb lines drawing for a computer controlled Relay, we had the circuit diagram for.
    This is just after, I think, I had to run a new ethernet cable along basement corridors for a University. This was year ten work experience. This was 1986. Unfortunately, I had not done the relay assignment. I would have to perform better.
    My question is now, may this task have been an important cofactor to the ethernet cable lay out or not? Is computer communication technology so acute and balanced that I may research a physical relay switch a missing part and without it something may have gone viral in my personal biophysical chemistry after years of consumption of the powerful networked computers by the University users. Or is this too esoteric? Or and again is this my stand alone intelligence and youthfulness that recalls a missed piece of work and stretch of brain power and the thanks from what may have been an achievement?
    Yours Kindly, Craig.

  • A


  • m
    mighty igor

    I want to know which kind of relay Im going to use in designing automatic phase change over switch

  • N

    I want to design a relay switching system to be operated remotely through hard wire from 30 different locations ( flats of a residential multi- storied building) to operate a centralized entry door fitted with 6V DC magnetic lock. need advice.

    • M

      You can make it digitally by using microcontroller

    • Wayne Storr

      There are multiple ways of doing this.
      1. Use 30 push buttons to activate 30 different relays (either centralised or per location) whose relay contacts are all wired in parallel to activate the door lock. More wires and relays but each switching circuit is isolated from the next.
      2. Use 30 push buttons all wired in parallel and one relay to operate the door lock. Less wires but may need a series diode with each push button to prevent feed back.
      3. Multiplex the 30 push buttons into groups and one relay. Requires more electronics.
      4. Use push buttons as inputs to a PLC, Arduino, Raspberry Pi, etc. Requires software.

      240VAC or 24VDC. Need to think about voltage drops on long cable runs for DC system.

  • S
    Shreeram Choudhury

    What is inside the relay box

  • s

    Nice, thank you!

  • G


  • u

    Can we have design based on number of pulses. if 2 pules Relay 1 will activate, if 5 pules then relay 2 will be activated.if again 2 pules are triggered Relay 1 will deactivate.if 5 pules are given relay 2 will be deactivated.

  • L

    Thanks for sharing this information with us.This post has shared good concept of Relay.We can totally understand working of Relay,functionality of Relay ,importance of Relay,types of Relay.Relays are very important in sensing any kind of fault in power system.Larsen & Toubro also has some registered product.You may visit at Larsen & Toubro

Looking for the latest from TI?