Go Down

Topic: controlling multiple pc fans with single pwm pin (Read 4660 times) previous topic - next topic

pals1@mcmaster.ca

Hello Folks,


I am pretty newbie in Arduino world,


I am working on a project where I need to control 10 fans using pwm signals.
I can easily use Arduino mega or Due where I have a lot of pwm pins to assign, for example mega has 14 pwm pins.

However, I tried pins 4,5,6,7,8 on a mega as pwm pins and put two fans on each (10 total) and it worked fine.
This clearly demonstrates that a single pwm pin can actually control multiple fan. This is infact great for me as I want their speed to be exactly the same.

Now I am planning to switch over to a Arduino Uno (for physical space and cost considerations) where I have less number of pwm pins.
Hence, I am wondering if I can put more fans on a single pwm?


The two concerns I have
(1) will it work, if say I put 5 fans on 1 pin
(2) will it lead to high currents in arduino and may damage it?




Thanks
Souvik.

PaulRB

#1
May 20, 2017, 07:37 pm Last Edit: May 20, 2017, 07:51 pm by PaulRB
Hi Souvik,

One fan is too much for an Arduino pin! It is not working fine. It could die at any moment. You are already damaging your Arduino pins, because of too much current, and the reverse/negative voltage created when a fan stops.

To answer your question, you can run as many fans as you want using a single pwm pin, but you must use a suitable transistor to handle the current, you must use diodes to protect from negative voltages, and you must use an external power supply to protect the Arduino's power circuits from overload.

Post a link to a page giving details of the fans you are using. Use the link icon to post links.

For a smaller Arduino, the are many smaller than Uno that can perform this task. Tell us more about the project, what else is connected to the Arduino, and we can recommend something.

pals1@mcmaster.ca

Hi PaulRB,


Thanks for your detailed response. I believe I should have provided more info for the configuration.



I am actually using an external 12 V power source to power the fans. The fans I am using is Delta 12 v dc fan

This has two pwm wires, white and green for the two fans in series.

Other things include 3 ds18b20 temperature sensors. The project simply looks at temperatures, and controls the fan speed according to the output of a pid loop to control the temperature.

I have the following questions.


1. You said "One fan is too much for an Arduino pin! It is not working fine", this got me confused,
Even one fan is too much or you meant two fan is too much?

2. If I use multiple fans, the total current to drive the fans needed will increase, but that is coming from an external power source. I have included a sketch to show my connections, for example, one fan (made of two smaller fans in series) connected to pwm pin 4 of arduino mega. Are you talking about current in pwm pins?

3. Can you please elaborate on negative voltages part? Does it mean that the voltage at the pwm wire on the fan side is sometimes higher than the arduino side and current flows into arduino from fan through the pwm pins?


4. If I use one fan per pwm pin, fans powered externally, do I still need the diodes and transistors?



Thanks.
 





pals1@mcmaster.ca

And by the way, the blue wire from the fan in the attached sketch is actually a white wire. I could not draw a white wire on white background! :)

DrAzzy

Sigh. Ignore his post - it applies to controlling fans without a builtin PWM speed control functionality, which isn't what you have.  We ALWAYS get people who don't know that PC fans with a separate PWM speed control wire exist responding and telling people they can't control a fan directly via PWM, even when the OP clearly states that they're using computer fans with a PWM speed control wire.


The 4-wire fan spec permits pullups to source as much as 5mA (maximum), so you probably need to use two pins to stay within the specs of the '328p...
ATTinyCore for x4/x5/x61/x7/x8/x41/1634/828/x313 megaTinyCore for the megaavr ATtinies - Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

PaulRB



I am actually using an external 12 V power source to power the fans. The fans I am using is Delta 12 v dc fan

This has two pwm wires, white and green for the two fans in series.
Now you have included the kind of details you should have included in your original post. Because you didn't, when I read it, I assumed you were also a beginner at electronics and were making all kinds of really stupid mistakes. The most likely type of fan I thought you might be using was the 80mm fans found in PC cases.

1. You said "One fan is too much for an Arduino pin! It is not working fine", this got me confused,
Even one fan is too much or you meant two fan is too much?
I imagined you were powering fans with current sourced from an Arduino pin. This is 5V and absolute max 40mA, which is not enough to drive a PC fan. In practice, you should take steps to limit the current sourced from an Arduino pin to 20~25mA.

2. If I use multiple fans, the total current to drive the fans needed will increase, but that is coming from an external power source. I have included a sketch to show my connections, for example, one fan (made of two smaller fans in series) connected to pwm pin 4 of arduino mega. Are you talking about current in pwm pins?
Now that you have revealed that these fans have a pwm control input, I agree that several fans can be connected to the same Arduino pin without risk of damage. The impedance of the fan's pwm wires will be pretty high, and only a small current will flow. I suggest you set up a single fan to run at maximum speed with analogWrite(pin, 255), and use a multimeter to measure the current flowing from the Arduino pwm pin. If this, for example, 5mA, then you could connect 4 or 5 fans to the same Arduino pwm pin. If it is only 1mA, you could connect 20 to 25 fans. If you need more than that, simply use an external transistor to boost the current. With a high-current transistor, you could probably connect hundreds of those fans to a single Arduino PWM pin.

3. Can you please elaborate on negative voltages part? Does it mean that the voltage at the pwm wire on the fan side is sometimes higher than the arduino side and current flows into arduino from fan through the pwm pins?
Again, because I was assuming that you were attempting to power fans with current sourced from an Arduino pin, I was pointing out that the reverse voltages induced when the fan stops would damage the Arduino. Your fans will have diodes built-in to prevent damage to its own control circuit.

