PaulyHog
Posts: 2
Joined: Thu Dec 12, 2019 12:21 pm

Rpi4 On/Off Switch

Thu Dec 12, 2019 12:31 pm

I'm a new user and have recently purchase a Pi4, I am using it for games emulation and seeing as it gets hot I bought a fanshim, which is installed on the GPIO pins, it works great and once booted up there is a service that runs switching it on and off at the desired temp threshold.

On to my actual issue, when the pi is in standby mode this fan runs continuously and the only way to stop it is to pull the usb-c power cable out. I've spend the past few days researching how to add a power switch to the Pi4 to turn off the power when not in use. I am using the official power adaptor and where its plugged in behind the TV is not easily accessible to switch the power off at the outlet.

I've seen on earlier models using the micro usb connector that inline switches are available but nothing like that seems to be available for usb-c due to the way its wired. Any pointers in the right direction of how to solve my problem would be greatly appreciated

alphanumeric
Posts: 2394
Joined: Tue Jan 19, 2016 2:17 pm
Location: Sydney, Nova Scotia, Canada

Re: Rpi4 On/Off Switch

Thu Dec 12, 2019 1:15 pm

One way to stop the fan on shut down is to wire a 10 K resistor between the fan control pin BCM 18, physical pin 12, and ground. It will act as a pull down resistor and turn the fan off when Raspbian shuts down. Auto control will still work once Raspbian boots up and the daemon starts. It will turn on off just like it did before. It will be off on boot up until the turn on temperature is reached.

If you connect a momentary, normally open, push button switch across BCM 3 and ground, pressing that switch will boot up your Pi. No having to power cycle it. And if you add dtoverlay=gpio-shutdown to your config.txt file, that same button will do a safe shutdown when pressed.

PaulyHog
Posts: 2
Joined: Thu Dec 12, 2019 12:21 pm

Re: Rpi4 On/Off Switch

Thu Dec 12, 2019 1:34 pm

Thank you for the quick reply, certainly sounds like it might fix the issue regarding the fan, I will do some research into the resistor. I do have a momentary switch across pins 5 and 6 with a script that runs a safe shut down

alphanumeric
Posts: 2394
Joined: Tue Jan 19, 2016 2:17 pm
Location: Sydney, Nova Scotia, Canada

Re: Rpi4 On/Off Switch

Thu Dec 12, 2019 1:58 pm

I did it to my fan shim. The fan not turning off kind of bugged me. The button on the fan shim grounds GPIO 3 when pressed and can be used to turn your Pi on off. Its what I'm using for my on off button.

dominic03
Posts: 91
Joined: Fri Dec 21, 2018 1:50 am

Re: Rpi4 On/Off Switch

Fri Dec 13, 2019 8:49 pm

You could try pi-top device manager, which fully cuts power to the pi when you click shutdown. (You can right click the battery and remove it from the panel after install and reboot). This should allow you to shut down the fan on power off.

Code: Select all

sudo apt install pt-device-manager
Raspberry Pi 4B running Raspbian Buster v3.1 (via PINN)
Kingston 32 GB C10 (U1) microSD
Sceptre E225W 22" 75hz 1080p monitor
Flash drive for backups and swap
-or-
pi-top 3 running Raspbian with drivers and pi-topHUB 2.0 / 16GB SanDisk C10 microSD

Return to “Beginners”