Altium Develop Free Trial -
https://www.altium.com/yt/taste_the_codeSupport my work on Patreon so I can continue producing free content and tutorials!
https://www.patreon.com/taste_the_codeIn this video, I build and test a smart power switch that allows an ESP32 to control when external sensors are powered on and off using a P-channel MOSFET. This approach is ideal for low-power projects, where sensors only need to be active for short periods while the main board spends most of its time in sleep mode.
I walk through the circuit design, explain how the P-channel MOSFET (IRF9540) is triggered using a simple transistor stage, and show how everything works together to automatically cut power when the system goes back to sleep. The project starts on a perfboard prototype to validate the design before moving on to a proper PCB layout.
For the schematic design and PCB planning, I used Altium Develop, which makes collaboration and design iteration much easier when working on more complex electronics projects. The file is available to my Patrons:
https://www.patreon.com/posts/p-channel-mosfet-145814051?utm_medium=clipboard_copy&utm_source=copyLink&utm_campaign=postshare_creator&utm_content=join_linkBy the end of the video, you’ll see:
- How to switch higher voltages using an ESP32 safely
- How a P-channel MOSFET can be used as a high-side power switch
- Why prototyping can save you from costly PCB mistakes
- How this setup helps significantly reduce power consumption
This power switch will later be used to control multiple sensors, powering them only when needed and extending battery life in real-world applications.
If you found this useful, make sure to like, subscribe, and check out the links below for tools and resources used in this build.
🛠️ Components Used
ESP32 -
https://s.click.aliexpress.com/e/_c3XN2fuVP-Channel MOSFET (IRF9540) -
https://s.click.aliexpress.com/e/_c40Y3KBn2N2222 NPN Transistor -
https://s.click.aliexpress.com/e/_c3iHmF0dResistors Pack -
https://s.click.aliexpress.com/e/_c4kZyIKzPerfboard / Prototype PCB -
https://s.click.aliexpress.com/e/_c4UiqrVnScrew Terminals -
https://s.click.aliexpress.com/e/_c3uIsqhxTransistor Pack -
https://s.click.aliexpress.com/e/_c4WkG9gNSoldering Station -
https://s.click.aliexpress.com/e/_c3LqPN89Digital Multimeter -
https://s.click.aliexpress.com/e/_c3xbCsHFBench Power Supply -
https://s.click.aliexpress.com/e/_c4cXSPP3Fumes Extractor -
https://s.click.aliexpress.com/e/_c4qBeRQhSupport my work on Patreon so I can continue producing free content and tutorials!
https://www.patreon.com/taste_the_codeMy recording gear:
Canon M50 Mark ii -
https://s.click.aliexpress.com/e/_msvmkJ0GT10 Pro 5G Android Phone -
https://s.click.aliexpress.com/e/_oDnXmQmDragon Touch 4K Action Camera -
https://s.click.aliexpress.com/e/_mrcbfIaUSB Condenser Microphone -
https://s.click.aliexpress.com/e/_mq9STfGTripod -
https://s.click.aliexpress.com/e/_Eynn5TPPhone tripod mount -
https://s.click.aliexpress.com/e/_oDTOzCeWritten article for the video:
https://www.tastethecode.com/sensor-power-switch-using-an-esp32-and-p-channel-mosfetBuilding a Smart Power Switch: Controlling Sensors with an ESP32 and P-Channel MOSFET
#MOSFET #esp32 #powerSwitch #pChannel #tastethecode
Main Site and blog:
https://www.tastethecode.comFacebook:
https://www.facebook.com/tastethecode/Instagram:
https://www.instagram.com/taste_the_code/Twitter:
http://twitter.com/taste_the_code00:00 - Introduction
01:28 - Altium Develop
02:29 - Circuit Components
03:43 - Schematic
05:19 - Soldering the prototype
13:10 - Device Test
14:44 - Conclusion and next steps
PCBWay Services -
https://pcbway.com/g/7Mb2rjAltium Develop Free Trial -
https://www.altium.com/yt/taste_the_code