Microcontroller Interfacing –  Part 9

FET Transistor Switching

  

Goals

Previous sections showed how to use bipolar transistors to switch loads with higher currents and/or voltages than can be handled by the microcontroller output pin directly. This section shows how to use a different type of transistor, the Field Effect Transistor (FET) which can have advantages in some circuits.

FET Basics

Part 7 described the operation of bipolar junction transistors (BJT). These transistors are known as current controlled devices.  Essentially the collector current of a BJT is the base current multiplied by the gain of the transistor.  The FET is a voltage controlled device.  Like the BJT, the FET has three pins. These are the gate, drain and source.  The gate is where the controlling voltage is applied.

There are a number of FET types. First there are N channel and P channel.  Then there are enhancement mode and depletion mode variations.   Then there are other variations. The most common type of FET in switching circuits is the MOSFET (Metal Oxide Semiconductor Field Effect Transistor).  We will limit the discussion to N channel, enhancement mode MOSFET. These are the most commonly used FET in microcontroller based circuits. Unless otherwise noted, whenever the term FET is used, it will refer to an N channel, enhancement mode MOSFET.

The best way to look at an FET is as a voltage controlled variable resistor. The resistor is between the source and drain pins.  The value of the resistor will depend on the voltage between the gate and source (Vgs).  If the voltage is zero volts, the resistance will be very high (several million ohms), and essentially be an open circuit.  If Vgs is above a certain level, the resistance will be very low (a few ohms or less).  The data sheet will refer to this value as Rds (Resistance drain-source).  If Vgs, sometimes referred to as just the gate voltage, is in between these limits the resistance will be somewhere between low and high. This is referred to the linear range. Normally we will not want the FET to be in the linear range in switching applications.

To the microcontroller output pin, the BJT base pin looks like a diode. The pin must drive current through this diode.  The gate, the FET control pin, looks like a small capacitor between the gate and source pins.  The only current that flows is the amount needed to charge or discharge this capacitance.  Once the capacitor is charged, no further current will flow until the state of the micro’s output pin changes.

Example: Driving a relay

In section 7 we used an example of a bipolar transistor to switch a relay.  We will revisit that problem but this time use a FET as the switch.  Figure 9-1 shows the schematic. The problem is to control a 12V from the microcontroller output pin.  The resistance of the relay coil is 360 ohms.   Our 5V micro cannot directly switch 12V without risk of damage.  Ohm’s law also tells us:

I = V/R = 12/360 =  .033A or 33ma

Since the micro has a maximum sink and source limits of 25ma, we fall short on the current side as well. We will use a FET to do the heavy lifting.  Let’s try a 2N7000 for this application. A quick look at the specs shows some key parameters.

2N7000

Vds          60V max

Id             200 ma max (continuous)

Pd           400 mW

Rds(on)   5.3 ohm (max)

Figure 9-1

The maximum voltage across the device Vds is 60V, so our 12V supply will not be an issue. We calculated 33ma of current so we are way under the 200ma limit.  The power limit is 400 mW. Assuming a worst case of 5.3 ohm Rds we get the following

Pd = I^2 * R = .033 * .033 * 5.3 = 5.7 mW

The 2N7000 will be fine in this application. Note the use of diode D1. It is used to steer the current produced by the collapsing magnetic field caused when the FET is turned off. Without the diode voltages high enough to cause damage could be generate across the FET. Diodes are needed whenever an inductive load is used.

So, why would we want to use a FET instead of a BJT? A 2N7000 FET costs more than say a PN2222 BJT. In this particular application, there is probably not a big reason to use FETs. There are some situations where a FET has one or more major advantages.

Consider a design for  a portable battery operated device. Battery life is a huge concern in our application so we want to reduce current consumption in every part of the circuit we can. Now, instead of switching a power hungry relay, we need to turn on a component that requires 9V (from our battery) but only a few ma of current.

In this situation, we would probably drive the base of a bipolar transistor with a ma or more of current. This current will be an additional drain on the battery.  With a FET, if the switching frequency is low, the current into the gate of the FET will be negligible. Using a FET in this situation would save power.

High Power Switching

The main situation where FETs are superior is in high current circuits. Suppose we want to switch a motor, electrical heater or other high current load.  FETs are produced with very low Rds, the resistance between the drain and source. The lower the Rds, the more efficient the circuit will be.

Suppose we are making a heater for some application. The heating element runs off of 24V and draws 8 amps when it is on.  Let first look at using a bipolar transistor. A 2N3055 is a common high current transistor.

2N3055

Vce 60V (max)

Ic 15A (max)

Vce(sat) 3V  (Ic = 10A, Ib = 3A)

  