4. If I use one fan per pwm pin, fans powered externally, do I still need the diodes and transistors?
No. But I thought your goal was to control many fans from a single Arduino pin. You can do this, how many depends on how much current each one draws. I suspect it is very little and you can run many fans from a single pwm pin.

PaulRB

the OP clearly states that they're using computer fans with a PWM speed control wire
No, the original post was ambiguous. If you read that post in isolation, as I did, all it says is "I need to control 10 fans using pwm signals". It does not say "I need to control 10 fans that have pwm inputs".

pals1@mcmaster.ca

Hi PaulRB,


I assume all responsibility for the confusion! Since this was my first post in arduino forum, I was not sure how much to include.


Anyway, your suggestions are really helpful. It seems like I can power many fans (fans with built in pwm wires) on the same pwm pin as long as
1. they are all powered from external power sources
2. the current drawn from pwm pin is < 40 mA, ideally < ~25 mA.


Also, thanks DrAzzy, for pointing out the correct information. That helped.


Now, I just have a final consideration. Assuming one pwm can control multiple fans, an Arduino Uno can do the job. However, as PaulRB mentioned, there are smaller boards capable of same. I was looking at some. My requirements are 5V, needs to powered via USB, and need a secure way of connecting sensors, ideally something better than just basic jumper wires, so that connections are more secure. Some of the small boards run at 3.3, some can not be powered via usb. I liked the nano which is claimed to have similar capabilities but very small.
Still, making the connections secure is problematic.
Currently I am using a mega sensor shield, which nicely groups sensor inputs in sets of three pins, like Gnd,vcc, and signal for pin 4,5...,35,36,... etc. Although this is somewhat convenient to easily connect multiple sensors, it still is kind of lousy, in the sense, sensors get disconnected or loose because of physical movement or jerking. 


Any thoughts on this?



Thanks.


CrossRoads

You can use a Screw shield, it plugs on to an Uno or a Mega to make secure connections.
I offer a couple, and a '1284P board with the screw terminals built in. All use quality, Made in  Germany, Phoenix brand screw terminals.  I added extra power & Gnd terminals on most of them as well.
http://crossroadsfencing.com/BobuinoRev17/
Uno

Mega, with extra power & ground points

'1284P with its 32 IO, also RTC, SD, and RS232 buffer available for the 2nd serial port


Partial Mega screw terminals are available also, for just the double row connector, and for all but the double row connector


Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

CrossRoads

When we populate the small board from the other side, it is labeled for use with Raspberry Pi.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

PaulRB

#10
May 22, 2017, 08:58 pm Last Edit: May 22, 2017, 09:15 pm by PaulRB
You should measure the current drawn from the Arduino pwm pin with one fan running at full speed before you assume it's ok to connect 5 fans. I think it will be. The data sheet for the fan showed that the control circuit has 10K pull-up and 20K pull-down on the pwm input, and feeds the gate of a MOSFET, so the current should be pretty low.

So... your circuit will have 3 ds18b20 sensors (requiring 1 Arduino pin) and one pin for the fan pwm inputs? Perhaps an attiny85 would be adequate (need to verify that the 1-wire and Dallas temp libraries will work on the tiny). But security of the connections is a concern. What type of connector would you prefer? Something with a catch that cannot easily shake loose? But won't USB shake loose?

How about one of those "digispark" boards? I've never used one, but they look pretty small. Need to find a way to attach connectors though.


DrAzzy

No, the original post was ambiguous. If you read that post in isolation, as I did, all it says is "I need to control 10 fans using pwm signals". It does not say "I need to control 10 fans that have pwm inputs".
My bad - I'm not sure how I hallucinated that...
ATTinyCore for x4/x5/x61/x7/x8/x41/1634/828/x313 megaTinyCore for the megaavr ATtinies - Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

PaulRB

My bad - I'm not sure how I hallucinated that...
To the developer of my favourite tiny cores, all is forgiven.

pals1@mcmaster.ca

Thank you everyone for all the help. I have some more information to share. Based on suggestions I went ahead and measured the current in the pwm pin.

Here is the data


pwm current (mA)
15      -0.43
55      -0.2
95      -0.08
135     0.04
175     0.15
215     0.26
255     0.26



This is good and bad. Good part is : for maximum pwm, the current is less than 1 mA, as was expected. So, clearly we can connect multiple fans, 10 fans easily.


Now the bad: notice -0.43 mA , why is current flowing into arduino for small pwm ?
 
May be, in this case, there would be a reverse current direction when arduino PWM output voltage is less than 3.3V, which is the value of constant voltage occurred on fan speed control wire.

I was wondering if I could use a diode, to suppress it but I am afraid that using a diode will affect the speed control mechanism by reducing the forward current. Any thoughts?




Thanks.

PaulRB

#14
May 25, 2017, 07:39 am Last Edit: May 25, 2017, 08:29 am by PaulRB
The data sheet for the fan showed that the control circuit has 10K pull-up and 20K pull-down on the pwm input, and feeds the gate of a MOSFET, so the current should be pretty low.
This is the reason for the negative currents. The MOSFET's gate is very high impedance and won't have much effect. It's those pull-up and pull-down down resistors that give rise to most of the current you measured. When the Arduino pin is high, it will source 5/20 = 0.25mA current to that 20K pull-down. When the Arduino output is low, it will sink 5/10 = 0.5mA current from the 10K pull-up resistor. I don't think you need to do anything about it, it won't harm the Arduino. Those pin current limits we discussed apply to both sourcing and sinking current.

The resistors are there so that if the pwm wire is not used or becomes disconnected, the MOSFET is switched on and the fan runs at full speed.

Go Up