u/Electrical-Boss2586

Raspberry Pi Pico USB/battery auto-switch circuit with Mosfet
▲ 12 r/KiCad

Raspberry Pi Pico USB/battery auto-switch circuit with Mosfet

I'm building a small robot powered by 6×AA batteries with a Pi Pico W as the brain, and I want to be able to plug in USB for programming/debugging without having to pull the batteries out every time. I've put together what I think is the standard P-FET auto-switch circuit but I'd really appreciate a second pair of eyes before I send the boards off to be made.
The idea is:

Battery (~9V) goes through a TPS62143 buck converter to make a 5V rail
That 5V feeds the drain of Q1 (DMG2305UX P-FET)
The source goes to VSYS on the Pico
The gate is tied to VBUS

So when USB is plugged in, VBUS pulls the gate high, the FET turns off, and the Pico runs from USB. When USB is unplugged, the gate goes low and the battery takes over via the FET. At least that's the theory!
A couple of bits I added after reading around:

R24 (100k gate pull-down to GND) — without this I think the gate would float when USB is unplugged because VBUS isn't actively driven low, just disconnected. The pull-down should drain the gate charge so the FET actually turns on when USB goes away. Have I got that right?
C4 (10µF) and C5 (100nF) decoupling on the 5V rail are bulk + ceramic close to the FET source. Probably overkill for this little circuit but figured it can't hurt with motors switching elsewhere on the board.

A few things I'm not 100% sure about:

Have I wired the mosfet correctly or anything else obviously wrong that I've missed?

Thanks in advance. Happy to share the rest of the schematic if useful, but wanted to keep this post focused on the power-switching bit.

u/Electrical-Boss2586 — 5 days ago