2

I am trying to power a small 5V .21 A fan via GPIO pins 1 & 3. I am using pins 1 & 3 due to the nature of the fans connecter. I keep receiving the error:

fan.py:7: RuntimeWarning: A physical pull up resistor is fitted on this channel! GPIO.setup(3, GPIO.OUT)

My current code:

import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)

GPIO(1, GPIO.OUT)
GPIO.setup(3, GPIO.OUT)

GPIO.output(1, 1)
GPIO.output(3, 1)

time.sleep(5)

GPIO.cleanup()

1 Answers1

2

Since you're using BCM numbering, the pin you're using is the SCL pin (used for spi communications) and has a pull up resistor. This is a general warning. and is something I've encountered before, and I found out why here: http://www.raspberrypi.org/forums/viewtopic.php?f=32&t=96128. I've been able to ignore this warning in my projects. As for running a fan, you do NOT want to power the fan from the RPi +5v line, you'll risk damaging the pi, etc, as noted above. You should use a separate power supply for the fan, and use the gpio to switch it on / off. In the case of a 5v fan, a transistor would be able to act as a switch, but anything requiring a higher voltage, you would want to use a relay. I drew a simple schematic for you to control your fan, please forgive my ms paint skillz.....

enter image description here

I hope this helps :)

Peter
  • 74
  • 3