# Controlling the speed of a 3 wire blower

**URL:** <https://forum.arduino.cc/t/controlling-the-speed-of-a-3-wire-blower/1143124>\
**Category:** General Guidance\
**Created:** [June 30, 2023, 12:41am UTC](https://forum.arduino.cc/t/controlling-the-speed-of-a-3-wire-blower/1143124 "2023-06-30T00:41:45Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulwece](https://avatars.discourse-cdn.com/v4/letter/p/dbc845/32.png) [@paulwece](https://forum.arduino.cc/u/paulwece)\
**Post date:** [June 30, 2023, 12:41am UTC](https://forum.arduino.cc/t/controlling-the-speed-of-a-3-wire-blower/1143124/1 "2023-06-30T00:41:45Z")

</div>

I'm trying to control the speed of a 12V blower (Brushless DC). You can see the photo below of the stuff I got: a Nano, some N channel MOSFETs, some potentiometers, and 2 motors (I just need to get it working with either one).

**Question 1** : I'm surprised the wires are so thin on those motors. How am I supposed to connect it to a breadboard? Or are there connectors I'm supposed to use?

One of the motor has 3 wire (I think the 3rd one won't be needed?) and the other motor has 2 wires. The goal is to control the speed via PWM.

**Question 2** : Please let me know if I got all the components I need. I also got various resistors not shown in the photo, and of course some wires and breadboard. Also got some Schottky diodes but not sure if that's necessary.

**Question 3** : Is it even doable to control the speed of a 2 wire motor with PWM or am I supposed to use a 4 wire version with a dedicated PWM wire? People tell me this is like turning a TV on and off many times a second so I'm not sure if it'll affect the life of the motor. I purposely chose the squirrel cage fans because I need high static pressure. If you know of anywhere that sells 4 wire version please let me know. I can't find any on Digikey or Mouser.

**Question 4** : The hard part is that I heard motors like this requires 25kHz frequency for PWM, but the pins on the Arduino is only capable of 500Hz or 1k Hz depending on the pin. Based on the my learnings so far, some say I can get away with a lower frequency but it might produce more noise or limit how low of a speed I can go. I want to do it "properly" with 25kHz and I read this:

> **[Secrets of Arduino PWM | Arduino Documentation](https://docs.arduino.cc/tutorials/generic/secrets-of-arduino-pwm)**
>
> Learn about Pulse Width Modulation techniques

But the technical details are a bit beyond me and it's going to take me some time to digest. I need a working prototype running quickly, so I hope someone (please?) can provide me the source code to get 25KHz out of the Nano, or enough for me to figure out the rest.... Not trying to be lazy, I did find some older threads with codes, such as:

> [@Arduino Uno 25kHz pwm](https://forum.arduino.cc/t/arduino-uno-25khz-pwm/608666):
>
> Hello, i'm looking for a way to change the standard firmata so that 2-4 pins can output a PWM signal with 25khz. Background: The Arduino Uno is connected to a Raspberry, which sends the "control commands" to the Arduino (The software is called NodeRed [Interacting with Arduino : Node-RED](https://nodered.org/docs/faq/interacting-with-arduino)). Someone from the internet has now sent me the following code (without further instructions and unformatted). Unfortunately I don't know what to do with it now. Is this a code of my own, do I have to insert…

but that's for the Uno.

 ![parts](https://europe1.discourse-cdn.com/arduino/original/4X/3/e/d/3ed36b51ca9251e55e9438dd20771647a564ccb8.jpeg)

---

<div class="post-metadata">

**Author:** ![anon85221860](https://avatars.discourse-cdn.com/v4/letter/a/59ef9b/32.png) [@anon85221860](https://forum.arduino.cc/u/anon85221860)\
**Post date:** [June 30, 2023, 2:55am UTC](https://forum.arduino.cc/t/controlling-the-speed-of-a-3-wire-blower/1143124/2 "2023-06-30T02:55:35Z")

</div>

[BA10033B12G AVC 12V 97mm Fan - 9733 4.5A 4-Wire Blower Fan: Amazon.com: Industrial & Scientific](https://www.amazon.com/BA10033B12G-AVC-12V-97mm-Fan/dp/B093PP7S7X)

---

<div class="post-metadata">

**Author:** ![JohnRob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/johnrob/32/253560_2.png) [@JohnRob](https://forum.arduino.cc/u/JohnRob)\
**Post date:** [June 30, 2023, 3:12am UTC](https://forum.arduino.cc/t/controlling-the-speed-of-a-3-wire-blower/1143124/3 "2023-06-30T03:12:23Z")

</div>

The 2 wire NMB fan is a brushless motor. I doubt it can be controlled by varying input voltage and I really doubt you can control it by PWM a constant voltage. They have some complex electronics to operate the motor. Your TV analogy is close.

The 4 wire or 3 wire are likely designed for PWM control. I could guess the black and red are power wires and the yellow is the pwm control. I don't see a 4th wire, but usually the 4th is an output speed pulse.

The PWM control is usually a much lower (than 25k) frequency but I could not find a specific number to suggest. It will be low current as it is only a control signal.

As for connecting to the board, most folks purchase a solderless bread board and a handfull of "duPont" jumper wires. Look at eBay for purchasing options. Also lately Amazon has gotten into these types of part.

---

<div class="post-metadata">

**Author:** ![anon85221860](https://avatars.discourse-cdn.com/v4/letter/a/59ef9b/32.png) [@anon85221860](https://forum.arduino.cc/u/anon85221860)\
**Post date:** [June 30, 2023, 3:15am UTC](https://forum.arduino.cc/t/controlling-the-speed-of-a-3-wire-blower/1143124/4 "2023-06-30T03:15:26Z")

</div>

Sorry, the "third wire" is tach\_out.

---

<div class="post-metadata">

**Author:** ![anon94801460](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@anon94801460](https://forum.arduino.cc/u/anon94801460)\
**Post date:** [June 30, 2023, 3:31am UTC](https://forum.arduino.cc/t/controlling-the-speed-of-a-3-wire-blower/1143124/5 "2023-06-30T03:31:30Z")

</div>

The data sheet for the [NMB motor](https://nmbtc.com/wp-content/uploads/parts/documents/05125GS%20data%20sheet.pdf) does not indicate that the speed can be controlled. Same for the [ODB0615-12HHB02A](https://nmbtc.com/wp-content/uploads/parts/documents/05125GS%20data%20sheet.pdf), and the yellow wire is an **alarm** output (shaft not rotating).

---

<div class="post-metadata">

**Author:** ![anon85221860](https://avatars.discourse-cdn.com/v4/letter/a/59ef9b/32.png) [@anon85221860](https://forum.arduino.cc/u/anon85221860)\
**Post date:** [June 30, 2023, 3:36am UTC](https://forum.arduino.cc/t/controlling-the-speed-of-a-3-wire-blower/1143124/6 "2023-06-30T03:36:00Z")

</div>

> [@anon94801460](#):
>
> the yellow wire is an **alarm** output.

What a bust.

Wait a tick, it is a tach\_out. There are pulses till it freezes/stalls and then it's an "alarm output" (stays HI). Perspective.

---

<div class="post-metadata">

**Author:** ![paulwece](https://avatars.discourse-cdn.com/v4/letter/p/dbc845/32.png) [@paulwece](https://forum.arduino.cc/u/paulwece)\
**Post date:** [June 30, 2023, 4:57am UTC](https://forum.arduino.cc/t/controlling-the-speed-of-a-3-wire-blower/1143124/7 "2023-06-30T04:57:16Z")

</div>

Those motors typically have flyback diodes or other protection built in so I can power it directly from a 12V battery without needing any external flyback diode right?

By "does not indicate that the speed can be controlled", do you mean "cannot control speed via PWM" or cannot change speed at all, even with a lower voltage?  
Thanks

---

<div class="post-metadata">

**Author:** ![paulwece](https://avatars.discourse-cdn.com/v4/letter/p/dbc845/32.png) [@paulwece](https://forum.arduino.cc/u/paulwece)\
**Post date:** [June 30, 2023, 5:01am UTC](https://forum.arduino.cc/t/controlling-the-speed-of-a-3-wire-blower/1143124/8 "2023-06-30T05:01:45Z")

</div>

The following is the ChatGPT response on how to generate a PWM signal of 25khz using the Uno. I'm impressed, and I think I can even understand most of it with some Googling. Can you check if it's right? (Putting aside the question of whether it's suitable to do this on the motors I have, which doesn't seem like it based on the responses)

To generate a PWM signal with a frequency of 25 kHz using an Arduino Uno, you can make use of the built-in Timer/Counter functionality. By configuring the appropriate timer registers, you can control the PWM frequency and duty cycle. Here's a step-by-step guide to achieving this:

1. Connect your Arduino Uno to your computer and open the Arduino IDE.
2. Start a new sketch and save it with a suitable name.
3. Begin by defining the pin you want to output the PWM signal on. For example, if you want to use pin 9, add the following line at the beginning of your sketch:

cppCopy code

```arduino
const int pwmPin = 9;

```

1. In the `setup()` function, set the chosen pin as an output:

cppCopy code

```arduino
void setup() {
  pinMode(pwmPin, OUTPUT);
}

```

1. Now, you need to configure the Timer/Counter to generate the desired PWM frequency. In Arduino Uno, you have three timers: Timer0, Timer1, and Timer2. Timer1 and Timer2 support high-frequency PWM.For this example, let's use Timer1. Add the following code in the `setup()` function to set Timer1 in Fast PWM mode:

cppCopy code

```arduino
void setup() {
  pinMode(pwmPin, OUTPUT);

  TCCR1A = 0; // Set Timer1 control registers to default state
  TCCR1B = 0;

  TCCR1A |= (1 << WGM11); // Set Timer1 to Fast PWM mode
  TCCR1B |= (1 << WGM12) | (1 << WGM13);

  TCCR1B |= (1 << CS10); // Set prescaler to 1 (no prescaling)
}

```

1. Next, you need to set the PWM frequency. The frequency is determined by the prescaler and the settings in the Timer1 control registers. For a 25 kHz PWM frequency, you can use the following settings:

cppCopy code

```arduino
void setup() {
  // ...

  TCCR1B |= (1 << CS10); // Set prescaler to 1 (no prescaling)
  TCCR1B |= (1 << CS11); // Set prescaler to 8
}

```

1. Finally, to control the duty cycle of the PWM signal, you can use the `analogWrite()` function as you would for any other PWM signal on an Arduino. The duty cycle value should range from 0 to 255, where 0 corresponds to a 0% duty cycle (off) and 255 corresponds to a 100% duty cycle (fully on). For example, to set a duty cycle of 50%, you can use:

cppCopy code

```arduino
void loop() {
  analogWrite(pwmPin, 127); // Set a duty cycle of 50%
}

```

With these steps, you should now have an Arduino Uno generating a PWM signal with a frequency of 25 kHz on the specified pin. Remember to adjust the pin number and duty cycle value as per your requirements.

---

<div class="post-metadata">

**Author:** ![paulwece](https://avatars.discourse-cdn.com/v4/letter/p/dbc845/32.png) [@paulwece](https://forum.arduino.cc/u/paulwece)\
**Post date:** [June 30, 2023, 5:35am UTC](https://forum.arduino.cc/t/controlling-the-speed-of-a-3-wire-blower/1143124/9 "2023-06-30T05:35:48Z")

</div>

> **[Amazon.com: DC Fan Controller DC Motor Speed Controller Switch PWM Control Speed...](https://www.amazon.com/Controller-Motor-Speed-Pump-Blower/dp/B075FN4H37)**
>
> Buy DC Fan Controller DC Motor Speed Controller Switch PWM Control Speed Adjustable for Pump Blower Brush or Brushless DC Fan 5V 12V 24V 1A: Case Fans - Amazon.com ✓ FREE DELIVERY possible on eligible purchases

The speed controller above seems to work for brushless DC fans and it can work on 2 wire ones. According to the reviews it seems okay. Now, I'm not sure how that controller work but it says PWM. What's the difference with using something like that VS Arduino?

---

<div class="post-metadata">

**Author:** ![Wawa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wawa/32/1211303_2.png) [@Wawa](https://forum.arduino.cc/u/Wawa)\
**Post date:** [June 30, 2023, 8:53am UTC](https://forum.arduino.cc/t/controlling-the-speed-of-a-3-wire-blower/1143124/10 "2023-06-30T08:53:39Z")

</div>

25kHz is for 4-pin fans.  
Forget about it for 2-pin or 3-pin fans.  
They are usually better controlled with very low frequency PWM, like 30Hz.  
Leo..

---

<div class="post-metadata">

**Author:** ![jim-p](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jim-p/32/922840_2.png) [@jim-p](https://forum.arduino.cc/u/jim-p)\
**Post date:** [June 30, 2023, 11:01am UTC](https://forum.arduino.cc/t/controlling-the-speed-of-a-3-wire-blower/1143124/11 "2023-06-30T11:01:58Z")

</div>

> [@paulwece](#):
>
> Now, I'm not sure how that controller work but it says PWM. What's the difference with using something like that VS Arduino?

With the controller you just turn the knob to set the speed. No arduino, No MOSFETs, No soldering, No programming.

---

<div class="post-metadata">

**Author:** ![anon85221860](https://avatars.discourse-cdn.com/v4/letter/a/59ef9b/32.png) [@anon85221860](https://forum.arduino.cc/u/anon85221860)\
**Post date:** [June 30, 2023, 11:48am UTC](https://forum.arduino.cc/t/controlling-the-speed-of-a-3-wire-blower/1143124/12 "2023-06-30T11:48:52Z")

</div>

Now it's chatbot baloney.  
Adios.

---

<div class="post-metadata">

**Author:** ![xfpd](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/xfpd/32/1120236_2.png) [@xfpd](https://forum.arduino.cc/u/xfpd)\
**Post date:** [June 30, 2023, 4:27pm UTC](https://forum.arduino.cc/t/controlling-the-speed-of-a-3-wire-blower/1143124/13 "2023-06-30T16:27:13Z")

</div>

> [@anon85221860](#):
>
> baloney

Bologna. : ]

---

<div class="post-metadata">

**Author:** ![paulwece](https://avatars.discourse-cdn.com/v4/letter/p/dbc845/32.png) [@paulwece](https://forum.arduino.cc/u/paulwece)\
**Post date:** [June 30, 2023, 6:26pm UTC](https://forum.arduino.cc/t/controlling-the-speed-of-a-3-wire-blower/1143124/14 "2023-06-30T18:26:07Z")

</div>

How so? It seems impressive to me, and well structured. But then again, I'm not the one to judge.

---

<div class="post-metadata">

**Author:** ![paulwece](https://avatars.discourse-cdn.com/v4/letter/p/dbc845/32.png) [@paulwece](https://forum.arduino.cc/u/paulwece)\
**Post date:** [June 30, 2023, 6:26pm UTC](https://forum.arduino.cc/t/controlling-the-speed-of-a-3-wire-blower/1143124/15 "2023-06-30T18:26:21Z")

</div>

I powered the fan with nominal voltage (12V) directly, without any electronics, and it ran fine. The flow and noise is a bit higher than what I want. Then I powered it with a 6V battery pack directly. It still ran, but the flow is too low although the noise was low too.

We've been talking about PWM up to this point, but what about just using an adjustable buck converter to bring down the voltage from 12V to something like 8 or 9V? How is it different than the PWM approach in terms of the static pressure and flow rate that I can expect?  
Thanks

---

<div class="post-metadata">

**Author:** ![jim-p](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jim-p/32/922840_2.png) [@jim-p](https://forum.arduino.cc/u/jim-p)\
**Post date:** [June 30, 2023, 6:39pm UTC](https://forum.arduino.cc/t/controlling-the-speed-of-a-3-wire-blower/1143124/16 "2023-06-30T18:39:49Z")

</div>

> [@paulwece](#):
>
> How is it different than the PWM approach in terms of the static pressure and flow rate that I can expect?

No difference

---

<div class="post-metadata">

**Author:** ![paulwece](https://avatars.discourse-cdn.com/v4/letter/p/dbc845/32.png) [@paulwece](https://forum.arduino.cc/u/paulwece)\
**Post date:** [June 30, 2023, 8:21pm UTC](https://forum.arduino.cc/t/controlling-the-speed-of-a-3-wire-blower/1143124/17 "2023-06-30T20:21:01Z")

</div>

I'm glad to hear that 25kHz is for 4-pin fans and that I don't need to worry about it for the 2 pin fans I have. I've always thought it's way too high of a frequency to switch something on and off just to get a lower speed.

In your experience, do you notice any decrease in lifespan of the 2 pin fans if we "abuse" it by controlling it with a low frequency PWM? I'm still debating whether to go with the PWM approach of just use an adjustable buck converter.

---

<div class="post-metadata">

**Author:** ![Wawa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wawa/32/1211303_2.png) [@Wawa](https://forum.arduino.cc/u/Wawa)\
**Post date:** [June 30, 2023, 8:59pm UTC](https://forum.arduino.cc/t/controlling-the-speed-of-a-3-wire-blower/1143124/18 "2023-06-30T20:59:49Z")

</div>

Use an adjustable buck converter if you want a fixed speed.  
Use an Arduino if you want automatic/variable control e.g. with temperature.  
I never experienced failures due to PWM.  
Leo..

---

<div class="post-metadata">

**Author:** ![paulwece](https://avatars.discourse-cdn.com/v4/letter/p/dbc845/32.png) [@paulwece](https://forum.arduino.cc/u/paulwece)\
**Post date:** [June 30, 2023, 10:59pm UTC](https://forum.arduino.cc/t/controlling-the-speed-of-a-3-wire-blower/1143124/19 "2023-06-30T22:59:04Z")

</div>

Can you recommend a good adjustable buck converter? I played around with a no-name one years ago and it died after a few days. The motor wattage is less than 5W and draws less than 0.5A. I just need one that converts 12V to a range from 6V to 12V.

There's so many different ones, (and of different size) I don't know which to get or what to look for. Some have big components like the following one (what is that coil for?):

![](https://europe1.discourse-cdn.com/arduino/original/4X/e/5/c/e5c20af47d5dfc85ff747a9578540a59f3b8833f.jpeg)

And some are really small:

[https://www.sparkfun.com/products/15208](https://www.sparkfun.com/products/15208)

 ![](https://europe1.discourse-cdn.com/arduino/original/4X/e/c/c/eccac3ed70e7f0a47b4586f524925d7b006d7123.jpeg)

Thanks

---

<div class="post-metadata">

**Author:** ![Wawa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wawa/32/1211303_2.png) [@Wawa](https://forum.arduino.cc/u/Wawa)\
**Post date:** [June 30, 2023, 11:27pm UTC](https://forum.arduino.cc/t/controlling-the-speed-of-a-3-wire-blower/1143124/20 "2023-06-30T23:27:55Z")

</div>

I had no problems with the $1 thumbnail-sized buck converters you see on all the cheap sites, sometimes advertised as MP2307. As long as you use them within their limits of course.  
Leo..

[Next page](https://forum.arduino.cc/t/controlling-the-speed-of-a-3-wire-blower/1143124.md?page=2)
