Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8374

Beginners • Re: On/Off Switch for Raspberry Pi 4

$
0
0
Would this cause any risk to the system?

Yes. The same risk as with pulling the plug or turning it off at the wall: potential corruption of the attached SD card/drives.
Is there are better way to turn the Pi on and off as I like?

Depends. Do you want all power cut or are you happy with a small amount of current used (the same amount as when you sudo poweroff)?

If you're not using GPIO3 (physical pin 5) you can use that as both a shutdown and wake trigger:
  1. Connect a momentary push-to-make button/switch between that pin and any ground pin.
  2. Add the following to the end of your config.txt

    Code:

    [all]dtoverlay=gpio-shutdown
  3. Reboot

Connecting power for the first time will continue to boot the Pi. If the Pi is booted, press and release the button for a safe shutdown. If its shutdown, press and release to boot.

You can use any free GPIO to trigger the shutdown (see /boot/firmware/overlays/README) but only GPIO3 can wake the Pi.

Statistics: Posted by thagrol — Sat Nov 01, 2025 11:48 pm



Viewing all articles
Browse latest Browse all 8374

Trending Articles