# Instability Issue When Switching MOSFET for Raspberry Pi Power

**URL:** <https://forum.arduino.cc/t/instability-issue-when-switching-mosfet-for-raspberry-pi-power/1354245>\
**Category:** General Guidance\
**Created:** [February 15, 2025, 11:40am UTC](https://forum.arduino.cc/t/instability-issue-when-switching-mosfet-for-raspberry-pi-power/1354245 "2025-02-15T11:40:25Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattebi](https://avatars.discourse-cdn.com/v4/letter/m/48db29/32.png) [@mattebi](https://forum.arduino.cc/u/mattebi)\
**Post date:** [February 15, 2025, 11:40am UTC](https://forum.arduino.cc/t/instability-issue-when-switching-mosfet-for-raspberry-pi-power/1354245/1 "2025-02-15T11:40:25Z")

</div>

Hi everyone,

I’m working on a relatively simple system, but I’m encountering an instability issue in some of my prototypes. I would appreciate any insights you might have!

### System Overview

- Power is supplied by a **24V 20Ah battery** with a max discharge current of **9.8A**.
- The **24V line** powers an **industrial modem** and **LED drivers**.
- A **DC-DC converter** steps down **24V to 5V** , providing **up to 3.5A**.
- The **5V line** powers:
  - A **Seeeduino XIAO (MCU)**
  - A **Raspberry Pi 4B+**

- The **XIAO and Raspberry Pi communicate via UART**.
- The **XIAO controls three MOSFETs** via digital pins, which act as switches for the power lines of the **LEDs, Raspberry Pi, and modem**. (Previously, I used **5VDC 10A relays** , but I switched to MOSFETs for reliability.)

### The Issue

I have built several versions of this system, first on a breadboard, then on prototyping boards, and now on a custom **PCB**. One of the systems has been running **for over three months without issues**. However, at least **half of my prototypes show instability** :

- Specifically, when the **MOSFET switching the Raspberry Pi power turns on** , I observe a **voltage drop across the XIAO** , causing it to **reset**.
- This results in a **loop** , since the XIAO loses control and restarts repeatedly.

### Thoughts

I suspect a fundamental **design issue** , but I’m struggling to pinpoint it since different instances of the same system behave **inconsistently**.

I’ve attached the circuit schematic—any ideas on what could be causing this?

Thanks in advance for any help!

 ![full_schematics](https://europe1.discourse-cdn.com/arduino/original/4X/a/b/a/abad94a65e0446335c3c754364e32b052172f8b4.jpeg)

---

<div class="post-metadata">

**Author:** ![lastchancename](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/lastchancename/32/215426_2.png) [@lastchancename](https://forum.arduino.cc/u/lastchancename)\
**Post date:** [February 15, 2025, 12:09pm UTC](https://forum.arduino.cc/t/instability-issue-when-switching-mosfet-for-raspberry-pi-power/1354245/2 "2025-02-15T12:09:31Z")

</div>

The thing that catches my eye, there is no designated common 0v / signal ground.  
It’s fine to have positive and negative supplies, but their reoationships should be clear,

This leads to the chance your low voltage components could be reverse biased.

I’d redraft the schematic so the potentials are clearly visible in their relationship to the supply rails.

---

<div class="post-metadata">

**Author:** ![kmin](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/kmin/32/1147370_2.png) [@kmin](https://forum.arduino.cc/u/kmin)\
**Post date:** [February 15, 2025, 12:21pm UTC](https://forum.arduino.cc/t/instability-issue-when-switching-mosfet-for-raspberry-pi-power/1354245/3 "2025-02-15T12:21:30Z")

</div>

> [@mattebi](#):
>
> I observe a **voltage drop across the XIAO**

Across what?

Add gate resistors ~300ohm for all mosfets  
Add a capacitor across Xiao power supply  
Try with better quality buck converter.

---

<div class="post-metadata">

**Author:** ![anon95813201](https://avatars.discourse-cdn.com/v4/letter/a/87869e/32.png) [@anon95813201](https://forum.arduino.cc/u/anon95813201)\
**Post date:** [February 15, 2025, 2:44pm UTC](https://forum.arduino.cc/t/instability-issue-when-switching-mosfet-for-raspberry-pi-power/1354245/4 "2025-02-15T14:44:11Z")

</div>

**IRLZ44N**  
That is your problem.  
The maximum Rds(on) at Vgs = 3.3V is not specified.  
It will vary from part to part and is unknown.

Your XIAO has no ground or 5V connection.  
ALL grounds and negative power supply (-) need to be connected together.

---

<div class="post-metadata">

**Author:** ![mattebi](https://avatars.discourse-cdn.com/v4/letter/m/48db29/32.png) [@mattebi](https://forum.arduino.cc/u/mattebi)\
**Post date:** [February 17, 2025, 11:43am UTC](https://forum.arduino.cc/t/instability-issue-when-switching-mosfet-for-raspberry-pi-power/1354245/5 "2025-02-17T11:43:09Z")

</div>

Thanks, I definitely will! I'm drawing the schematic with Circuitlab and I'll post it here asap

---

<div class="post-metadata">

**Author:** ![mattebi](https://avatars.discourse-cdn.com/v4/letter/m/48db29/32.png) [@mattebi](https://forum.arduino.cc/u/mattebi)\
**Post date:** [February 17, 2025, 11:44am UTC](https://forum.arduino.cc/t/instability-issue-when-switching-mosfet-for-raspberry-pi-power/1354245/6 "2025-02-17T11:44:49Z")

</div>

Sorry for my bad statement; the power supply of the XIAO appears to be unstable.  
I'm attaching the whole schematic in the next days, thanks for caring

---

<div class="post-metadata">

**Author:** ![mattebi](https://avatars.discourse-cdn.com/v4/letter/m/48db29/32.png) [@mattebi](https://forum.arduino.cc/u/mattebi)\
**Post date:** [February 17, 2025, 11:46am UTC](https://forum.arduino.cc/t/instability-issue-when-switching-mosfet-for-raspberry-pi-power/1354245/7 "2025-02-17T11:46:23Z")

</div>

Thanks! Could the issue be addressed with the use of a BJT as voltage amplifier on the gate signal? I would use a Nano instead but I have to use XIAO...

---

<div class="post-metadata">

**Author:** ![anon95813201](https://avatars.discourse-cdn.com/v4/letter/a/87869e/32.png) [@anon95813201](https://forum.arduino.cc/u/anon95813201)\
**Post date:** [February 17, 2025, 11:52am UTC](https://forum.arduino.cc/t/instability-issue-when-switching-mosfet-for-raspberry-pi-power/1354245/8 "2025-02-17T11:52:29Z")

</div>

> [@mattebi](#):
>
> Could the issue be addressed with the use of a BJT as voltage amplifier on the gate signal?

Maybe, it will depend on the current you are controlling and whether you are using PWM

Maybe you can use the BJT directly and eliminate the MOSFET altogether.

---

<div class="post-metadata">

**Author:** ![mattebi](https://avatars.discourse-cdn.com/v4/letter/m/48db29/32.png) [@mattebi](https://forum.arduino.cc/u/mattebi)\
**Post date:** [February 17, 2025, 4:06pm UTC](https://forum.arduino.cc/t/instability-issue-when-switching-mosfet-for-raspberry-pi-power/1354245/9 "2025-02-17T16:06:41Z")

</div>

Original post edited with the full schematics! Thanks for any suggestion or help

---

<div class="post-metadata">

**Author:** ![anon95813201](https://avatars.discourse-cdn.com/v4/letter/a/87869e/32.png) [@anon95813201](https://forum.arduino.cc/u/anon95813201)\
**Post date:** [February 17, 2025, 4:39pm UTC](https://forum.arduino.cc/t/instability-issue-when-switching-mosfet-for-raspberry-pi-power/1354245/10 "2025-02-17T16:39:33Z")

</div>

You are still missing ground connections and you are still using IRLZ44N  
It's also not a good idea to use low side switches for the RPi and the LED drivers.  
In general, it's not a good idea to cut power to a device that may have active signals connected to it.

---

<div class="post-metadata">

**Author:** ![PerryBebbington](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/perrybebbington/32/238766_2.png) [@PerryBebbington](https://forum.arduino.cc/u/PerryBebbington)\
**Post date:** [February 17, 2025, 5:07pm UTC](https://forum.arduino.cc/t/instability-issue-when-switching-mosfet-for-raspberry-pi-power/1354245/11 "2025-02-17T17:07:00Z")

</div>

Thanks for the schematic.  
Ideally a schematic should be drawn with positive at the top and negative at the bottom, not all jumbled up like you have it, which makes it very difficult to follow.

What is NID35-5?  
This has the negative of the battery, which I think you are designating as ground, connected to COM\_2, what is COM\_2?  
You then take something from COM\_1, what is COM\_1? You seem to use this a ground for some things, but it can't be ground as it is different to the battery negative (assuming I'm right that you have designated -Ve as ground, but it's not at all clear)  
You then use Q2 to switch this might or might not be ground to the Pi, which won't work for the reason @anon95813201 has stated, but even if it did switch OK you will have parasitic powering from the other connections to the Pi.

> [@anon95813201](#):
>
> In general, it's not a good idea to cut power to a device that may have active signals connected to it.

Jim is absolutely right but I think he is downplaying this, it's a terrible idea, it won't work.

The whole concept is wrong, you need to be switching the supply not ground. You need a schematic that follows conventions and you need to be clear what parts are what. Finally, remember there is only one ground, if you doubt this have a look outside at the muddy stuff. Once you switch ground then whatever is on the other side of the switch is not ground.

---

<div class="post-metadata">

**Author:** ![mattebi](https://avatars.discourse-cdn.com/v4/letter/m/48db29/32.png) [@mattebi](https://forum.arduino.cc/u/mattebi)\
**Post date:** [February 18, 2025, 10:56am UTC](https://forum.arduino.cc/t/instability-issue-when-switching-mosfet-for-raspberry-pi-power/1354245/12 "2025-02-18T10:56:46Z")

</div>

Hi and first of all thanks for your attention and time.

I updated the schematic trying to to follow your guidelines and @anon95813201 suggestion in order to move a little further on. I made GND coincident with - Ve as you correctly assumed and reversed the switching on the positive side of the supply. I'm leaving the rest as it was so that I can proceed step by step.

NID35-5 is a DCDC converter from 24V to 5V, capable of supplying at max 3.5A. COM\_1 and COM\_2 are the commons of the stepdown converter (connected together).

Question: I'm now using a digital pin (D0) set to LOW in order to give GND reference to the digital control signal of the Femtobuck LED drivers; may I directly connect them to the XIAO GND terminal?

---

<div class="post-metadata">

**Author:** ![anon95813201](https://avatars.discourse-cdn.com/v4/letter/a/87869e/32.png) [@anon95813201](https://forum.arduino.cc/u/anon95813201)\
**Post date:** [February 18, 2025, 11:20am UTC](https://forum.arduino.cc/t/instability-issue-when-switching-mosfet-for-raspberry-pi-power/1354245/13 "2025-02-18T11:20:24Z")

</div>

> [@mattebi](#):
>
> I'm now using a digital pin (D0) set to LOW in order to give GND reference

A I/O pin is **NOT** a ground connection.  
You **CANNOT** use an N channel MOSFET as a high side switch without much more additional circuitry,  
You seem to be disregarding all recommendations and are going from bad to worse with this design.

---

<div class="post-metadata">

**Author:** ![mattebi](https://avatars.discourse-cdn.com/v4/letter/m/48db29/32.png) [@mattebi](https://forum.arduino.cc/u/mattebi)\
**Post date:** [February 18, 2025, 12:05pm UTC](https://forum.arduino.cc/t/instability-issue-when-switching-mosfet-for-raspberry-pi-power/1354245/14 "2025-02-18T12:05:45Z")

</div>

Sorry to give you that impression, I'm just trying to address every issue in this schematic that it was given to me as Bible but actually does not work at all...And, as I stated, I'm not an expert, so please forgive my mistakes.

The use of I/O pin as GND was weird for me indeed, but I was compelled to do so until now...  
Regarding the use of N channel MOSFET as high side switch, I just followed your tip to avoid switching on the low side. Saying I have a gate signal voltage sufficient to saturate the MOSFET, should I use a p-channel instead? Is this what you are saying?

---

<div class="post-metadata">

**Author:** ![anon95813201](https://avatars.discourse-cdn.com/v4/letter/a/87869e/32.png) [@anon95813201](https://forum.arduino.cc/u/anon95813201)\
**Post date:** [February 18, 2025, 12:13pm UTC](https://forum.arduino.cc/t/instability-issue-when-switching-mosfet-for-raspberry-pi-power/1354245/15 "2025-02-18T12:13:34Z")

</div>

> [@mattebi](#):
>
> should I use a p-channel instead? Is this what you are saying?

Yes but you cannot connect it directly to the XIAO.

What voltages and currents do you need to switch?  
You schematic is somewhat blurry.

---

<div class="post-metadata">

**Author:** ![PerryBebbington](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/perrybebbington/32/238766_2.png) [@PerryBebbington](https://forum.arduino.cc/u/PerryBebbington)\
**Post date:** [February 18, 2025, 12:39pm UTC](https://forum.arduino.cc/t/instability-issue-when-switching-mosfet-for-raspberry-pi-power/1354245/16 "2025-02-18T12:39:50Z")

</div>

Your schematic is much easier to read, thank you.

Search for 'high side switch', you need a P channel MOSFET to switch plus an N channel MOSFET or an NPN BJT to control the gate, plus one or two resistors. This has been covered many times on the forum so you should be able to find the information if you look.

---

<div class="post-metadata">

**Author:** ![mattebi](https://avatars.discourse-cdn.com/v4/letter/m/48db29/32.png) [@mattebi](https://forum.arduino.cc/u/mattebi)\
**Post date:** [February 18, 2025, 2:43pm UTC](https://forum.arduino.cc/t/instability-issue-when-switching-mosfet-for-raspberry-pi-power/1354245/17 "2025-02-18T14:43:32Z")

</div>

Thank you again. Q1 is switching 5V, whereas Q2 and Q3 are switching 24V.

I found this document ([Gammon Forum : Electronics : Microprocessors : Driving motors, lights, etc. from an Arduino output pin](https://www.gammon.com.au/motors)), I reckon it could be exactly what I was looking for. What do you think?

Cheers also to @PerryBebbington, really appreciating your contribution.

---

<div class="post-metadata">

**Author:** ![anon95813201](https://avatars.discourse-cdn.com/v4/letter/a/87869e/32.png) [@anon95813201](https://forum.arduino.cc/u/anon95813201)\
**Post date:** [February 18, 2025, 2:44pm UTC](https://forum.arduino.cc/t/instability-issue-when-switching-mosfet-for-raspberry-pi-power/1354245/18 "2025-02-18T14:44:48Z")

</div>

and the currents to be switched?  
Can the MOSFETs and BJT be surface mount parts?

---

<div class="post-metadata">

**Author:** ![mattebi](https://avatars.discourse-cdn.com/v4/letter/m/48db29/32.png) [@mattebi](https://forum.arduino.cc/u/mattebi)\
**Post date:** [February 18, 2025, 3:43pm UTC](https://forum.arduino.cc/t/instability-issue-when-switching-mosfet-for-raspberry-pi-power/1354245/19 "2025-02-18T15:43:18Z")

</div>

Sorry I forgot...  
Q1 should switch 5V-3A  
Q2 should switch 24V-1A  
Q3 should switch 24V-0,5A

Currently, I can only deal with THT components.

---

<div class="post-metadata">

**Author:** ![anon95813201](https://avatars.discourse-cdn.com/v4/letter/a/87869e/32.png) [@anon95813201](https://forum.arduino.cc/u/anon95813201)\
**Post date:** [February 18, 2025, 3:57pm UTC](https://forum.arduino.cc/t/instability-issue-when-switching-mosfet-for-raspberry-pi-power/1354245/20 "2025-02-18T15:57:19Z")

</div>

Can you buy parts from Digi-Key and Mouser?

[Next page](https://forum.arduino.cc/t/instability-issue-when-switching-mosfet-for-raspberry-pi-power/1354245.md?page=2)
