how to install fan raspberry pi

Keep Your Raspberry Pi Cool: How to Install a Fan

If you have used a Raspberry Pi for a while, you have probably faced a situation where the Pi’s CPU heats so much that everything freezes on the screen. This happens as the CPU throttles due to these high temperatures. So, what’s the solution? Adding a fan! Of course.

To install a fan on a Raspberry Pi, the fan’s power wires should be connected to the Pi’s 5V and GND pins. The Pi must be powered off during installation. The fan should then be secured to the Pi’s case, and the Pi can be powered on.

In this tutorial, we will install a fan on your Pi. This is a detailed, step-by-step guide so do not worry if it’s your first time. Let’s learn more about the fans available for the Raspberry Pi.

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!

Want the best experience? Become a premium member for ad-free browsing, access exclusive content, and ask questions in our private forums. Your membership helps support the site!

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:

  • 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!

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.

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

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!

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

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

That’s all for this tutorial.

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

Frequently Asked Questions

Does a 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.

What cooling solutions are available for a 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 to monitor the 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.

Are you a bit lost in the Linux command line? Check this article first for the most important commands to remember and a free downloadable cheat sheet so you can have the commands at your fingertips.

Alternatively, you can add it on the top panel which allows you to monitor the same temperature from your home screen.

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

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

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

Want to chat with other Raspberry Pi enthusiasts? Join the community, share your current projects and ask for help directly in the forums.

Conclusion

Congratulations! You now know how to install a fan on your Raspberry Pi to keep the CPU cooler under heavy loads. Here is a summary of everything we learnt in this tutorial:

  • How to connect the Fan to Raspberry Pi GPIO pins
  • How to attach the fan onto the Pi
  • How to use a fan controller board with the Pi

That marks the end of this tutorial!

Whenever you’re ready, here are other ways I can help you:

The RaspberryTips Community: If you want to hang out with me and other Raspberry Pi fans, you can join the community. I share exclusive tutorials and behind-the-scenes content there. Premium members can also visit the website without ads.

Master your Raspberry Pi in 30 days: If you are looking for the best tips to become an expert on Raspberry Pi, this book is for you. Learn useful Linux skills and practice multiple projects with step-by-step guides.

The Raspberry Pi Bootcamp: Understand everything about the Raspberry Pi, stop searching for help all the time, and finally enjoy completing your projects.

Master Python on Raspberry Pi: Create, understand, and improve any Python script for your Raspberry Pi. Learn the essentials step-by-step without losing time understanding useless concepts.

You can also find all my recommendations for tools and hardware on this page.

How would you rate this article?

Click on a star to rate it!

Average rating / 5. Vote count:

No votes so far! Be the first to rate this post.

As you found this post useful...

Spread the word!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Similar Posts