0

I purchased the official raspberry pi 4 fan and follow the documentation to setup the fan. The fan turned on in the beginning when power on my raspberry pi 4 then it's off after finish boot up. When I shutdown, the fan turn back on and never stop.

I am using Raspberry PI OS 64bit. Is there anyway to turn off the fan when shutdown without using any transistor or modifying the wires? I am new to circuits and try to achieve this use programming.

3
  • 2
    official raspberry pi 4 fan is there such a thing? where did you find it?
    – Dirk
    Commented Apr 28, 2023 at 4:58
  • 1
    @Dirk raspberrypi.com/products/raspberry-pi-4-case-fan
    – Xihao
    Commented Apr 28, 2023 at 10:06
  • You've said the fan turn back on after issuing a shutdown. Does the fan remain on - or does it eventually turn off after the RPi has cooled down?
    – Seamus
    Commented Apr 29, 2023 at 23:12

3 Answers 3

0

You might use this tutorial to control the fan using Python and some GPIOs. It's not really that hard and should be done by just copy pasting. The only challenging point could be finding a transistor and soldering it to the wires of the fan.

https://howchoo.com/g/ote2mjkzzta/control-raspberry-pi-fan-temperature-python

2
  • Thanks for the link, is there anyway to achieve this without using any transistor or modifying the wires? I am new to circuits and try to achieve this use programming.
    – Xihao
    Commented Apr 28, 2023 at 10:05
  • 1
    this tutorial won't help with the fan in the question connected to GPIO14 - completely irrelevant actually Commented Apr 28, 2023 at 11:35
0

I don't know why you think you need a fan (although the the "official" case is a terrible design with poor airflow) - with a decent case there is no need for a fan.

The setup procedure seems to use a kernel service (which obviously can't run if shutdown) - although the description is vague so it is unclear exactly what it is enabling. You would need to explore exactly what is enabled.
If it uses PWM (as the "documentation" seems to indicate) there can be no input after shutdown so it presumably works as described for no input i.e. running permanently.

I run my Pi4 in a heatsink case with a fan (programmed to turn on above 60 degrees) but it only turns on if I run a stress test for more than 10 minutes. There seems to be no reason to run a variable speed fan.

See https://raspberrypi.stackexchange.com/a/135854/8697 & https://raspberrypi.stackexchange.com/a/133849/8697

0

The reason your fan continues to run is because the +5V supply remains connected to your RPi, and therefore to your fan. If you wired the fan IAW the instructions, and executed the setup outlined for the Raspberry Pi Configuration tool in the instructions, then one of the following is true:

  1. you are a victim of faulty/shoddy product design by the RPi Organization,
  2. your fan has failed, or
  3. you have not allowed sufficient time for your RPi 4B to cool after shutdown.

You should know this: Issuing a shutdown command (or halt or poweroff) stops the processor, but it does not remove 5V power from the RPi. Consequently, power is still being consumed by the RPi, and therefore heat continues to be produced.

You may want to return the fan as defective - you may (or may not) get a replacement that functions properly. If you elect to keep this fan, you can cure the "always on" problem as follows:

Follow the schematic below to wire your fan. Note the fan lead connected to the GPIO should be left unconnected - as per the schematic below.

schematic

simulate this circuit – Schematic created using CircuitLab

To control the fan, you may use a device tree overlay which is easily configured in the folder /boot/config.txt. If you are following the schematic here, you may open the file /boot/config.txt in your text editor, and add this one line at the top of the file:

dtoverlay=gpio-fan,temp=60000,hyst=5000

Save the file, and reboot (pull the power plug & re-insert).

The fan will turn on when its temperature reaches 60 deg C, and will remain on until until the temperature falls to 55 deg C. With fan off, the temperature may rise again to 60 deg C - at which point it will turn on again, and the cycle repeats; i.e. the fan is controlled by the temperature of the CPU within a 5 deg C hysteresis loop.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.