0
Offline
Full Member
Karma: 0
Posts: 127
Arduino rocks
|
 |
« on: March 18, 2013, 08:09:48 pm » |
I am looking at getting 2 80x10mm PWM fans. However, i am looking at controlling the fan speed with the arduino via the PWM pins. I found the following diagram that seems to be what i am looking for in order to hook the fan up to the Arduino:  Does that seem correct? I will be using the DS18B20 Thermometer Temperature Sensor in order to see how fast i need to spin the fan. Any helpful feedback would be great!  David
|
|
|
|
|
Logged
|
|
|
|
|
USA
Offline
Full Member
Karma: 3
Posts: 120
Yes, I remember
|
 |
« Reply #1 on: March 18, 2013, 08:59:19 pm » |
It looks like that would work fine. If you wanted you could also likely read the speed of the fan back using another pin on the Arduino to connect to the sense pin, but that is probably over-complicating things.
|
|
|
|
|
Logged
|
|
|
|
|
Topsham, Vermont USA
Online
Edison Member
Karma: 15
Posts: 1465
... in The Woods In Vermont
|
 |
« Reply #2 on: March 19, 2013, 08:50:41 am » |
@StealthRT can you point to a source for this type fan?? I'd like to understand better...
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 127
Arduino rocks
|
 |
« Reply #3 on: March 19, 2013, 10:11:10 am » |
It would be a fan like so: http://www.frozencpu.com/products/15479/fan-968/Cooljag_Everflow_70mm_x_10mm_PWM_Fan_R127010BUAF.html Pin 1 Black (GND), Pin 2 Yellow (PWR), Pin 3 Green (SGN), Pin 4 Blue (PWM) I would hook the 12v (Yellow) to a power supply and ground (Black) to both the power supply and the arduino. Finally hook the PWM digital pin 9 to the PWM wire (Blue) on the fan. Do not know what to do with the signal (Green) wire? Still looking for code to read the PWM from the fan though....David
|
|
|
|
« Last Edit: March 19, 2013, 10:39:51 am by StealthRT »
|
Logged
|
|
|
|
|
Maine
Offline
Sr. Member
Karma: 8
Posts: 336
Caution: Explosives in use.
|
 |
« Reply #4 on: March 19, 2013, 10:32:43 am » |
IIRC, the green wire is a tach signal, that you can use to determine the current speed of the fan.
|
|
|
|
|
Logged
|
"Anyone who isn't confused really doesn't understand the situation." Arduino-based airsoft props -> www.nightscapetech.com
|
|
|
|
Johannesburg UTC+2
Offline
Edison Member
Karma: 34
Posts: 1705
|
 |
« Reply #5 on: March 19, 2013, 10:33:20 am » |
Still looking for code to read the PWM from the fan though.... Surely the PWM is the signal you provide to the fan to adjust its speed? The green wire is the tach, which you would presumably read if you need to know what the speed actually is. Have you seen this?
|
|
|
|
|
Logged
|
IT Crowd: Roy... "Have you tried turning it off and on again?" Moss.. "Have you tried forcing an unexpected reboot?"
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 127
Arduino rocks
|
 |
« Reply #6 on: March 19, 2013, 10:39:13 am » |
I gather that the PWM would be in the range of 0-255 when writing out to it from the ardunio? int pwmPin = 9; // fan PWM -> connected to digital pin 9 int pwmVal = 0; int DEBUG = 1; // DEBUG counter; if set to 1, will write values back via serial
void setup() { pinMode(pwmPin, OUTPUT); // sets the pin as output
if (DEBUG) { Serial.begin(9600); } }
// Main program void loop() analogWrite(pwmPin, pwmVal);
if (DEBUG) { // If we want to read the output if (pwmVal != 255) { pwmVal += 10; Serial.print(pwmVal); // Print red value Serial.print("\t"); // Print a tab } else { Serial.print('at max high'); // Print red value Serial.print("\t"); // Print a tab } } delay(wait); // Pause for 'wait' milliseconds before resuming the loop }
|
|
|
|
« Last Edit: March 19, 2013, 10:51:35 am by StealthRT »
|
Logged
|
|
|
|
|
Johannesburg UTC+2
Offline
Edison Member
Karma: 34
Posts: 1705
|
 |
« Reply #7 on: March 19, 2013, 10:57:54 am » |
I gather that the PWM would be in the range of 0-255 when writing out to it from the ardunio? Yes.... except that the Arduino PWM is under 500Hz, and the datasheet says it needs 25kHz PWM. The other ref I gave says it must be between 21 and 28kHz.... The datasheet shows the relationship between duty cycle and speed. PWM = 0 is 0%, 255 is 100%. As you'll see, PWM duty cycle below 30% (~80) still gives 1200rpm; above that it looks more or less linear up to full speed.
|
|
|
|
|
Logged
|
IT Crowd: Roy... "Have you tried turning it off and on again?" Moss.. "Have you tried forcing an unexpected reboot?"
|
|
|
|
Topsham, Vermont USA
Online
Edison Member
Karma: 15
Posts: 1465
... in The Woods In Vermont
|
 |
« Reply #8 on: March 19, 2013, 11:24:49 am » |
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 127
Arduino rocks
|
 |
« Reply #9 on: March 19, 2013, 11:45:08 am » |
I looked at the sheet and i must say, i don't understand the code on there and what it is doing in order to produce the values needed to send to the PWM fan? Mind throwing together some code for me to visualize it better?
|
|
|
|
|
Logged
|
|
|
|
|
Westbrook, CT
Offline
Full Member
Karma: 2
Posts: 128
"Why should I bother with made-up games when there are so many real ones going on." (c) Kurt Vonnegut
|
 |
« Reply #10 on: March 19, 2013, 01:10:04 pm » |
Seems good, but consider geting some electronics to handle the current required for the fan and as for a termometer consider buying some thermistors: https://www.sparkfun.com/products/250
|
|
|
|
|
Logged
|
Arduino Uno R3 Mac OSX Lion
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 127
Arduino rocks
|
 |
« Reply #11 on: March 19, 2013, 02:02:16 pm » |
Seems good, but consider geting some electronics to handle the current required for the fan and as for a termometer consider buying some thermistors: https://www.sparkfun.com/products/250I already have DS18B20 Thermometer Temperature Sensor as the temp sensor for it to use.
|
|
|
|
|
Logged
|
|
|
|
|
Topsham, Vermont USA
Online
Edison Member
Karma: 15
Posts: 1465
... in The Woods In Vermont
|
 |
« Reply #12 on: March 19, 2013, 07:02:27 pm » |
consider geting some electronics to handle the current required for the fan The Fan current is controlled by the PWM signal. No Arduino added Arduino power control needed...
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 127
Arduino rocks
|
 |
« Reply #13 on: March 25, 2013, 10:00:48 am » |
Still in need of some code to work the PWM for the fan...
David
|
|
|
|
|
Logged
|
|
|
|
|
UK
Offline
Tesla Member
Karma: 99
Posts: 6778
-
|
 |
« Reply #14 on: March 25, 2013, 10:17:33 am » |
I haven't tried it myself, but the article that terryking228 linked to lists the available PWM frequencies and I don't see any listed within the 21-28 KHz range that you're looking for.
You could try searching Nick Gammon's forum for his articles on timers - he covers this area very well and I expect you'll find a definitive answer there as to whether it's possible to achieve the frequency you need.
|
|
|
|
|
Logged
|
|
|
|
|
|