Regarding to the following picture, I understand that I can plug a 5 V fan by plugging it in between pins 1 and 2.

Is this right (+ on 1 and - on 2?)?


My need: Plug a 5 V fan to run all the time the Raspberry Pi is on.


3 Answers 3


The diagram does not show pin numbers. Neither can I find anything on the diagram labelled 1.

The diagram does appear to correctly label the ground and 5V pins.

You can power a 5V fan by connecting its power leads to a 5V pin and a ground pin.

It will be on all the time as you can't switch the 5V pins on or off.

Do not try powering the fans from a gpio. The likely result will be one or more broken gpios and possibly a broken Pi.

  • OK, so if I plug my fan on a 5V and a ground. It will work in continue ?
    – TheLazyFox
    Commented Jun 24, 2015 at 7:15
  • 2
    Yes, it'll rotate continuously. To control the speed you'd need to find a different solution.
    – joan
    Commented Jun 24, 2015 at 7:25
  • The new raspberry pi 3 has 2 AMP power supply, you can power up small 5V fan with it. I have a case with fan for r-pi 3, works good. Commented Jan 30, 2017 at 5:21

This is right? (+ on 1 and - on 2?)

No, because you say that you have a 5V fan, and yet pin 1 is 3.3V, in addition to the fact that pin 2 on your diagram (which is in fact pin 3) is an I2C pin.

You should connect a 5V fan to the correct pin 2 (which is opposite pin 1 - the red pin in your diagram - not next to it) which is 5V and pin 6 (the black pin in your diagram) which is GND.

Raspberry Pi 1 GPIO

Raspberry Pi 1 GPIO

Raspberry Pi 2 GPIO

Raspberry Pi 2 GPIO


You may begin to find that the while using a fan the entire time takes away from the normally quiet nature of the pi. As such it may begin to become annoying. I propose a different solution one that you can customize to come on at a certain time or when the temperature reaches a given point.

You can setup the fan + lead to the 5v and connect the fan - lead to drain lead of an n channel MOSFET. Then connect the gate lead of the MOSFET to a GPIO pin of your choosing. Then connect the source lead of the MOSFET to your ground pin on the pi. In addition I would suggest either soldering on a 10K Ω resistor between the gate and source leads or using a GPIO with a built in pull down resistor and setting it in the code.

From there you can write your own fan script to control it. I have made one that you can use if you're so inclined. You can change the values and the logic to better fit your needs. The script can be found here: https://github.com/bar1792/Raspberry-Pi/blob/master/Python/Cooling%20Fan/OSMCFan.py

In this example I have used GPIO 25, as per the BCM diagram and not the actual PIN number.

With the setup purposes above you are able to use software PWM to run the fan at submaximal speeds to keep it quieter or set it to fully on to maximize cooling.

I have used a similar setup in my media center and included 2 fans one for pushing in cooler air and one to extract the warmer air from the box. With the stress testing with the command stress I was able to keep the pi under 60 degrees C in an enclosed box with heatsinks and running a hifiberry amp+. This may be overkill for your needs, but if cooling is a real issue I find this solution to work best for cooling and silence when cooling isn't an issue.

If you need help with using such a file or setting up the FET feel free to ask.

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.