4

I bought a 30mm DC fan to cool off my Pi. It worked just fine if I plugged it into the 5V and GND pins. However, I wanted it to be programmatically controlled, so I plugged it into pin #18 and GND. That only succeeded in making a high-pitched whine and the fan didn't seem to want to turn at all.

When I plugged it back into the 5V pins, the Pi suddenly shut off. The Pi booted back up though, but now the 5V/GND pins don't work with the fan at all.

4

You need to checkout this tutorial that covers controlling a DC motor using a Raspberry Pi. The Pi's GPIO pins are for very low current applications such as controlling a transistor or controlling an LED (with resistor).

Here's quote from the tutorial:

IMPORTANT: Do not connect a motor, no matter how small directly to the Raspberry Pi, it will damage your Raspberry Pi.

The main processor can only supply enough power to light a LED, roughly 20mA. A motor will want at least 400mA of current to start turning.

The Pi's 5V output pins are supposed to be directly connected to your 5V input power supply.

  • I've seen other tutorials saying that using the 3.3v pin is not a big deal. I figured if it it drew too much current it might fry something, but I am not sure why the 5v pin now doesn't work. If the 5v pin is directly connected to the power supply, why does my pi still work but the pin doesn't work at all? – RRRRRR May 10 '17 at 19:52
  • Can you check the 5V pins with a volt meter? Which specific Raspberry Pi are you using? Your best bet IMHO is to try interfacing to the motor using the tutorial or other method. Are you planning to only turn on the fan when the Pi's temp reaches a certain point and then turn it off when the temp falls? – HeatfanJohn May 10 '17 at 20:11
2

No, I didn't. I just destroyed my fan. I had plugged it in backwards. The Pi is fine.

  • -1 You (or someone copying you) still could have destroyed the functionality of at least that one GPIO pin if not the whole bank... – SlySven Dec 15 '18 at 0:28
1

Dude It is very well documented no motors for the pi. Get arduino, sparkfun, or adafruit micro controller for this stuff. Pi and Arduino work well together and both offer features the other lacks. Just as a reference check out the Arduino web IDE. Open file-examples and see all the possibilities instantly. RPi can not compare in this way

1

When you say #18 you perhaps are not being clear which pin you mean, for the later RPis with a 40 Pin GPIO header pin 18 of 40 is a GPIO pin (possibly 5) that is directly connected to the Broadcomm IC at the heart of the RP. DO NOT CONNECT A MOTOR DIRECTLY TO AN RPI GPIO PIN. Alternatively you could mean that you connected the motor to the Broadcomm numbering GPIO 18 which is PWM0 and is pin 12 on the 40 pin header - again though DO NOT CONNECT A MOTOR DIRECTLY TO AN RPI GPIO PIN. You could possibly connect a 5V dc fan to pins 6 (-ve) and 2 (+ve) but that means the fan would be powered and running all the time the RPi is powered up - what you want at the barest minimum/simplest system is an NPN bipolar transistor (or darlington pair) with the collector connected to the negative lead on the fan and the emitter connected to the ground (pin 6 on the GPIO header) and the base connected through a resistor (say 10 to 22 KOhms) to a GPIO pin that is set to have the pull-up turned on. The positive wire of the fan should be connected to a suitable DC power supply with the ground wire also connected to the RPi ground.

simple CE stage to drive a Fan or other motor from a GPIO pin With the above configuration you should be able to configure the relevant GPIO as an output - when it is taken to a high logic level (which it may do anyway before it is configured as an output) the current that flows out through the pin into the base of the transistor will be amplified by the gain current gain of the transistor/Darlington pair (which can be in range 20-800 depending on the particular transistor device chosen and the square of those values for a Darlington pair) and allowed to through the collect-emitter circuit and thus the fan which should then spin up to it's full speed provided its current requirement is less than that maximum possible figure and that the voltage drop across the transistor/Darlington (0.5V or so) collector-emitter junction when it is saturated (turned fully "on") does not drop the voltage too much to affect the fan (more significant if a 5V supply is used compared to 12V).

Driving the GPIO pin low will switch the transistor and thus the fan off.

Oh, and DO NOT CONNECT A MOTOR DIRECTLY TO AN RPI GPIO PIN! 8-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.