Skip to content

Application of MOSFET as a Switch: Using a MOSFET to Drive a PWM Motor

on

The MOSFET (metal-oxide-semiconductor field-effect transistor) is the most widely used transistor in the world. It is a pivotal component in electronics and computer systems, and its invention paved the way for the digital age we live in today. A single computer contains billions of MOSFETs, and as a consequence, it is the most manufactured item in history. In this article, we’ll look at how you can use a MOSFET as an electronic switch.

  

In our article "How to Use a Relay as a Switch? Know Relay Switch Circuit - AC and Switching Circuits", we looked at how we can use a relay as a switch. Relays are great for many basic switching applications, and particularly for controlling high-power circuits with low-power control circuits. However, relays have relatively low switching speeds. Most relays take around 50 milliseconds to switch from on to off, or vice versa. That may sound fast, but in electronics, that’s a snail’s pace. The switching speed of a transistor is in the range of picoseconds (1 second = 1 trillion picoseconds)!

MOSFET Pin Daigram

                                             MOSTFET Pin Diagram

A MOSFET has three terminals: the gate, drain, and source. In an N-channel MOSFET like the 2N7000, current flows from the drain to the source when the device is on. The device is only on when the voltage between the gate and the source is greater than some threshold amount, which can be found on the device’s datasheet. For the 2N7000, this value is typically 2.1 V. Therefore, by controlling the voltage on the gate, we can either allow current to flow or block it. We’ve made a switch!

                                               MOSFET Symbol and Pinout

      N-channel MOSFET circuit representation. Note that the gate is insulated from the drain and source (i.e., no current flows from the gate).

 

As an example of why we need a device that switches quickly, let’s look at how we control motors. A motor’s speed is dependent on the voltage supplied to it. If we use a digital logic device such as an FPGA, PLC, or microcontroller, this presents a challenge.

 

In general, digital systems operate at just two voltages: a predefined ON (or “high”) and OFF (or “low”) voltage. Low voltage is almost always 0, while the high voltage varies by device. For example, the high voltage on an Arduino is 5 V, but on a Raspberry Pi, it is 3.3 V. These are the two most common choices in electronics.

 

Let’s say our high voltage is 3.3 V. This means that we are constrained to outputting either 3.3 V or 0 V. This means it is not possible for us to, for example, get 1.65 V directly. However, there is a way for us to effectively produce 1.65 V by switching back and forth between 3.3 V and 0 V very quickly. Imagine that our output signal looked like this:

       50dc graph of a MOSFET

                          50% duty cycle. Average voltage = 1.65 V.

We spend some time outputting 3.3 V, followed by 0 V for an equal amount of time, and repeat. If we do this switching fast enough (i.e., at a high enough frequency), the average voltage will be right in the middle at 1.65 V. If we increase the time spent at high voltage and decrease the time spent at low voltage, our average voltage will be higher, and vice versa if we spend more time at low. The percentage of time spent at high voltage relative to the whole cycle is called the duty cycle. The duty cycle in the image above is 50%. This technique of changing the duty cycle to vary the average voltage is called pulse-width modulation (PWM), and it is an important concept in digital electronics. There’s a wealth of information available online about PWM if you want to learn more.

   75% duty cycle. Average voltage = 2.475 V.
                            75% duty cycle. Average voltage = 2.475 V.

 25% duty cycle. Average voltage = 0.825 V.

                            25% duty cycle. Average voltage = 0.825 V.

One more important thing is that this switching needs to happen quickly, in the range of kilohertz, meaning thousands of times per second. A relay takes 50 milliseconds just to switch in one direction, meaning it takes 100 milliseconds to complete a full cycle of switching. This means it could switch at a maximum of 10 times per second, or 10 Hz. Way too slow!

Now, back to our motor. Let’s say I want to vary the voltage by changing the duty cycle of a PWM signal. I could use the PWM feature on my Zoolark oscilloscope/function generator, and this would allow me to vary the voltage. However, the maximum voltage I can provide with the Zoolark’s PWM output is 3.3 V, which is not a lot and the motor would not spin very fast. This is where the MOSFET comes in.

Instead of powering the motor with the Zoolark directly, we can use our power supply to give the motor 12 V with the MOSFET in series to act as a switch. Then, we can send a PWM signal to the gate of the MOSFET, switching it on only when the signal is high and switching it off when it goes back to low. This means we can change the duty cycle to change the speed of the motor!

                  PWM output

In this circuit, the variable voltage source on the left side is the PWM signal produced by the function generator. The 100 kΩ resistor is a pull-down resistor to ensure that the voltage on the gate is low when the PWM signal is low. The 12 V source comes from the power supply. Let’s build it on a breadboard and see how it looks.

        PWM motor circuit on a breadboard

Now, let’s turn on our power supply and function generator. We’ll set the power supply to 12 V and the PWM output on the function generator to 50 kHz frequency and 50% duty cycle. Then, we’ll see what happens when we change it to a 90% duty cycle.

50 % duty cycle MOSFET PWM Motor 90 % duty cycle MOSFET PWM Motor

The motor spins at a moderate speed at 50% and then significantly faster at 90%. We can also use a multimeter to measure the voltage across the motor to see what’s happening under the hood.

         The voltage across the motor at a 50% duty cycle is about 3.3 V on multimeter

               The voltage across the motor at a 50% duty cycle is about 3.3 V.

         The voltage across the motor at a 90% duty cycle is about 3.3 V on multimeter

                          For a 90% duty cycle, the voltage is about 8.9 V.


We can control the speed of a motor that has a fixed power supply just by changing the duty cycle on a 3.3 V signal. Pretty neat, right? However, this design is not perfect. Let’s find out why. You may have noticed that at a 90% duty cycle, the voltage is only about 9 V. If we are really getting 90% PWM on a 12 V supply, you would expect the average voltage to come out to 90% of 12, which is 10.8 V. The reason is that the MOSFET itself is also consuming some of this voltage.


Recall that a MOSFET begins conducting current when the gate-source voltage is greater than the threshold value, which is 2.1 V for the 2N7000. This is the point where just a small amount of current begins flowing. As you increase the voltage, you continue to decrease the drain-source resistance, allowing more current. Ideally, you would like your gate-source voltage to be a good bit higher than the threshold to ensure this resistance is small. In our circuit, 3.3 V is not that much higher than 2.1 V, so there is sizeable resistance.


The easiest way to fix this problem is to use a MOSFET that is designed for 3.3 V logic, which would have a lower threshold voltage. You could also use the same transistor but control it with a device that operates at a higher voltage.

    Leave your thought here

    Related Posts

    Introducing "Fundamental Analog Circuits and Semiconductors" – Your Ultimate Guide to Mastering Analog Circuits
    June 11, 2024
    Introducing "Fundamental Analog Circuits and Semiconductors" – Your Ultimate Guide to Mastering Analog Circuits

    We are thrilled to announce the launch of our new book, "Fundamental Analog Circuits and Semiconductors," on Kickstarter! Whether...

    Read More
    Characteristics of an Ideal Op-Amp or Operational amplifier
    June 10, 2024
    Characteristics of an Ideal Op-Amp or Operational Amplifier

    Characteristics of an Ideal Op-Amp or Operational amplifier: Op-amp or Operational Amplifier is an magical circuit that exhibits many applications....

    Read More

    Get In Touch

    Drawer Title

    This website uses cookies to ensure you get the best experience on our website.

    Similar Products