(Raspberry Pi Zero) Python won’t control PWM fan via GPIO /u/ping-mee Python Education

So here is what I want to do. I want to control a PWM fan via a python script. The setup is:
12V powersupply to fan, PWM pin to raspi’s BCM pin 19. I already tried different pins out and switched fans. What could cause the problem that the fan(s) won’t react?

This is my testscript:

import time import RPi.GPIO as GPIO # GPIO setup GPIO.setmode(GPIO.BCM) GPIO.setup(19, GPIO.OUT) # PWM setup fan_pwm = GPIO.PWM(19, 100) fan_pwm.start(0) try: while True: print("Setting fan speed to 0%") fan_pwm.ChangeDutyCycle(0) time.sleep(5) print("Setting fan speed to 100%") fan_pwm.ChangeDutyCycle(100) time.sleep(5) except KeyboardInterrupt: print("Exiting test...") finally: fan_pwm.stop() GPIO.cleanup()So here is what I want to do. I want to control a PWM fan via a python script. The setup is: 12V powersupply to fan, PWM pin to raspi's BCM pin 19. I already tried different pins out and switched fans. What could cause the problem that the fan(s) won't react?This is my testscript:import time import RPi.GPIO as GPIO # GPIO setup GPIO.setmode(GPIO.BCM) GPIO.setup(19, GPIO.OUT) # PWM setup fan_pwm = GPIO.PWM(19, 100) fan_pwm.start(0) try: while True: print("Setting fan speed to 0%") fan_pwm.ChangeDutyCycle(0) time.sleep(5) print("Setting fan speed to 100%") fan_pwm.ChangeDutyCycle(100) time.sleep(5) except KeyboardInterrupt: print("Exiting test...") finally: fan_pwm.stop() GPIO.cleanup() 

submitted by /u/ping-mee
[link] [comments]

​r/learnpython So here is what I want to do. I want to control a PWM fan via a python script. The setup is: 12V powersupply to fan, PWM pin to raspi’s BCM pin 19. I already tried different pins out and switched fans. What could cause the problem that the fan(s) won’t react? This is my testscript: import time import RPi.GPIO as GPIO # GPIO setup GPIO.setmode(GPIO.BCM) GPIO.setup(19, GPIO.OUT) # PWM setup fan_pwm = GPIO.PWM(19, 100) fan_pwm.start(0) try: while True: print(“Setting fan speed to 0%”) fan_pwm.ChangeDutyCycle(0) time.sleep(5) print(“Setting fan speed to 100%”) fan_pwm.ChangeDutyCycle(100) time.sleep(5) except KeyboardInterrupt: print(“Exiting test…”) finally: fan_pwm.stop() GPIO.cleanup()So here is what I want to do. I want to control a PWM fan via a python script. The setup is: 12V powersupply to fan, PWM pin to raspi’s BCM pin 19. I already tried different pins out and switched fans. What could cause the problem that the fan(s) won’t react?This is my testscript:import time import RPi.GPIO as GPIO # GPIO setup GPIO.setmode(GPIO.BCM) GPIO.setup(19, GPIO.OUT) # PWM setup fan_pwm = GPIO.PWM(19, 100) fan_pwm.start(0) try: while True: print(“Setting fan speed to 0%”) fan_pwm.ChangeDutyCycle(0) time.sleep(5) print(“Setting fan speed to 100%”) fan_pwm.ChangeDutyCycle(100) time.sleep(5) except KeyboardInterrupt: print(“Exiting test…”) finally: fan_pwm.stop() GPIO.cleanup() submitted by /u/ping-mee [link] [comments] 

So here is what I want to do. I want to control a PWM fan via a python script. The setup is:
12V powersupply to fan, PWM pin to raspi’s BCM pin 19. I already tried different pins out and switched fans. What could cause the problem that the fan(s) won’t react?

This is my testscript:

import time import RPi.GPIO as GPIO # GPIO setup GPIO.setmode(GPIO.BCM) GPIO.setup(19, GPIO.OUT) # PWM setup fan_pwm = GPIO.PWM(19, 100) fan_pwm.start(0) try: while True: print("Setting fan speed to 0%") fan_pwm.ChangeDutyCycle(0) time.sleep(5) print("Setting fan speed to 100%") fan_pwm.ChangeDutyCycle(100) time.sleep(5) except KeyboardInterrupt: print("Exiting test...") finally: fan_pwm.stop() GPIO.cleanup()So here is what I want to do. I want to control a PWM fan via a python script. The setup is: 12V powersupply to fan, PWM pin to raspi's BCM pin 19. I already tried different pins out and switched fans. What could cause the problem that the fan(s) won't react?This is my testscript:import time import RPi.GPIO as GPIO # GPIO setup GPIO.setmode(GPIO.BCM) GPIO.setup(19, GPIO.OUT) # PWM setup fan_pwm = GPIO.PWM(19, 100) fan_pwm.start(0) try: while True: print("Setting fan speed to 0%") fan_pwm.ChangeDutyCycle(0) time.sleep(5) print("Setting fan speed to 100%") fan_pwm.ChangeDutyCycle(100) time.sleep(5) except KeyboardInterrupt: print("Exiting test...") finally: fan_pwm.stop() GPIO.cleanup() 

submitted by /u/ping-mee
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *