how to install fan raspberry pi

How to Install a Fan on a Raspberry Pi (Step-by-Step)

If you click our links and make a purchase, we may earn an affiliate commission. Learn more

A fan isn’t the most exciting Raspberry Pi upgrade you can buy, but it’s often one of the most useful. When the processor gets too hot, the Raspberry Pi automatically reduces its performance to keep temperatures under control. Adding a cooling solution (like a fan) helps prevent his and keep your Pi running at full speed.

To install a fan on a Raspberry Pi, connect the fan’s power wires to the Pi’s 5V and GND pins while the board is powered off. The fan can then be mounted to the case before powering the Raspberry Pi back on.

If this is your first time working with GPIO pins, don’t worry. I’ll show you exactly where to connect the wires and explain the differences between the most common cooling solutions.

If you’re new to Raspberry Pi or Linux, I’ve got something that can help you right away!
Download my free Linux commands cheat sheet – it’s a quick reference guide with all the essential commands you’ll need to get things done on your Raspberry Pi. Click here to get it for free!

Important Information Before You Start

The main goal of a fan is to keep the Pi’s CPU cool so that it doesn’t throttle (reduce frequency and thus system efficiency).

A variety of fans are available on the market, and most of them are an attachment for a case. There is also a fan attachment fully compatible with the official Pi Case.

There are 2 basic types of fans available in the market:

  • Normal: spins all the time and needs to be connected to power.
  • Temperature controlled: has additional hardware that gives more control over the fan (like running only above a certain temperature threshold).

Additionally, there are fan controllers that can be used to make normal fans smarter. Hence, you will see a lot of new custom cases and innovative designs out there for this.

Now that you have a better understanding of Pi fans, let’s start with the actual tutorial. First, we will go through the hardware requirements for this project.

Hardware Requirements and Recommendations

You will need the following hardware to follow along with this tutorial:

Something not working as expected?
You can get answers from real experts in minutes.
Get help with your setup
  • Raspberry Pi: Of course! you will need a Raspberry Pi board. I would always recommend having the latest board (preferably Raspberry Pi 4 or 5) but the pinout for the Pi’s remain the same so you should be able to follow along with the older models too.

    Note: If you want to cool your Pi Zero, which may or may not have the pins, you would need to add pins first and then search for compatible cooling solutions.
  • Compatible Fans/Fan Cases: You have two options: go for just a fan or purchase a case with a fan. You have a lot of options available on the market.
    For the Pi 5, I recommend going for the Official Active Cooler.
    For other models, you could choose one from Amazon.

    Note: Again, you need to be cautious when purchasing the fan for a Pi Zero board as the size would be different. Here are some recommendations for that particular model: Case recommendation.
  • Software on the Pi: I highly recommend that you run the latest version of Raspberry Pi OS for the version of Pi you are using as it would make things a lot easier if you are using an official fan. Otherwise, for fans that aren’t temperature-controlled, you can choose any OS.

That is all for the hardware and software requirements of this project. Let’s get started with the actual tutorial now!

How to Install a Fan on the Raspberry Pi

In this section, I will walk you through installing a fan on the Raspberry Pi. Don’t worry, I will keep the process as simple as possible and include a lot of visual aids so you can easily follow even if you are doing it for the first time. So, let’s start!

Check if your Case Supports a Fan (if you use one)

If you use a case with your Raspberry Pi, which most people would, you need to check if your particular case supports a fan add-on. For instance, if you are using an official case for newer Pi’s, they support a fan add-on natively so you are good to go!

Related: The Best Raspberry Pi 5 Cases You Can Buy Today

However, if you use a very slim custom case like the one shown above, you won’t be able to fit a fan in. In that case, you would either have to remove your case or purchase a new one that can fit the fan. Here is an example of an unofficial case that comes with a fan.

Recommended next step
Master Raspberry Pi in 30 Days

If you want a clearer path than jumping from tutorial to tutorial, my book gives you a step-by-step roadmap to really understand your Raspberry Pi.

Check the book here
pi with fan case

I use a case that comes with a fan already, which is another thing you can do. It comes with everything necessary to connect the fan to the Raspberry Pi. Once you have completed this initial check, you are ready to install the fan.

Connecting the Fan Pins to the Raspberry Pi

You will see two or three wires coming out of your fan, depending on what fan you use. These wires are used for two primary purposes:

  • Two wires to power the fan through the Pi’s power and ground pins. The fans with two wires need this power so they are good to go.
  • The third wire available in some fans is used to control the speed of the fan and also send sensor readings (like the temperature) to the Pi. The official cooler has three wires running out of it.

Now that we know the purpose of these wires, let’s connect them to the Pi:

  • Connect the red wire to a power GPIO pin (5V in general).
  • Connect the black wire to a ground pin.
  • If you have a third wire, connect it to a standard GPIO pin (GPIO 14 for example).

You can follow the following pin out diagram to complete your connections:

Please ensure your Pi is turned off while you do this.

Personally, I own a fan that has just those two wires. So, all I need to do is connect those to Pi’s power pins. Here is a video tutorial of me doing just that.


Perfect! We have successfully connected our fan to the Pi. Now, let’s fit it onto the board so we can start cooling the Pi’s CPU.

Fitting the Fan onto the Raspberry Pi

