diff options
Diffstat (limited to '_site/blog/mosfet-switches/index.html')
| -rw-r--r-- | _site/blog/mosfet-switches/index.html | 173 |
1 files changed, 173 insertions, 0 deletions
diff --git a/_site/blog/mosfet-switches/index.html b/_site/blog/mosfet-switches/index.html new file mode 100644 index 0000000..ed63e0a --- /dev/null +++ b/_site/blog/mosfet-switches/index.html @@ -0,0 +1,173 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>MOSFETs as electronic switches</title> + + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <title>MOSFETs as electronic switches</title> + <link rel="stylesheet" href="/assets/css/main.css"> + <link rel="stylesheet" href="/assets/css/skeleton.css"> +</head> + + + + </head> + <body> + + <div id="nav-container" class="container"> + <ul id="navlist" class="left"> + + <li > + <a href="/" class="link-decor-none">hme</a> + </li> + <li class="active"> + <a href="/blog/" class="link-decor-none">blg</a> + </li> + <li > + <a href="/projects/" class="link-decor-none">poc</a> + </li> + <li > + <a href="/about/" class="link-decor-none">abt</a> + </li> + <li><a href="/feed.xml" class="link-decor-none">rss</a></li> + </ul> +</div> + + + + <main> + <div class="container"> + <div class="container-2"> + <h2 class="center" id="title">MOSFETS AS ELECTRONIC SWITCHES</h2> + <h6 class="center">22 JUNE 2025</h5> + <br> + <div class="twocol justify"><p>Recently, I needed a low-power circuit for one of my battery-operated projects. +Much of the system’s power savings depended on its ability to electronically +switch off components, such as servos, that draw high levels of quiescent +currents. My search for a solution led me to MOSFETs, transistors capable of +controlling circuits operating at voltages far above their own.</p> + +<h2 id="acknowledgments">Acknowledgments</h2> + +<p>This article is a summary of what I learnt about using MOSFETs as switches. +I’m not an electronics engineer, and this is not an authoritative guide. The +circuits in this post must be considered within the narrow context in which +I’ve used them. All credits for the schematics belong to <a href="https://electronics.stackexchange.com/users/292884/simon-fitch" class="external" target="_blank" rel="noopener noreferrer">Simon Fitch</a>.</p> + +<h2 id="preamble">Preamble</h2> + +<p>For a typical MOSFET-based switch, we can connect a GPIO pin of a +microcontroller to the gate of a logic-level N-channel MOSFET placed on the low +side of the load and tie the gate and the drain pins of the MOSFET with a +pull-down resistor. This would work as long as the power supplies of the +microcontroller and the load don’t share a common ground. Things become more +complicated when they do (e.g., controlling power to a component driven by the +same microcontroller).</p> + +<p>In that scenario, the source potential visible to the load is the difference +between the gate and the threshold potentials of the MOSFET. For example, when +the gate and the threshold potentials are 3.3 V and 1.5 V, the potential the +load sees is 1.8 V. So, to use a low-side N-channel MOSFET, we need the gate +potential to be higher than the source potential, which may not always be +practical. The alternative would be a hide-side switch.</p> + +<h2 id="p-channel-high-side-switch">P-channel high-side switch</h2> + +<p>The following schematic shows how a high-side P-channel MOSFET (M1) could +switch power to a 6 V servo driven by a 3.3 V MCU.</p> + +<p><img src="p_high_side.png" alt="P-channel high-side switching circuit" /></p> + +<p>When the microcontroller outputs low, the M2 N-channel MOSFET stops conducting. +The R1 resistor pulls the gate of the M1 P-channel MOSFET up to +6 V, switching +the servo off. When the microcontroller outputs high on the GPIO pin, M2’s +source-drain connection starts conducting, causing M1’s gate potential to drop +to 0 V, which switches on power to the servo.</p> + +<h2 id="n-channel-high-side-switch">N-channel high-side switch</h2> + +<p>The P-channel high-side switch would be the typical architecture for our use +case. However, if we have access to a potential high enough to safely raise the +gate potential above the threshold such that their difference outputs the source +potential required to drive the load, we can switch on the high side using an +N-channel MOSFET:</p> + +<p><img src="n_high_side.png" alt="N-channel high-side switching circuit" /></p> + +<p>In the schematic, both M1 and M2 are N-channel MOSFETs. When the +microcontroller output is low, M2 stops conducting. This causes the M1’s gate +potential to rise above the threshold, turning the servo on. Conversely, a high +output on the GPIO line switches M2 on, which lowers M1’s gate potential. This +switches the servo off. The R2 pull-up resistor prevents the high impedance of +the output pins at power-up from switching the servo on.</p> + +<p>Both topologies require M2 to act as a level converter between circuits +containing the microcontroller and the servo, converting between 0 V and +6 V +or +9 V. M2 is a low-power signal converter carrying less than a milliamp of +current. The gate-source threshold voltage of M2 must be lower than the MCU’s +supply voltage. 2N7000, 2N7002, and BSS138 are popular choices for M2.</p> + +<p>The D1 flyback diodes used in the two topologies safeguard the MOSFET from +voltage spikes caused by inductive loads such as servos.</p> + +<h2 id="a-bjt-alternative">A BJT alternative</h2> + +<p>A Bipolar Junction Transistor (BJT) is a simpler, cheaper, and more widely +available type of transistor that can be used as a switch.</p> + +<p><img src="bjt.png" alt="BJT architecture" /></p> + +<p>In the schematic, when the MCU outputs high, Q2 starts conducting. Q2 amplifies +Q1’s base current. Unlike MOSFETs, which are voltage-driven, BJTs are driven by +base current. Resistors R3 and R4 must be chosen carefully to output the +desired base currents. <a href="https://teachmetomake.wordpress.com/how-to-use-a-transistor-as-a-switch/" class="external" target="_blank" rel="noopener noreferrer">“How to choose a +transistor as a switch”</a> is an excellent guide on using BJTs as electronic +switches.</p> + +<h2 id="which-topology-to-choose">Which topology to choose?</h2> + +<p>The professional community appears to prefer MOSFETs over BJTs. MOSFETs are +more efficient when the switch is on. However, they are more challenging to +drive, especially with a 3.3 V MCU, due to the V<sub>GS</sub> potentials +required to achieve specified R<sub>DS(on)</sub> values (i.e., to turn them on +fully).</p> + +<p>N-channel MOSFETs have lower on-resistance values, making them more efficient +than P-channel ones. They are also cheaper. However, they are harder to drive +on the high side as their gate potential must be higher than the source +potential. This often requires extra circuitry such as MOSFET drivers.</p> + +<h2 id="further-reading">Further reading</h2> + +<ul> + <li><a href="https://www.embeddedrelated.com/showarticle/98.php" class="external" target="_blank" rel="noopener noreferrer">Different MOSFET +topologies</a></li> + <li><a href="https://www.embeddedrelated.com/showarticle/809.php" class="external" target="_blank" rel="noopener noreferrer">How to read +MOSFET datasheets</a></li> + <li><a src="https://teachmetomake.wordpress.com/how-to-use-a-transistor-as-a-switch/" class="external" target="_blank" rel="noopener noreferrer">How to use a +transistor as a switch</a></li> + <li><a src="https://forum.digikey.com/t/guide-to-selecting-and-controlling-a-mosfet-for-3-3-vdc-logic-applications/42606" class="external" target="_blank" rel="noopener noreferrer">Guide to +selecting and controlling a MOSFET for 3.3 VDC logic applications</a></li> + <li><a src="https://forum.digikey.com/t/driving-a-large-relay-from-a-3-3-vdc-microcontroller-using-an-npn-darlington-transistor/41751" class="external" target="_blank" rel="noopener noreferrer">Driving a large +relay from a 3.3 VDC microcontroller using an NPN Darlington transistor</a></li> +</ul> +</div> + <p class="post-author right">by W. D. Sadeep Madurange</p> + </div> + </div> + </main> + + <div class="footer"> + <div class="container"> + <div class="twelve columns right container-2"> + <p id="footer-text">© ASCIIMX - 2025</p> + </div> + </div> +</div> + + + </body> +</html> |
