Pretty new to this and a terrible coder!
I am attempting to control multiple PWM 12v DC Fans (https://www.sanyodenki.com/archive/docu ... GA38_E.pdf)
I have PWM fan control working to a degree via wiringpi on Pin18 but I cannot get a stable control from 0-100% duty cycle or on more than one fan at a time. It is very strange.
I am familiar with wiring these fans to a motherboard, in this case a single motherboard fan header can control multiple fans simply by connecting all of the fan PWM control wires to the same PWM header. It seems with the Pi, the drive strength of the PWM is not enough (ie too low voltage?)
Code: Select all
import wiringpi
import time
print "hello"
wiringpi.wiringPiSetupGpio()
wiringpi.pwmSetMode(1) # PWM_MODE_MS = 1
print "setupgpIO"
wiringpi.pinMode(18, 2) # pwm only works on GPIO port 18
print "pwm mode set"
wiringpi.pullUpDnControl(18, 2) # 0=None; 1=Pull Down; 2=Pull Up
print "Pwm pull up active"
wiringpi.pwmSetClock(4) # this parameters correspond to 25kHz
print "pwm clock set"
wiringpi.pwmSetRange(128)
print "pwm range set"
wiringpi.pwmWrite(18, 76) # minimum RPM
print "Min RPM"
time.sleep(5)
wiringpi.pwmWrite(18, 80) # mid RPM
print "Mid 1 RPM"
time.sleep(5)
wiringpi.pwmWrite(18, 90) # mid RPM
print "Mid 2 RPM"
time.sleep(5)
wiringpi.pwmWrite(18, 100) # mid RPM
print "Mid 3 RPM"
time.sleep(5)
wiringpi.pwmWrite(18, 110) # mid RPM
print "Mid 4 RPM"
time.sleep(5)
wiringpi.pwmWrite(18, 120) # mid RPM
print "High RPM"
time.sleep(5)
wiringpi.pwmWrite(18, 128) # maximum RPM
print "Max RPM"
time.sleep(5)
wiringpi.pwmWrite(18, 0)
wiringpi.pinMode(18, 0)
It is also difficult to monitor the fan, I don't understand the code needed to take input from the RPM signal wire, if anyone can help there.
Do you guys think I have a hardware or a software problem? Should I bite the bullet and get a I2C PWM chip? This is a commercial project.
I also tried basic RPi GPIO with no luck.