Controlling the speed of a 3 wire blower

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:

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:

but that's for the Uno.

BA10033B12G AVC 12V 97mm Fan - 9733 4.5A 4-Wire Blower Fan: Amazon.com: Industrial & Scientific

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.

Sorry, the "third wire" is tach_out.

1 Like

The data sheet for the NMB motor does not indicate that the speed can be controlled. Same for the ODB0615-12HHB02A, and the yellow wire is an alarm output (shaft not rotating).

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.

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

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

const int pwmPin = 9;
  1. In the setup() function, set the chosen pin as an output:

cppCopy code

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

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

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

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.

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?

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..

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

Now it's chatbot baloney.
Adios.

Bologna. : ]

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

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

No difference

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.

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..

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?):

And some are really small:

https://www.sparkfun.com/products/15208

Thanks

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..