Hi I am trying tp control the speed of my noctua fan to no avaiI. Can anyone please help?
I connected my fan to VCC(5v), GND and GPIO18(PWM) and my goal is to rotate my fan based on given duty cycles. However, when I switch on my Pi, (Pi 3b+) the fan rotates without me running my script. When I do run my script, my fans stops then start again (I think some values of my code are sent to the pi) but later just keeps rotating without stopping.
Here is my Code:
import Rpi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
fan_pin = 18
frequency = 100
GPIO.setup(fan_pin, GPIO.OUT)
pwm = GPIO.PWM(fan_pin, frequency)
pwm.start(0)
for duty_cycle in range(0, 101, 10 )
pwm.ChangeDutyCycle(duty_cycle)
time.sleep(10)
pwm.stop()
GPIO.cleanup
My idea is to have my pwm fan rotate at 10 different speeds for 10 seconds each. Can anyone please assist? Thanks
Re: Control Noctua 5v PWM fan speed using pi 3b+
Noctua fans require a PWM frequency of approximately 15 KHz. They work fine with the 3.3V PWM signal you're providing via GPIO.acri0002 wrote: ↑Sun Jun 04, 2023 5:52 pmHi I am trying tp control the speed of my noctua fan to no avaiI. Can anyone please help?
I connected my fan to VCC(5v), GND and GPIO18(PWM) and my goal is to rotate my fan based on given duty cycles. However, when I switch on my Pi, (Pi 3b+) the fan rotates without me running my script. When I do run my script, my fans stops then start again (I think some values of my code are sent to the pi) but later just keeps rotating without stopping.My idea is to have my pwm fan rotate at 10 different speeds for 10 seconds each. Can anyone please assist? ThanksCode: Select all
Here is my Code: import Rpi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) fan_pin = 18 frequency = 100 GPIO.setup(fan_pin, GPIO.OUT) pwm = GPIO.PWM(fan_pin, frequency) pwm.start(0) for duty_cycle in range(0, 101, 10 ) pwm.ChangeDutyCycle(duty_cycle) time.sleep(10) pwm.stop() GPIO.cleanup
- HawaiianPi
- Posts: 7843
- Joined: Mon Apr 08, 2013 4:53 am
- Location: Aloha, Oregon USA
Re: Control Noctua 5v PWM fan speed using pi 3b+
Tell us which model Noctua fan are you using, and show us how it's wired to the Pi GPIO.
I'm using a Noctua NF-A4x10 5V PWM fan with the yellow wire connected to GPIO header pin #4 (5V), the black wire on pin #6 (GND), and the blue PWM wire on pin #12 (GPIO 18). I'm not using the green tach wire.
I have been able to control the speed using Python or another utility posted by a forum member I can't recall the name of at the moment.
I'm using a Noctua NF-A4x10 5V PWM fan with the yellow wire connected to GPIO header pin #4 (5V), the black wire on pin #6 (GND), and the blue PWM wire on pin #12 (GPIO 18). I'm not using the green tach wire.
I have been able to control the speed using Python or another utility posted by a forum member I can't recall the name of at the moment.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups, and where is that annoying music coming from?
lots of pop-ups, and where is that annoying music coming from?
Re: Control Noctua 5v PWM fan speed using pi 3b+
This is normal. The Noctua PWM line has a builtin pull up resistor. That combined with GPIO 18 in the default high-impedance input mode looks like a PWM signal at 100%.
I'm not familiar with the Rpi.GPIO package, but it looks like you're setting the PWM frequency to 100 Hz which is too low. Try specifying a PWM frequency of 15,000 Hz.When I do run my script, my fans stops then start again (I think some values of my code are sent to the pi) but later just keeps rotating without stopping.
Re: Control Noctua 5v PWM fan speed using pi 3b+
According to the Noctua data sheet the target frequency is 25kHz, with an acceptable range of 21kHz to 28kHz.lurk101 wrote: ↑Sun Jun 04, 2023 11:00 pmThis is normal. The Noctua PWM line has a builtin pull up resistor. That combined with GPIO 18 in the default high-impedance input mode looks like a PWM signal at 100%.I'm not familiar with the Rpi.GPIO package, but it looks like you're setting the PWM frequency to 100 Hz which is too low. Try specifying a PWM frequency of 15,000 Hz.When I do run my script, my fans stops then start again (I think some values of my code are sent to the pi) but later just keeps rotating without stopping.
Oh no, not again.