2

I bought a 5v mini fan from aliexpress and got it today. Its working fine...but its a bit too loud for my taste.

enter image description here

Its connected to pins 4, 6 (??!? not sure)

enter image description here

Is there a way i can controll it by turning it on/off with a python script ? I found a script here but its not working.

I've seen some videos where they use pin 2 and 6 to control it...but i dont want to cut any cables yet before i am sure it will work. Also some suggest a transistor and a resistor should be used instead to control it (link here)...but again...not sure if that applies to my Model B.

Any help would be highly appreciated. Thank you

Sandbird
  • 163
  • 1
  • 2
  • 11

5 Answers5

3

STOP! You musn't ever connect a motor (fan etc) directly to a GPIO pin.

Your fan works fine now as its basically connected directly to the 5V supply which is fine.

The controllable GPIO pins on a Pi basically

  1. Don't have enough current to make a fan turn very well

BUT MORE IMPORTANTLY

  1. Will almost certainly cause the Pin to stop working as a motor (fan) can generate electricity as well as consuming it and it can create a high voltage (called back EMF) which will permanently damage your pin (if not the entire Pi!)

So basically you need a buffer circuit using a transistor or my personal favourite is to use a ULN2003 chip which has 7 buffers and only costs 50 pence or so

SimpleSi
  • 181
  • 3
2

i dont want to cut any cables yet before i am sure it will work.

Simple logic says there is no way you can control this fan with that plug attached to a pi, because there is no way to control the 5V power.

You could, however, implement and test the idea with the transistor without cutting the plug by sticking some pins in it and putting it on the breadboard. Then you connect the 5V from the pi to the breadboard appropriately. This requires one extra wire than shown in the diagram.

goldilocks
  • 60,325
  • 17
  • 117
  • 234
1

One easy way to slow it down in bits is to wire a diode (1N4001 -1N4007) is good and cheap in series with one on the leads. It provides a fixed voltage drop of 0.7 Volts, up to 1Amp. Need to go even slower? And a second diode in series. This also works when you need to dim LEDS (<1 AMP). Two diodes gives you a drop of 1.4V. Wire a switch across the two ends of the diode string and now you have High/Low settings. Easy Peasy!

0

I am using the code below. Triggering transistor with 12th pin GPIO. It works automatically according to the determined temperatures. I got power from the 3.3v pin so that it wouldn't make too much noise. But you can get it from 5v if you want.

https://github.com/obzc/pi-fan-control

BZC
  • 111
  • 5
-1

Diodes in series does not work to dim LEDs. They work to dim a light bulb or slow down a motor. But NOT LEDs.

Mareque
  • 11