Installing an Active Cooling Fan on Raspberry Pi
This article provides a straightforward, step-by-step guide to installing an active cooling fan on a Raspberry Pi to prevent thermal throttling and ensure optimal performance. You will learn how to identify the correct GPIO pins, securely mount the fan to the case, and configure the software to automatically control the fan speed based on the CPU temperature.
Materials and Tools Required
Before starting the installation process, gather the following essential components:
- Raspberry Pi (Model 3, 4, or 5)
- Active Cooling Fan (5V or 3.3V, 2-pin or 3-pin/4-pin PWM)
- Raspberry Pi Case with fan mounting slots
- Screws and Nuts (usually provided with the fan)
- Small Phillips Screwdriver
Step 1: Mount the Fan to the Case
Proper orientation is crucial when mounting the fan to ensure efficient airflow. Most fans have a small arrow on the side indicating the direction of the airflow, or you can look for the manufacturer’s sticker, which typically faces the direction the air blows.
- Position the fan over the mounting holes on the inside of the case lid. For optimal cooling, orient the fan so it blows cool air directly down onto the Raspberry Pi’s CPU.
- Insert the small screws from the outside of the case through the mounting holes and the fan housing.
- Secure the screws tightly using the included nuts, being careful not to over-tighten and crack the plastic case.
Step 2: Connect the Fan to the GPIO Pins
The Raspberry Pi uses General Purpose Input/Output (GPIO) pins to deliver power and control signals. Ensure your Raspberry Pi is completely powered off and unplugged from the wall before connecting any wires.
For Standard 2-Pin Fans (Always-On)
If you are using a basic 2-pin fan, you must choose between maximum cooling (5V) or quieter operation (3.3V).
- 5V Maximum Cooling: Connect the Red wire (Positive) to Pin 4 (5V Power) and the Black wire (Negative) to Pin 6 (Ground).
- 3.3V Quiet Mode: Connect the Red wire to Pin 1 (3.3V Power) and the Black wire to Pin 6 (Ground).
For 3-Pin or 4-Pin Fans (PWM/Adjustable)
Adjustable fans allow the Raspberry Pi to change the fan speed based on how hot the processor gets.
- Connect the Power wire (usually Red) to a 5V pin (Pin 2 or 4).
- Connect the Ground wire (usually Black) to a Ground pin (Pin 6).
- Connect the Control/PWM wire (usually Blue or Yellow) to a programmable GPIO pin, such as GPIO 14 (Pin 8).
Step 3: Enable Software Configuration
If you installed a PWM or controllable fan, you must configure the Raspberry Pi Operating System to manage the fan dynamically.
- Boot up your Raspberry Pi and open the Terminal.
- Open the configuration tool by typing
sudo raspi-configand pressing Enter. - Navigate to Performance Options using the arrow keys and select it.
- Select Fan and choose Yes to enable fan control.
- Enter the GPIO pin number where you connected the control wire (the default is usually 14).
- Set the threshold temperature (in degrees Celsius) at which you want the fan to turn on. A common choice is 60°C.
- Select Finish and allow the Raspberry Pi to reboot to apply the changes.
Your active cooling fan is now fully installed and configured to keep your Raspberry Pi running cool under heavy processing workloads.