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