1

I just got an old PC fan from a computer that was taken apart at my school and I want to try and figure out how to make it turn on using the GPIO ports on a Raspberry Pi 3 Model B. It is a DC 12V fan and it has three wires. One red, one black, and one yellow. I looked it up online and it looks like the black is ground and the red is the 12V- wire. Is there any way I could control this straight from the GPIO pins. Thanks.

Edit: Is there a way that I can control the fan directly from the GPIO without a motor driver chip?

6
  • the fan is a motor ... google RPi control motor
    – jsotola
    Sep 27, 2018 at 2:45
  • what do you mean by that?
    – rrr
    Sep 27, 2018 at 2:47
  • the yellow wire could be used as a control line to control the fan speed or it could be a tachometer signal to read the fan speed .............. the fan voltage is probably printed on the fan itself
    – jsotola
    Sep 27, 2018 at 2:54
  • yeah it is a dc 12v motor
    – rrr
    Sep 27, 2018 at 2:56
  • I made an edit to the original question that might clarify my question. ^___^
    – rrr
    Sep 27, 2018 at 2:59

2 Answers 2

2

There is no way to control safely any motor directly from a Pi GPIO. You always need to use a motor driver board or the equivalent in discrete components.

  1. The Pi GPIO are all 3V3.
  2. A Pi GPIO can only supply a few milliamps of power (say 20 milliamps).
  3. The back EMF generated by a collapsing motor field can destroy the GPIO and the Pi.

You can buy a suitable L9110S or L298N based board quite inexpensively from the likes of eBay.

You could use a discrete motor driver chip such as the L293D or for limited control (not direction) a ULN2803A.

You could implement your own circuitry with suitable transistors, resistors, and diodes.

9
  • The pins on a raspberry pi can be up to 5v though and it is right next to a gnd pin
    – rrr
    Sep 27, 2018 at 14:48
  • 1
    @rrr Yes, you can power a small motor from the Pi's voltage rails. The motor will be running whenever the Pi is powered. That wouldn't be counted as motor control though.
    – joan
    Sep 27, 2018 at 15:01
  • if i wanted it to be on whenever the pi was on could i attach the red wire to the 5V and the black wire to the ground pin and not use the signal wire? Would that be safe?
    – rrr
    Sep 27, 2018 at 23:15
  • That would be fine (as long as the motor doesn't need more current than the Pi can supply, if it does the Pi will keep rebooting).
    – joan
    Sep 27, 2018 at 23:21
  • it needs 12V but it should be able to run off of 5V right? It just wouldn't spin as fast?
    – rrr
    Sep 27, 2018 at 23:33
2

Go in raspi config through terminal. Then in performance analysis. There you will get a option of cooling fan. Just enable it and connect the yellow wire to GPIO 14 (pin 8). Pi will automatically control it's speed according to temperature.

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.