Switching a circuit from an I/O
My preference is to switch the high side.







simulate this circuit &ndash; Schematic created using CircuitLab

Look for a P channel MOSFET with a low \$V_{th}\$. The NPN transistor could be substituted with a logic level N channel FET if desired.