Controlling PWM fan via Adafruit Motor Shield V2

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
phischmi
 
Posts: 14
Joined: Thu Jul 21, 2016 3:45 am

Controlling PWM fan via Adafruit Motor Shield V2

Post by phischmi »

Hi all,

i'm quite new to the Arduino, so bear with me ;)

I'd like to control a stepper motor and a 12V fan via the Arduino, hence i bought the Motor Shield V2.
Works great so far :)

I connected the fan with Vcc and GND to M1.
The fan is a Noctua NF A14 industrialPPC-3000 PWM.
The fan has a 4pin-connector and can be controlled via PWM, so is there a way to PWM this fan via the Motor Shield instead of just varying the voltage?
Can i somehow also read the speed-signal, the fan sends?

Thank you very much for your help!

Philipp

User avatar
adafruit_support_bill
 
Posts: 88096
Joined: Sat Feb 07, 2009 10:11 am

Re: Controlling PWM fan via Adafruit Motor Shield V2

Post by adafruit_support_bill »

4-wire fans use 2 wires for power and ground. A third wire is for the PWM speed control signal and the fourth is for a tachometer output to monitor the speed.
Unfortunately, the motor shield is not well suited for controlling these fans. Although it has 4 spare PWM outputs, the maximum PWM frequency for the shield is about 1.6KHz. PWM fans expect a signal in the 25KHz range.

http://www.formfactors.org/developer%5C ... public.pdf

User avatar
phischmi
 
Posts: 14
Joined: Thu Jul 21, 2016 3:45 am

Re: Controlling PWM fan via Adafruit Motor Shield V2

Post by phischmi »

So, in my case, the speed-range for the the fan is much narrower, because, the shield only outputs a max frequency of 1.6kHz rather than the 25kHz, the fan expects, right?

There is no way to increase this value with

Code: Select all

void begin(uint16_t freq = 1600);
?

User avatar
adafruit_support_bill
 
Posts: 88096
Joined: Sat Feb 07, 2009 10:11 am

Re: Controlling PWM fan via Adafruit Motor Shield V2

Post by adafruit_support_bill »

The speed is not controlled by the PWM frequency. It is proportional to the PWM duty cycle.
I don't know how your particular fan would respond to the slower frequency. It is quite a bit lower than the standard, but it might handle it anyway. It would not hurt anything to try.

You can specify any frequency in the 'begin()' call, but the actual available frequencies are governed by what the internal clock on the chip is capable of generating. In this case, 1.6KHz is the max.

User avatar
phischmi
 
Posts: 14
Joined: Thu Jul 21, 2016 3:45 am

Re: Controlling PWM fan via Adafruit Motor Shield V2

Post by phischmi »

Thanks for your answer.
But just that i get things right, the setSpeed(speed) function uses PWM to adjust the speed, right? It does not only vary the voltage-output to the motor?
Sorry, for asking such dumb questions, but i'd like to understand, how this works :)

Thanks a lot!

User avatar
adafruit_support_bill
 
Posts: 88096
Joined: Sat Feb 07, 2009 10:11 am

Re: Controlling PWM fan via Adafruit Motor Shield V2

Post by adafruit_support_bill »

Yes. SetSpeed varies the PWM duty cycle between 0 and 100%. So the output is always 0v or the supply voltage, but the average voltage changes.

This works well for controlling the speed of a simple 2-wire brushed DC motors. Most computer fans use brushless motors.

Brushless motors have a control circuit inside that switches power between the coils on the motor. The switching speed determines the fan speed. But the control circuit needs a constant supply voltage to operate. So they use a 3rd wire for the speed control signal.

User avatar
phischmi
 
Posts: 14
Joined: Thu Jul 21, 2016 3:45 am

Re: Controlling PWM fan via Adafruit Motor Shield V2

Post by phischmi »

Thank you, Bill!

Btw:
The fan responds to changing speed values :)
However, i have to start it using a higher speed. Otherwise it won't start turning.
When the fan's running, i can adjust it's speed to almost any value higher than ~70 :)

User avatar
adafruit_support_bill
 
Posts: 88096
Joined: Sat Feb 07, 2009 10:11 am

Re: Controlling PWM fan via Adafruit Motor Shield V2

Post by adafruit_support_bill »

That's good to hear. The other option you have is to use one of the PWM pins from the Arduino. These are capable of higher PWM speeds and might be able to exercise the full speed range of your fan: https://www.arduino.cc/en/Tutorial/SecretsOfArduinoPWM

User avatar
phischmi
 
Posts: 14
Joined: Thu Jul 21, 2016 3:45 am

Re: Controlling PWM fan via Adafruit Motor Shield V2

Post by phischmi »

Would i also be possible to use one of the Arduinos PWM-Pins while the motor shield is stacked on the Arduino?
I need the shield in order to control a stepper motor besides the fan.

User avatar
adafruit_support_bill
 
Posts: 88096
Joined: Sat Feb 07, 2009 10:11 am

Re: Controlling PWM fan via Adafruit Motor Shield V2

Post by adafruit_support_bill »

Yes, that is possible. All of the Arduino pins are accessible on the shield via the breakout holes that run parallel to the Arduino headers. The only 'reserved' pins are A4(SDA) and A5(SCL) - since these are used for communication with the shield.

User avatar
phischmi
 
Posts: 14
Joined: Thu Jul 21, 2016 3:45 am

Re: Controlling PWM fan via Adafruit Motor Shield V2

Post by phischmi »

Sounds good! :)
So, that way i could set the duty cycle to 255 on the motor shield to have an average of 12V - full speed. Then i would use one of the pwm pins to control the fan speed via the pwm wire?

User avatar
adafruit_support_bill
 
Posts: 88096
Joined: Sat Feb 07, 2009 10:11 am

Re: Controlling PWM fan via Adafruit Motor Shield V2

Post by adafruit_support_bill »

Yes. That should work.

User avatar
phischmi
 
Posts: 14
Joined: Thu Jul 21, 2016 3:45 am

Re: Controlling PWM fan via Adafruit Motor Shield V2

Post by phischmi »

Is there also a way to vary the voltage output to the motor in order to controll the speed of a fan?

User avatar
adafruit_support_bill
 
Posts: 88096
Joined: Sat Feb 07, 2009 10:11 am

Re: Controlling PWM fan via Adafruit Motor Shield V2

Post by adafruit_support_bill »

Maybe. With simple 2 or 3-wire fans, you can sometimes PWM the power via a transistor or MOSFET. Some brushless controllers handle it fine. Others not-so well.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”