Once you have successfully connected your fan to the Raspberry Pi, the next step is to connect everything and complete our setup. That means connecting the fan to the Raspberry Pi in some way.

There are four screw holes available on the Pi to help us do that. For my case, I have been given 8 screws, four to connect the fan to the case and the other four to fit the case onto the Raspberry Pi (take a look at this). I have recorded myself putting my fan case on the Pi just for you, so enjoy!

You may have a different connection mechanism, so don’t worry, go through the setup steps you are provided with the fan or case you purchase. For instance, you have to use the four screw holes (it comes with push-down screws) to connect the official Active Cooler.

That is all for the connections part! You have successfully connected your fan to the Raspberry Pi!

(Optional) Fan Temperature Configuration

If you have a fan that can be controlled using the CPU’s temperature, you can set it up from the Raspberry Pi Configuration options.

You can enable the fan control settings by pressing the Enable radio button and then specify the GPIO pin number you connected to the Fan’s third wire (which in our case is 14). Finally, we set the CPU temperature at which the fan should start.

Perfect, you have successfully enabled a smart cooling solution for your Raspberry Pi! This marks the end of this section and in turn this tutorial.

(Optional) Connecting a Fan Controller Board

As a bonus, let’s see how you can make a simple 2 wire fan like mine smart!

There may be cases where you need your Pi for a critical solution, so adding the functionality of making the fan smart (temperature-controlled) is very useful. But, what if you have a good fan but it does not support it? Well, you can use a fan controller board!

This board adds an interface between the fan and the Pi allowing you to turn the fan on and off using a GPIO pin. For instance, here is an example of such a board. Connecting everything is easy, refer to the diagram below.

Then, you can use the steps defined above to set up the fan. Alternatively, you can configure the fan to start on boot based on a particular CPU temperature by adding the following lines to boot’s config.txt file:
dtoverlay=gpio-fan,gpiopin=3,temp=x

Congratulations! You now know how to install a fan on your Raspberry Pi to keep the CPU cooler under heavy loads. That’s all for this tutorial.


🛠 This tutorial doesn't work anymore? Report the issue here, so that I can update it!

Still stuck after following this guide? Drop your question in the RaspberryTips Community — real Pi users answer fast. Post your question here.

Frequently Asked Questions

Does my Raspberry Pi really need a fan?

A fan is not always necessary for a Raspberry Pi, and the need for one depends on the specific model and usage scenario. In most cases, heatsinks or a passive cooling case are sufficient to maintain safe operating temperatures.

There is no significant risk in starting without a fan. As explained in the article, you can monitor the temperature of your Raspberry Pi during typical use and check if you notice high temperatures or thermal throttling.

You can then decide if a solution is needed in your case. I would recommend at least a passive solution for Raspberry Pi 4 and 5, but it’s probably not necessary for the other models.

Learn more: Does Your Raspberry Pi Really Need a Fan?

What cooling solutions are available for my Raspberry Pi?

There are several cooling solutions available for a Raspberry Pi, ranging from no additional cooling to advanced active cooling systems, depending on factors such as the Raspberry Pi model, usage, and environment.

  • No Additional Cooling: For light use, you might not need any extra cooling. The Raspberry Pi can handle basic tasks without overheating, especially if you are not running it 24/7.
  • Heatsinks or Passive Case: Heatsinks are small metal components attached to the CPU to dissipate heat. A passive cooling case can also help by improving airflow around the Pi.
  • Basic Fan or Case with a Fan: A simple fan can be attached to the Pi’s GPIO pins for active cooling. Some cases come with built-in fans, providing an easy and integrated solution (check my review of one here).
  • High-End Cooling Systems: Advanced cooling solutions like the Ice Tower or Pironman offer superior cooling performance. These high-end cases come with large heatsinks, powerful fans, and heat pipes, making them ideal for intensive tasks and overclocking.

Each of these solutions provides a different level of cooling, allowing you to choose the best option based on your usage and performance needs.

How do I monitor my Raspberry Pi temperature?

There are several ways to monitor your Pi’s temperature. It has an in-built temperature sensor near the main SOC chip that allows it to monitor the CPU and GPU temperature. These are the readings that are used to control the fan.

There is a simple command that allows you to monitor this temperature in real-time:
watch -n 1 vcgencmd measure_temp

This command executes the vcgencmd measure_temp command every 1 second and shows the results on the terminal.

Tip: Command lines can be a pain to memorize. I put the essential Linux commands on a printable cheat sheet so you don't have to keep googling them. You can grab the PDF here if you want to save some time.

Alternatively, you can add it on the top panel which allows you to monitor the same temperature from your home screen. Right-click the top panel > Add / Remove Plugins and then:

More about this: Raspberry Pi Temperature: Limits, monitoring, cooling and more

Not getting the same result?

Even when you follow every step, small differences in OS version, hardware or config can change the outcome. Instead of wasting time guessing, get help from people who have already fixed the same kind of issue.

Ask your question now →
🔒 No risk. Cancel anytime.
  • Get help on your exact issue
  • Access step-by-step videos for tricky setups
  • Browse the website without ads

Similar Posts

Leave a Reply

Community members only
Comments are reserved for RaspberryTips Community members. Join the community to ask questions, get help, and interact with other Raspberry Pi users.

Join the community  or  log in