Our requirements for Vce (24V) and Ic (8A) are well below the limits for the 2N3055. So far, so good. Now look at Vce(sat). It is 3V.  What happens when we run 8A through this?

Pd = Vce(sat) * Ic = 3V * 8A = 24W

Those 24 watts are a lot of wasted power. Not only that, but that power is converted to heat. We will need to use a large heat sink to safely remove that heat.  Also look at the transistor base current as the conditions for the Vce(sat). It is 3A!  Our poor micro can only source 25ma. We would need a circuit to boost the 25ma to 3A. That will add cost and complexity to the design.

Let’s take a look at using an IRF530 FET.  The maximum voltage, Vdss , and maximum current , Id, are well under the operating conditions of our circuit.  We selected a logic level type FET so we can directly drive it with our microprocessor. The switching voltage is 2V, well below the 5V the micro output line will supply. We will be driving the FET fairly hard, which is good, but still below the 16V maximum.

What about the power that is dissipated across the FET?

Pd = Id^2 * Rds  = 8A * 8 A * .15 ohm = 9.6W

The power dissipated across the FET is still fairly high, 9.6W, but is well under the 79W device limit, and much less than the 24W for the 2N3055 bipolar transistor. The FET will still need heat sinking, but it will not be nearly as difficult as with the 2N3055.

With a little bit of effort we could probably find a FET with a lower Rds, further reducing the power dropped across the FET.

IRF530

Vdss 100V

Id 17A

Pd 79W

Rds(on) .15 ohm (Vgs = 4V, Id=8A)

Vgs(th) 2V

Vgs 16V max

  

PWM

FET transistors are often used to control DC motors. What if we wanted to control the speed of the motor? We can control the speed of a DC motor by changing the voltage across it. One way to do that with a microcontroller is to use Pulse Width Modulation (PWM).   Suppose we have a 12V motor. If we just apply the supply voltage to the motor. It sees 12 volts, and runs at full speed. 

Now suppose we turned the 12V on and off very fast. The time on and time off are the same. It is on 50% of the time and off 50% of the time. The signal is said to have a 50% duty cycle. The average voltage the motor would see is 50% of 12V or 6V. The motor runs slower at 6V. 

Suppose we change the duty cycle to 75%. The voltage is now on 75% of the time and off 25% of the time. The motor now sees an average of 75% of 12V, or 9V. It runs faster than at 6V, but slower than 12V. We can create any voltage we want between 0 and 12V by changing the duty cycle.

Many microcontrollers have built in PWM peripherals.  Once you set them up they will run at the prescribed frequency and duty cycle without any further attention. If your micro does not have a PWM you can do the same thing with either hardware or software timers controlling the output.

PWM circuits usually run at a few 10’s of KHz.  This can bring up a situation that if not accounted for can result in the destruction of the FET.  Remember earlier we said that the gate looks like a capacitor to the micro’s output line.  This capacitor has to be charged or discharged each time the drive signal toggles. While the capacitor is charging or discharging, the FET will not be either On or Off. It will be in its linear range and the Rds will be between  Rds(on) and Rds(off).   Current flowing through the FET will cause high power dissipation.

In our examples above we didn’t turn the load on and off very fast, so the FET has time to dissipate the extra heat between transitions and can be generally ignored.   If the FET is changing states 20,000 times a second (10 KHz PWM rate), it will be spending a larger percentage of its time in this linear range.   It is possible that the power dissipated by the FET in these conditions will exceed the maximums, and destroy the FET.

The amount of gate capacitance is really the gate charge and will be shown in the data sheet.  Higher power FETs have larger dies, and thus will have a larger gate charge.  In such situations it is necessary to drive the gate will enough voltage and current to charge (discharge) the gate fast enough that the time spent in the FET’s linear region is very short.  This is frequently done with special FET driver circuits or ICs.  Calculations and circuit board layout techniques for high speed PWM are beyond the scope of this tutorial. FET manufacturers have application notes that go into this subject in greater detail.

  

Summary

FETs are an alternative to bipolar transistors for switching loads beyond the range of the microcontroller to directly control.  FETs are generally superior in applications where high currents are required and in some low power situations.  FET circuits require some special considerations, especially at higher switching speeds.

Gotcha List

1. Ensure the FET can handle the voltage and current required by the load.

2. Consider logic level switching FETs to simplify interfacing to microcontrollers.

3. Protect the transistor with a snubbing diode if the load is a relay, solenoid, motor or otherwise inductive.

4. High power PWM applications must consider drive requirements to overcome gate charge.

  

© 2009 - 2022 Gary C. Sutcliffe

  

Created with the QTH.com SiteBuilder.