It is very common application to drive a relay with a MOSFET. From household applications to automotive are using this circuit. There are some aspects to consider like the stress on the MOSFET, the level of driving voltage to guarantee MOSFET saturation, the level of the actual voltage applied to the relay coil if enough to meet the requirement and the stresses on the associated components.
1. Generic Circuit
Above circuit is the most common on how to drive a relay with a MOSFET. The MOSFET is in the low side of the circuit and this is called as low side driving. In this case, it is easy to drive the MOSFET with a small voltage only.
Is it possible to put the MOSFET on the VDD side?
The answer is yes. However, this is difficult than driving on the low side. Putting the MOSFET on the VDD side is called high side driving. Considering the same N channel MOSFET, the VDRIVE must be higher than the VDD plus the gate threshold voltage to turn on the MOSFET if the reference is ground. I personally not recommend high side driving out of this circuit.
2. Circuit Component Descriptions
- VDRIVE is a voltage level from any source like microcontroller GPIO pin, another circuit or external voltage source.
- R1 is put in place to control the level of inrush current when the moment the VDRIVE is injected (high level). During start up, the MOSFET gate to source will be shorted because this time the input capacitance is charging. R1 will define the startup current to be within the capability of the driving circuit (the circuit that give the VDRIVE). R1 must not be big enough that will cause too much delay during start-up of the circuit. It must be carefully chosen as well so that the voltage across gate to source is not dropping to much that cannot anymore guarantee MOSFET turn on.
- R2 will define the voltage across gate to source. During turn on, it will give guaranteed turn on voltage. During turn-off, it will guarantee the MOSFET to turn off regardless of if the VDRIVE is an open collector or open drain. Open collector or open drain means the collector or drain of the driving circuit (VDRIVE) is floating. The presence of R2 will force the gate to be connected to the ground.
- Q1 is an N channel MOSFET that will connect the relay coil to the ground so that a current will flow to the coil.
- L1 is the relay coil representation.
- D1 is added to the circuit to clamp the voltage kickback of the relay coil during turn off. This will ensure that the MOSFET will not damage.
The detailed explanation of the kickback voltage across a relay is here.
3. Component Selection
3.1. Select R1 such that the current requirement of the VDRIVE circuit is not exceeded. For example, the VDRIVE circuit is a microcontroller pin. A microcontroller pin is usually can supply 3.3V and can source/sink current of 10mA. Supposing this is the case, then R1 must be greater than 330 ohms with a good stress margin.
R1 >> (3.3V / 0.01A) >> 330 ohms
R1 could be 470 ohms. This will give only 70% current stress,
(3.3V/470 ohms) / 0.01A = 70.2%
The 470 ohms will not introduce significant turn on delay to the MOSFET as most MOSFETs has input capacitance in nano-farad range.
R1 power dissipation is not a problem because during steady state, most of the voltage share will be on R2. In above values, a resistor with 100mW rating is good enough.
3.2. Select R2 such that the voltage drop on R1 is relatively very small. A good rule of thumb is to multiply R1 by 100. So, with R1 of 470 ohms, R2 could be 47,000 ohms.
R2 = 100 X R1 = 100 X 470 ohms = 47,000 ohms
Checking if the MOSFET can Turn-on with the Values Determined
The voltage across R2 will determine if the MOSFET can turn on and saturate or not. By doing a voltage divider, the voltage on R2 is
VR2 = (VDRIVE X R2) / (R1 + R2)
VR2 = (3.3V X 47,000 ohms) / (470 ohms + 47,000 ohms) = 3.267V
The MOSFET must be selected such that the gate threshold voltage is much lower than 3.267V. The power dissipation on R2 can be computed as
Pdiss_R2 = VR2 X VR2 / R2 = 3.267V X 3.267V /47,000 ohms = 0.227mW.
A standard resistor with 100mW power rating is good enough for R2.
R1 power dissipation can be computed as
Pdiss_R1 = (VDRIVE – VR2) X (VDRIVE – VR2) / R1 = (3.3V-3.267V) X (3.3V-3.267V) / 470 ohms = 2.3µW.
Thus, an R1 with 100mW rating is very good enough.
3.3. Select a MOSFET with a gate to source voltage much lower than the voltage across R2 as computed in section 3.2. The MOSFET drain to source voltage rating must be much higher than the level of VDD. For a 12V VDD level, a MOSFET of 30V drain to source voltage is good enough. This is assuming that there is a clamp diode across the relay coil.
In case there is no clamp diode, the MOSFET drain to source voltage rating must be very high enough to withstand the kickback voltage. This requires more mathematical computations to determine the maximum voltage spike.
The MOSFET must be selected also such that its drain current rating is not exceeded. The drain current of a MOSFET can be computed as,
Id_MOSFET = VDD / Rcoil
Assuming a VDD of 12V and a coil resistance of 100 ohms, then
Id_MOSFET = VDD / Rcoil = 12V / 100 ohms = 0.12A
For a relay, the coil resistance will be at the lowest value at the lowest temperature of operation. If this is the case, then the current rating of the device must be very much higher than the computed value to ensure ample design margin. A good rule of thumb is to multiply the typical current by 10.
In this example,
Id_MOSFET_rating = 10 X Id_MOSFET = 10 X 0.12A = 1.2A
The MOSFET power dissipation can be computed as,
Pdiss_MOSFET = Id_MOSFET X Id_MOSFET X RDSon
Assuming and RDSon of 0.1 ohm,
Pdiss_MOSFET = 0.12A X 0.12A X 0.1 ohms = 1.44mW
A MOSFET with 0.5W rating is very good enough.
3.4. Select the relay such that its coil can be driven by a voltage level equal to VDD which is 12V in above example. If the application is DC, then select a DV type. Select an AC type if the application is AC.
3.5. The power dissipation of the clamp diode D1 is,
Pdiss_D1 = Id_MOSFET X VF_diode
Supposing a VF_diode (forward voltage) of 0.7V,
Pdiss_D1 = Id_MOSFET X VF_diode = 0.12A X 0.7V = 84mW
A diode of 1W power rating is good enough.
The diode voltage must be higher than the level of VDD with high margin. For a 12V VDD, a diode with 50V rating is good enough.
Standard component values are can be easily understand through the search feature of online store like Mouser or Digikey.