Caution - this is my first sketch, really stupid question - pausing PWM Fan(s)?

Ok I haven't programmed anything more than web pages for 25+ years...

That said, my ultimate goal is to have two separate PWM fans run with scheduled intervals where they either stop or just slow way down

ultimate I'd like to be able to do both...

Matthew

Sounds easy enough, but something we need to know is do these fans have their own power source…because if they are too big the arduino may not be able to supply enough power.

Anyway, scheduled intervals are possible and all arduinos have PWM support…hell, you can make your own PWM support.

If you have any code, please post it. Otherwise, in your next reply be as specific as possible about everything. Also please tell us what you know so far about arduino and the programming language, this may be helpful for us wording our answers to your level of expertise.
Also, when you ask a question, be sure to ask specific questions.

Examples might be
“How do I use PWM”
“How do I use the I/O pins”
“How do I schedule intervals”
“How do I use interrupts”

Example of what not to ask
“I want to make 2 fans move seperately, but how” <–This doesn’t give us a starting point, help us help you get this project started :smiley:

Hello

I am very new to the Arduino...

I am using an Uno

I have two 12v PWM fans that are powered by a separate 12v power supply

I want to use the digital pins on the Uno to control the 2 PWM fans

Specifically my goal is to independently turn each fan on and off for specified lengths of time on a loop

I did a lot of searching but I didn't find anything that was close to what I'm trying to do...

Matthew

Matthewd5:
I did a lot of searching but I didn't find anything that was close to what I'm trying to do...

Really? On the whole of the internet you couldn't find anything on running a motor with PWM from an Arduino? That is one of the most common tasks people use an Arduino to do. A quick Google search for "Arduino PWM motor" gets over 650,000 hits.

I think you didn't look very hard.

How about something like:

byte fan1 = 9;
byte fan2 = 10;
byte fan1sense = A0;
byte fan2sense = A1;
void setup(){
     pinMode((fan1,fan2),OUTPUT);
}
void loop(){
      if(analogRead(fan1sense) < 500){//a temperature sensor
          analogWrite(fan1,200);//high speed
      }
      else
      {
           analogWrite(fan1,100);//low speed
      }
      if(analogRead(fan2sense) < 500){
           analogWrite(fan2,200);
      }
       else
      {
           analogWrite(fan2,100);
       }
}

Before you start looking at code get your hardware working first. Use a FET to control the larger current and voltage and drive that FET from the PWM pins.

pinMode((fan1,fan2),OUTPUT); ????

You might want to look at YouTube for a bit of preliminary research.

You will need to look into a transistor/MOSFET drive cctry.

Sorry but I wasn't thinking of cd motors in reference to PWM fans...stupid mistake

Matthew

Delta_G:
Really? On the whole of the internet you couldn't find anything on running a motor with PWM from an Arduino? That is one of the most common tasks people use an Arduino to do. A quick Google search for "Arduino PWM motor" gets over 650,000 hits.

I think you didn't look very hard.

Thank for taking the time to give me this code, it is appreciated

Matthew

Isaac96:
How about something like:

byte fan1 = 9;

byte fan2 = 10;
byte fan1sense = A0;
byte fan2sense = A1;
void setup(){
    pinMode((fan1,fan2),OUTPUT);
}
void loop(){
      if(analogRead(fan1sense) < 500){//a temperature sensor
          analogWrite(fan1,200);//high speed
      }
      else
      {
          analogWrite(fan1,100);//low speed
      }
      if(analogRead(fan2sense) < 500){
          analogWrite(fan2,200);
      }
      else
      {
          analogWrite(fan2,100);
      }
}

Hi
What are the specs/part number of you fans?

Tom.. :slight_smile:

I only got 67000 results on Google for 'Arduino PWM fan'.
But I guess I could cherry pick ones that don't specifically apply as if that's all there is.

Using the forum search bar I get 1630 results for 'PWM fan'. The forum is littered with threads on the subject but reading and thinking are soooo B-O-R-I-N-G!

@LarryD: pinMode((fan1,fan2),OUTPUT); allows me to set the pinMode for multiple pins at the same time. :smiley:

I learn something new every day.

Isaac96, that Is a neat trick.

Yeah, I think it works. It hasn't given me any problems. Now can we get back to helping the OP?

:grinning:

I think you had better try that using digitalWrite() :wink:

No, it doesn't work. An expression with a comma in it evaluates to the value of the last item. Then that one value is passed to the pinMode() function.

That will only set the pinmode for fan2 pin. Fan1 is not touched by that code.

Isaac96:
Now can we get back to helping the OP?

Threads aren't only about helping the OP: it's a community and so we all learn all the time. It's about increasing the knowledge of the community. Incidental learning (such as your trick there) is as important as the main purpose of the thread. (Although sometimes, threads do degenerate into pissing contests over the subtleties that memberA knows and memberB didn't.)

edit.... and if as MorganS says your trick doesn't actually work, for the reason he gives, then that's pretty important learning, I'd say.

@Isaac96
Did you try to do digitalWrite()?

In your example you are a bit confused.
You do not need to used pinMode when you are doing analogWrite to a PWM port.
Hence you fooled yourself thinking your new command structure was working.

You may want to re-examine this HERE.

As Jim said, "Incidental learning ... is as important as the main purpose of the thread."

.

JimboZA:
Threads aren't only about helping the OP: it's a community and so we all learn all the time. It's about increasing the knowledge of the community. Incidental learning (such as your trick there) is as important as the main purpose of the thread. (Although sometimes, threads do degenerate into pissing contests over the subtleties that memberA knows and memberB didn't.)

edit.... and if as MorganS says your trick doesn't actually work, for the reason he gives, then that's pretty important learning, I'd say.

The knowledge of the community on this subject is already rich and open to examination.
But what good is that when people ignore it in favor of being personally stroked?

What's the lesson? Don't look things up because someone will give you the answers if you wait.