Show Posts
Pages: 1 [2] 3 4 ... 9
16  Using Arduino / Project Guidance / Re: Control PWM fan speed depending on tempature on: March 27, 2013, 07:00:53 pm

Hooking the blue wire to ground slows it down (seems to be the same RPM as the "1") and giving it 12v does nothing... same speed (100%).

So grounding it slows it down and hooking it to 12V makes it go full speed.  Now try something like this:

Code:
 int x, y;
  for(x = 0; x < 40; x++) {
    for(y = 0; y < 25000; y++) {
      digitalWrite(PWMPin, HIGH);
      delayMicroseconds(x);
      digitalWrite(PWMPin, LOW);
      delayMicroseconds(40-x);
    }
  }  

That should approximate a 25Khz PWM signal that varies in duty cycle from 0 to 100% spaced across 40 steps.  See if your fan runs at different speeds with this.  It should start off at 1200RPM approx and increase to full speed over the course of about 40 seconds or so.
It stays at 100% RPMS. Never a decrees.
17  Using Arduino / Project Guidance / Re: Control PWM fan speed depending on tempature on: March 27, 2013, 04:49:33 pm
I hooked the incorrect pin on the fan for the PWM so now it does change speeds but when i put it on "1" its still pretty loud/fast. Its spinning about 2,040 RPMs on "1".

This is reply #18 it appears that it does change speeds as I said, just not like he expects.  With an analog write of 1, it still runs at 2040RPM.  A duty cycle of 1 at 500Hz is 60 times wider than the pulse would be at 30kHz.  That sounds like a reasonable explanation for the 2040RPM instead of 1200RPM to me.

I wish the OP would just take the BLUE wire and connect it to ground and then connect it to Vcc and tell us what happens with each.

Hooking the blue wire to ground slows it down (seems to be the same RPM as the "1") and giving it 12v does nothing... same speed (100%).
18  Using Arduino / Project Guidance / Re: Control PWM fan speed depending on tempature on: March 26, 2013, 10:17:40 pm
And digitalWrite can not produce a PWM signal...

Well, in a sense it can: digitalWrite(pin, LOW) produces a 0% duty cycle pwm signal aka permanent low; digitalWrite(pin, HIGH) produces a 100% pwm signal aka permanent high. If you have understood the motor signals correctly, one of these should correspond to 'off' and the other should correspond to 'full power'. But so far we don't know whether that's the case or which is which. I suggest you find out.
Neither LOW nor HIGH made any impact on the fan... It was 100%.
19  Using Arduino / Project Guidance / Re: Control PWM fan speed depending on tempature on: March 26, 2013, 06:58:19 pm
Yes i do have it connected to the BLUE wire of the fan.

And digitalWrite can not produce a PWM signal...
Quote
Simple Pulse Width Modulation with analogWrite
The Arduino's programming language makes PWM easy to use; simply call analogWrite(pin, dutyCycle), where dutyCycle is a value from 0 to 255, and pin is one of the PWM pins (3, 5, 6, 9, 10, or 11). The analogWrite function provides a simple interface to the hardware PWM, but doesn't provide any control over frequency. (Note that despite the function name, the output is a digital signal, often referred to as a square wave.)
Probably 99% of the readers can stop here, and just use analogWrite, but there are other options that provide more flexibility.
Bit-banging Pulse Width Modulation

You can "manually" implement PWM on any pin by repeatedly turning the pin on and off for the desired times. e.g.
void setup()
{
  pinMode(13, OUTPUT);
}

void loop()
{
  digitalWrite(13, HIGH);
  delayMicroseconds(100); // Approximately 10% duty cycle @ 1KHz
  digitalWrite(13, LOW);
  delayMicroseconds(1000 - 100);
}
This technique has the advantage that it can use any digital output pin. In addition, you have full control the duty cycle and frequency. One major disadvantage is that any interrupts will affect the timing, which can cause considerable jitter unless you disable interrupts. A second disadvantage is you can't leave the output running while the processor does something else. Finally, it's difficult to determine the appropriate constants for a particular duty cycle and frequency unless you either carefully count cycles, or tweak the values while watching an oscilloscope.
20  Using Arduino / Project Guidance / Re: Control PWM fan speed depending on tempature on: March 25, 2013, 09:41:15 pm
So what do you suggest?

Code:
int pwmPin     = 9; // digital PWM pin 9
int pwmVal     = 1; // The PWM Value
unsigned long time;
unsigned int rpm;

