Home Electrical MOSFET vs Transistor vs Relay: Most People Get This Wrong

MOSFET vs Transistor vs Relay: Most People Get This Wrong

Learn the key differences between MOSFETs, transistors and relays. This beginner-friendly electronics tutorial explains how BJTs and MOSFETs work, why they are used for switching and amplification, and how to choose the right component without releasing the magic smoke.

0

Learn the key differences between MOSFETs, transistors and relays. This beginner-friendly electronics tutorial explains how BJTs and MOSFETs work, why they are used for switching and amplification, and how to choose the right component without releasing the magic smoke.

Scroll to the bottom to watch the YouTube tutorial

Sponsored by Brilliant

This tiny component controls current… if you wire it correctly.

This is a transistor, and this is a MOSFET.
Engineers use them in basically every single circuit and beginners constantly confuse them.

It doesn’t help that some MOSFETs LOOK exactly like transistors. And if you choose the wrong one… they release magic smoke.

So how do you tell them apart? And, are MOSFETS and transistors just relays?

    At first glance… yeah, kind of, because they all switch things on and off. But these two can do so much more, let me explain.

    A relay is mechanical. It physically moves metal contacts, thats why it makes those satisfying old fashioned clicks.

    Inside, we have a coil of wire.

    When current flows through the coil, it creates a magnetic field which pulls a spring-loaded arm across and closes another circuit.

    If we turn the current OFF, the magnetic field collapses, the spring pulls the arm back and the circuit opens again. Simple.

    Relays are brilliant because a tiny current can control a much larger current. For example, a DC powered temperature sensor can switch ON a dangerous AC mains-powered fan. 

    That’s extremely useful. Unless you need speed.

    A relay might switch a few times per second, but a computer processor switches billions of times per second.

    A relay trying to do that would sound like a machine gun before destroying itself. So engineers needed something faster, much faster.

    The solution: the Bipolar Junction Transistor, or BJT for short, although most people refer to this as just a transistor.

    This is also a BJT transistor, it’s just easier to open, because inside is just a tiny piece of semiconductor material. No springs or moving parts. Just cheap alien technology. But, where’s the smoke, … ah there it is.

    The semiconductor allows transistors to switch insanely fast and it doesn’t wear out. Unless you make a mistake, which it celebrates with a little firework display.

    Transistors usually have three pins. The Emitter, Base and Collector. Simple. Except the pin order changes depending on the part. 

    Oh, And this one only has two pins, but we will ignore that one for now.

    Luckily manufacturers print long part numbers in tiny fonts on the front,  which doesn’t expand, so you have to zoom in manually then scrunch your face and tilt it a few times to see it, and then try and find the datasheet to find the order of pins.

    Or, you can use a component tester which automatically identifies the device and pins.

    So how do we use a transistor?

    A transistor is basically used to block the current in a circuit, until you supply current into the base pin. These currents combine so there’s no isolation between circuits. But you can turn a load on and off.

    You can even use it to control a relay.

    Or you can build simple self controlling circuits like this LED flasher .

    Now an easy way to understand transistors is imagining water flowing through a pipe. We can block the flow with a disc. We can then connect a smaller pipe to the main one and place a swing gate into this. We can connect these with a pulley. The further the swing gate opens, the more the disc opens and more water can flow in the main pipe.

    But the swing gate is heavy, so a small amount of water won’t be enough to open it. A certain amount is required to force the gate to open. The more water we have flowing in this small pipe, the further the gate opens and allows more current to flow in the main pipe.

    But here is where transistors stop behaving like switches or relays.

    Because instead of being fully ON or fully OFF the transistor can partially open. 

    Notice a small current is able to control a very large current. We call this current gain.

    Different transistors have different amounts of gain, which is listed in the datasheet and those component testers will also estimate this for you.

    It also measures the voltage needed to begin turning the transistor ON.

    But here’s where it gets interesting, because the transistor has gain, we can use it to amplify signals.

    Take a microphone for example, it produces tiny electrical signals, far too weak to drive a speaker directly. So we connect the microphone signal to the base pin, as the microphone voltage changes slightly, it causes large changes in the collector current. Allowing us to amplify the signal and drive the speaker.

    We also find transistors inside Class B amplifiers.

    Here two transistors work together. One handles the positive half of the waveform.

    The other handles the negative half. Allowing the amplifier to drive speakers much more efficiently.

    Notice we use two different transistor types here. NPN and PNP.

    And now we need to talk about what’s actually happening inside these things.

    Inside the transistor, each pin connects to layers of semiconductor material.

    Some are N-type. Some are P-type.

    N-type means the silicon was mixed with something like phosphorus to create extra electrons. Electrons are negatively charged. So we call it N-type

    P-type means the silicon was mixed with something like boron. That creates missing electron locations called holes.These behave like positive charges. So we call it P-type.

    When these materials are joined together, they form a PN junction. And this creates a barrier. If we apply voltage in one direction, the barrier shrinks and current can flow.

    We call this forward bias.

    But reverse the voltage and the barrier expands. Now the current is blocked.

    Inside an NPN transistor we have two of these junctions. 

    So normally current cannot flow through the device.

    But if we apply voltage between the base and emitter one barrier collapses. Now electrons can start to move through the transistor.

    Then if we apply another voltage across the collector and emitter the second barrier collapses too and current flows through the main circuit.

    That’s it.

    Everyone recognises this as a transistor, except this is actually a voltage regulator,

    This one is an infrared emitter,

    This is a JFET,

    A reference voltage,

    An SCR,

    A temperature sensor

    and a triac.

    Completely different components all the same shape to save the manufacturers time and money.

    However, transistors come in so many different packages, some are smaller than a grain of rice. If you drop one you will never see it again.

    But, BJT’s have a major weakness. To keep the transistor ON, we need a continuous flow of current into the base pin, 

    if the load becomes large, so does the base current, which wastes a lot of energy and creates a lot of heat, and electronics don’t like heat.

    Luckily, along came the MOSFET, which changed everything.

    MOSFETS also have 3 pins.

    But did they keep the same pin names to make life easy? Ha! No, they called them Gate, drain and source.

    Like a transistor, the MOSFET blocks current in a circuit.

    Until we apply voltage to the gate pin.

    Then, current can flow from drain to source.

    We can use MOSFETs to switch relays.

    We can make simple motor controllers

    Or rapidly switch them on and off thousand of times per second with pulses, which is used to efficiently dim lights, control motors and control switch mode power supplies.

    Because they switch so fast with very little power loss, all modern electronics depend on them.

    But, there’s two problems with MOSFETS.

    Firstly, they sometimes refuse to turn off. That’s because the gate pin acts like a capacitor, it stores electrical charge. We can even measure this with the component tester.

    When the mosfet switches from OFF to ON, a burst of electrons suddenly rush into the gate for a split second.

    And if we connect it to a microcontroller, that inrush current can damage the board.

    So we add a resistor to limit the current. Problem solved.

    Except now the MOSFET gets stuck ON.

    We can see that with this simple circuit. The lamp is OFF. But if we connect the gate wire to the 9V supply, the MOSFET turns ON. Current now flows through the lamp. Simple.

    But when we disconnect the gate wire, the lamp stays on. That’s a problem. The mosfet is storing charge on the gate pin.

    But, if we connect the gate to ground, the pin can discharge, so the lamp turns off. So how do we overcome that? We can’t use a wire directly, because that will just cause a short circuit.

    So we instead use a high-value resistor. Now the gate receives voltage normally, but when the controller switches OFF. The stored charge drains away. Problem solved.

    An easy way to understand them is with water flowing through a pipe. We can block the flow with a disc. There is a hole in one side of the disc so if we slide it across, we can let water flow. The disc is spring loaded, so it is normally closed. Another pipe connects to this disc, and the pipe is filled with water. If a small pressure is applied to this pipe, it won’t be enough to move the heavy disc. But, at a certain pressure the disc will begin the move, and allow the water to flow. As the pressure increases, the disc moves fully across so the water flow is at maximum. But the gate is stuck because the pressure is stored in the control pipe.

    However, if we release the pressure, the disc will move back and stop the flow of water.

    That’s basically how the MOSFET gate behaves.

    Inside a MOSFET we just have a tiny piece of semiconductor material.

    This is made from a P-type semiconductor, with two N-type materials. Notice we have joined two materials here so we have a PN junction. The drain connects to one side and the source connects to the other. The body typically also connects to the source pin.

    We then have a layer of silicon dioxide insulation over the semiconductors. A metal contact pad is placed on top of this, which forms the gate terminal.

    When a voltage is applied to the gate pin, it forms an electric field through the insulation, just like a capacitor.

    This creates the metal, oxide, semiconductor, field effect, transistor. Which is far too long so we just call it a MOSFET.

    If we apply a voltage from the drain to source, no current will flow. The barrier is blocking the path.

    But when a positive voltage is applied to the gate pin, an electric field is generated through the insulator and into the P-type layer. Like a capacitor.

    Electrons within the P-type layer will be attracted towards this, but they can’t pass through. 

    As the gate voltage increases this attraction becomes stronger, pulling more electrons in. Some of the holes will be filled while others are repelled away. 

    These electrons collect and start to form a channel of negative charge. Which is why its called an N-channel mosfet. 

    This channel will allow current to flow from drain to source. 

    The point at which just enough voltage is applied to the gate to allow current to flow is called the threshold voltage. 

    That is also measured on the component tester.

    But to make life difficult, MOSFETS also share the same packages with components like voltage regulators, SCR’s, IGBT’s, TRIACS and special diodes.

    But we can also get MOSFETS in other packages, and sizes.
    Although that does allow our electronic devices to become so small.

    So which one do we use?

    Well each one solves a different problem. 

    Relays are great for safely isolating circuits and switching high voltage AC loads.

    But they’re mechanical. So they’re slow, noisy and eventually wear out.

    BJT transistors solved the speed problem.
    They’re cheap, simple and brilliant for analog amplification and basic switching circuits.

    But they need continuous current flowing into the base pin to stay ON. That wastes energy and creates heat.

    We solved that with the MOSFETS which use voltage on the gate pin, so almost no power is needed to control them. That makes them extremely efficient. 

    They also switch incredibly fast, generate less heat and they can control huge amounts of current so they dominate modern electronic circuits.

    The problem is, designing circuits like this, requires a lot of maths, which can be difficult to remember.

    So I used Brilliant to practice, because of the clear visuals. But down here is their new personal tutor which I asked for help, and it interacted with me, guiding me with questions and breaking it down step by step, until I could solve the problem myself.

    Brilliant have just launched an entirely new learning experience, a visual, interactive tutor that sits right on the screen with you.

    It feels like having a super intelligent personal tutor for math and coding that actually sees what you’re doing, it draws diagrams, asks guiding questions, and adapts to how you think in real time.
    It doesn’t just give you the answer; you learn by solving problems, not memorising.

    Brilliant has thousands of lessons covering science, computers, Ai and math, I like that the hands on lessons are fully interactive through problem solving, which makes learning fun, and there’s a full curriculum designed by experts for you to explore and become a brilliant engineer.

    I think you’ll like this too, and you can get started with brilliants tutor for free. You can upgrade to premium to unlock all course and right now our viewers can save 20% off an annual subscription at Brilliant.org/TheEngineeringMindset Check them out!


    LEAVE A REPLY

    Please enter your comment!
    Please enter your name here