Install Safe-shutdown and Power-off

 This process works for all devices

Step 1.

Login to your Raspberry Pi via Putty

Step 2.

Edit the config.txt file

sudo nano /boot/config.txt

Step 3.

Add the following lines to the end of your config.txt file:

#Shutdown Button
dtoverlay=gpio-shutdown,gpiopin=3
#Poweroff Trigger
dtoverlay=gpio-poweroff,gpiopin=4

Step 4.

Save your changes