1

I want to add a 5V fan to the RaspberryPi,

I tried to activate gpio pins via /sys/class/gpio export files,

I did not succeed yet, I guess pin 2 and 6 have both direction out ?

Do I have to take care of anything?

4
  • Please tell us a little more. Why do you want to use GPIOs? Will the fan be always-on? Or do you want to be able to turn it on/off on software? Pins 2 and 6 and neither INPUT nor OUTPUT, they are connected to the power supply. As such they are not controlled by /sys/class/gpio, nor are they considered GPIO pins. They are just in the same connector. If you connect a fan to that pins it will work, but you have power limitations. You should check the diagram and make sure nothing wrong happens if you draw too much power (I haven't yet).
    – Marco Poli
    Commented Aug 5, 2013 at 17:45
  • @MarcoPoli my fav solution would be to let the fan activate when a certain heat is reached
    – Daniel W.
    Commented Aug 5, 2013 at 17:53
  • GPIO are unlikely to be able to provide sufficient current to run the fan without additional electronics added.
    – Tevo D
    Commented Aug 5, 2013 at 18:25
  • thank you all for your answers... I through I'd be able to just put on a fan and switch it on of and stuff.
    – Daniel W.
    Commented Aug 6, 2013 at 11:44

4 Answers 4

2

As stated by Marco Poli, pins 2 and 6 are not GPIO, but fixed.

If you are trying to control a fan you will need to connect to a proper GPIO pin, see the eLinux GPIO pinout, you are looking for pin names starting with "GPIO".

If you are trying to power directly from the RPi you can only get around 300 mA, it would be advisable to connect using a transistor as shown in response to this question about 12 v motors, alternatively we sell a board called PicoBorg which is capable of driving 4 fans / motors if you are not happy / interested in building your own circuit.

On a side note we have a script called ChilledPi on our site intended for use with PicoBorg for switching fans on / off with temperature, the code should also be easy to change for driving different GPIO pins if using your own wiring.

2

Raspberry Pi can run a 2 pin powered 12V Fan. Attach to 5V pin (top right in diagram) and GND to third pin from top right - GND pin in diagram (available here: http://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/robot/cheat_sheet/ )

Turning it on at a certain temperature would require a way of measuring temperature at the heat sinks presumably.

enter image description here

And here is an example of a fan running on my R Pi:

enter image description here

1

If you attached the fan directly between GPIO and GND, you won't get far. These pins can optimistically source up to 50mA at 3.3V, realistically you shouldn't exceed 5mA draw. A really tiny fan can draw the 50mA, 70-150mA is more viable. At 3.3V the current will be even higher.

Essentially, if you attach a really tiny fan, it might work - barely. If you want something bigger, you'd better attach some driver circuit capable of passing higher currents.

1

A fan takes from 100 to 200 mA, but 1 GPIO pin will only supply a maximum of 16 mA. If you combine all the GPIO pins you can get 51 mA but thats still not enough. However the power pins can take 500 mA(Model A)/700 mA(Model B) so the best option would be to buy a fan with 4 wires. The blue/black wire is GND, red is 5V VCC, one of the 2 other cables gives the RPM. The last wire lets you control the speed using PWM. This is what PiBorg's boards do, but it doesn't give the RPM of the fan/motor. A 3 wire fan's speed can't be controled.

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.