void setup()
{
    pinMode(pwmPin, 0);      // Sets the pin as output
    analogWrite(pwmPin, 0);  // Sets the pin as input
    digitalWrite(2, HIGH);   // Starts reading
    Serial.begin(9600);
}

void loop()
{
    if (pwmVal <= 251) {
      analogWrite(pwmPin, pwmVal);
      //pwmVal += 10;
      Serial.print(pwmVal);  // Print red value
      Serial.print("\n");    // Print a tab
    } else {
      Serial.print('at max high');  // Print red value
      Serial.print("\n");    // Print a tab
    }
 
    time=pulseIn(2,HIGH);
    rpm=(1000000*60)/(time*4);
    Serial.println(rpm,DEC);
   
    delay(700);
}
21  Using Arduino / Project Guidance / Re: Control PWM fan speed depending on tempature on: March 25, 2013, 09:15:58 pm
Both
Code:
analogWrite(pwmPin, HIGH);
and
Code:
analogWrite(pwmPin, LOW);
Have the same effect... it causes the fan to go slow (~1,800-2,000 RPMS)
22  Using Arduino / Project Guidance / Re: Control PWM fan speed depending on tempature on: March 25, 2013, 08:02:12 pm
I hooked the incorrect pin on the fan for the PWM so now it does change speeds but when i put it on "1" its still pretty loud/fast. Its spinning about 2,040 RPMs on "1".
23  Using Arduino / Project Guidance / Re: Control PWM fan speed depending on tempature on: March 25, 2013, 06:34:56 pm
Alright i finally got around to testing it and this is the code i am using:

Code:
int pwmPin = 9;      //digital pin 9
int pwmVal   = 10;

void setup()
{
  pinMode(pwmPin, OUTPUT);   // sets the pin as output
  Serial.begin(9600);
}

void loop()
{
  if (pwmVal != 255) {
         analogWrite(pwmPin, pwmVal);
         //pwmVal += 10;
         Serial.print(pwmVal);  // Print red value
         Serial.print("\n");    // Print a tab
  } else {
         Serial.print('at max high');  // Print red value
         Serial.print("\n");    // Print a tab
  }
  delay(1000);
}

However, the fan speed (max 12v right now) never slows down one bit.

I'm using D9 on the Arduino Nano ATmega 328.

The reference is here for the board (in case i have the board pin wrong): http://arduino.cc/en/uploads/Main/ArduinoNano30Schematic.pdf





What else am i doing incorrect?
24  Using Arduino / Project Guidance / Re: Control PWM fan speed depending on tempature on: March 25, 2013, 10:00:48 am
Still in need of some code to work the PWM for the fan...

David
25  Using Arduino / Project Guidance / Re: Control PWM fan speed depending on tempature 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/250
I already have DS18B20 Thermometer Temperature Sensor as the temp sensor for it to use.
26  Using Arduino / Project Guidance / Re: Control PWM fan speed depending on tempature 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?
27  Using Arduino / Project Guidance / Re: Control PWM fan speed depending on tempature 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?
Code:
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
}
28  Using Arduino / Project Guidance / Re: Control PWM fan speed depending on tempature 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

Quote
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
29  Using Arduino / Project Guidance / Control PWM fan speed depending on tempature 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! smiley

David
30  Using Arduino / Networking, Protocols, and Devices / Arduino Ethernet sending over sketch via FTDI friend on: March 13, 2013, 07:19:13 pm
Hey all i am trying to send over my code to my Arduino Ethernet board via the Adafruit FTDI friend. I am using the 1.0.4 version of the IDE and have the following settings:

Tools -> Board -> Arduino Ethernet
Tools -> Serial Port -> COM 3

The sketch is sent over to the board without problems or errors... however i am unable to see the IP of the board when i check my "attached devices" in my routers settings menu.

Here is a snip of the code i used:
Code:
  byte ip[] = { 192, 168, 9, 199 };   //Manual setup only
  byte gateway[] = { 192, 168, 9, 1 }; //Manual setup only
  byte subnet[] = { 255, 255, 255, 0 }; //Manual setup only

  // if need to change the MAC address (Very Rare)
  byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

  EthernetServer server = EthernetServer(199); //port 199

void setup(){
  Serial.begin(9600);

  //Pins 10,11,12 & 13 are used by the ethernet shield

  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);

  //Ethernet.begin(mac);
  Ethernet.begin(mac, ip, gateway, subnet); //for manual setup

  server.begin();
  Serial.println(Ethernet.localIP());

}
Here is a screen shot of the router settings:


And this is my arduino ethernet hookup:


What could i be missing?
Pages: 1 [2] 3 4 ... 9