I recently got a Noctua Redux PWM fan and hooked it up to my Raspberry Pi and tried to control it via PWM signals.
I tried as many Python scripts online as I could find, modifying the frequency and changing the pin. My fan is hooked to GPIO 18 (pin 12) and I am using the following code:
import RPi.GPIO as GPIO
PWM_FAN = 18
RPM = 0
GPIO.setmode(GPIO.BCM)
GPIO.setup(PWM_FAN, GPIO.OUT)
fan = GPIO.PWM(PWM_FAN, 25000)
fan.start(0)
fan.ChangeDutyCycle(RPM/30)
if RPM == 0:
fan.stop()
GPIO.cleanup()
How can I get this code to control the fan correctly?
EDIT: I tried controlling an LED with PWM and it fluctuated properly, but the fan still refuses to respond to PWM signals.