Go Down

Topic: Controlling case fans using an Uno r3 (Read 357 times) previous topic - next topic

jmjohnson117

I hope this is the right place to ask this. Just getting started, here. I have an uno r3 on order for my first project, and I'm having trouble finding a good reference on how to make this project work. I'm planning on building an enclosure for an Elekslaser engraver, and I want to be able to use the arduino to:

  • Read and display the internal temperature in the box
  • Turn on an LED light strip
  • Turn on two 120mm case fans for intake/exhaust (this is what I'm confused on)

I have a Grove base shield (v1.3) with a temperature sensor and an rgb lcd. That part I have figured out. The light, I don't have yet. But I haven't been able to find a reference or a guide that shows how I can properly connect and control two (or even one) case fan with an arduino. I'm very new to this, but I'm a software developer by day so I feel like I should be able to figure this out with some guidance.

Do I need to connect the fans to a 12v power supply and chain it together to something on the arduino to send a HIGH/LOW signal? Which connector(s) do I ideally need?

For reference, I have two of these on order. 120mm case fans.

pylon

What do you want to achieve? Just turn the fans on and off depending on the temperature? Do you need to check the RPMs of the fans? Do you need to control the RPMs of the fans?

As the fans run on 12V you need a kind of switch. Depending on the answers to above questions this might be a simple relay or you need a circuitry to PWM control the output (so MOSFETs are the best choice).

jmjohnson117

I would settle with just turning the fans on and off when the board is on to start. The temperature sensor is to practice with some real world live data and to have something interesting on the display. I plan on eventually taking this to a craft show to engrave things on the spot, so adding a temperature read out could be an eye catcher, and would be good practice with the sensor.

So, to start, just power on the fans.

jmjohnson117

Would I need a relay or a mosfet to accomplish this?

pylon

Would I need a relay or a mosfet to accomplish this?
A relay is sufficient but it makes noise so you might prefer the MOSFET solution. Take care to use a MOSFET that has a low threshold gate-source voltage so you can drive it directly by an Arduino pin.

jmjohnson117

A relay is sufficient but it makes noise so you might prefer the MOSFET solution. Take care to use a MOSFET that has a low threshold gate-source voltage so you can drive it directly by an Arduino pin.
Ideally, this would be something below 5v, or even 3.3v, correct?

pylon

Quote
Ideally, this would be something below 5v, or even 3.3v, correct?
The threshold should be considerably below this. For a 5V Arduino look for a threshold below 2V, for a 3V3 Arduino is should be below 1.4V. There's a difference between threshold voltage and saturation voltage.

One example is IRLZ14.

jmjohnson117

That makes sense. I've watched some videos where people prototype a fan control using a mosfet and a breadboard, or just wire it straight to the arduino board. Once it's working and ready to go in the enclosure, would it be best to solder the wires to the mosfet or even just use some heat shrink tubing? Or is there a more preferred way to put this together without having a messy bunch of wires everywhere?

DrAzzy

Or is there a more preferred way to put this together without having a messy bunch of wires everywhere?
Prototyping board is a cleaner, more robust way to wire up a permanent project. Often they're styled after breadboard, so groups of holes are connected together, so each wire/pin gets it's own hole.


Hey, guess who just happens to sell some lovely prototyping board?

There are also solutions like "stripboard" which has whole stripes along the board connected, and you need to cut them where appropriate, and some useless ones that seem very common on ebay that don't have any of the plated holes connected (I'm not sure how this is supposed to save assembly time; it certainly looks like crap).

The threshold voltage of the FET is not the critical thing to look at. What matters is what gate voltage they're actually rated for use on - look at the datasheet and find the lowest voltage for which they specify an RDSon.
I usually recommend IRF3708's - they're pricey, but capable of switching fairly heavy loads, and with the lowest rated gate voltage I've been able to find on a through-hole power MOSFET.


Are you using "4-wire" computer fans? These have switching circuitry built in, and the speed can be controlled with 5v pwm directly!
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

jmjohnson117

Are you using "4-wire" computer fans? These have switching circuitry built in, and the speed can be controlled with 5v pwm directly!
Yes, I'm using two of these 120mm case fans. If I run the fans directly from pwm wouldn't they be under-powered since that's only 5v? If that will work to start, I'm ok with that. But, if I want to get more power to the fans to get more airflow, I'd still need to run them through a fet or a relay, looks like.

pylon

Quote
Are you using "4-wire" computer fans? These have switching circuitry built in, and the speed can be controlled with 5v pwm directly!
DrAzzy wrote about 4-wire fans, your's have only 3 wires so you cannot control them by the fourth wire.

The 4 wire versions have two wires for power (GND, 12V), one with the RPM output and one to control the speed by a TTL PWM signal. But these fans are little bit more expensive.

jmjohnson117

Oops, I just assumed they were 4-pin because of the connector. Should have read that more carefully.

So then, do I need to get a certain connector to use these? I could still just wire them directly the pins I would use. But if there's a connector that would work better for this, I'm not sure what it is.

pylon

Quote
So then, do I need to get a certain connector to use these? I could still just wire them directly the pins I would use. But if there's a connector that would work better for this, I'm not sure what it is.
I guess a Molex KK254 (#171856-0003) should fit. I don't think you really need it but it makes the fan easily replaceable.

DrAzzy

Oops, I just assumed they were 4-pin because of the connector. Should have read that more carefully.

So then, do I need to get a certain connector to use these? I could still just wire them directly the pins I would use. But if there's a connector that would work better for this, I'm not sure what it is.
They don't have a 4-pin connector, they have a 3-pin connector, they're normal computer fans.

We're talking about a type of computer fan that is SOLD AS as "4 wire" or "pwm" fan. These fans will have 4 wires going to them - +12v, gnd, speed output, and pwm input, and a specific 4-pin connector (which looks like the 3-pin fan connectors with one extra pin, with the ridges that keep you from plugging it in the wrong way in the same spot, so you can plug it into a 3-pin header and the speed control pin will hang off the edge; if you let the pwm speed control pin float, it defaults to full-on). These fans can be controlled via a 5v PWM signal on the pwm pin, allowing you to control the speed without an external MOSFET. I think they also have a protection against being turned completely off (so that a failed controller can't possibly turn the fan off completely)

The ones you linked to are normal computer fans, which only have +12v, gnd, and speed output. You can only control the speed with PWM by using an external MOSFET.

Any fan that does have the built-in speed control functionality will list that in it's product description; fans with that feature are more expensive.
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

Go Up