What else do i need? Start two fans every 30 minutes

Hello

I was thinking about building a automatic system which drags air through a wooden box where i got my water reservoir for my cigar humidor. Then i found out about the Arduino and i thought hey i can use that to control my fans to regulary start the air circulation in my humidor.

So this is the plan

Every 30 minutes the two PC fans starts up and then runs for 1-2 minutes before they go to sleep until next cycle.

I might invest in a LCD monitor later and a humidity sensor but that is not important at this point.

So my question is what do i need to be able to do this project?

So far i know i need these things:

  • Arduino Board
  • 2 PC fans
  • Cables
  • Power source adapter 12V

Do i need anything else?

Would anyone know where to get a similar code to the things I'm about to do?

Any help would be much appreciated!

Best Regards
John

You would want to look at some examples of hooking motors up which would as a minimum need transistor, a resistor and a diode. There's lots of hits if you Google "pc fan arduino" or similar. (You don't want to run the motor from an Arduino digital output pin: you want that pin to switch a transistor, which in turn switches the motor.)

Get that under your belt, then think about the timing. Since time-of-day timing won't matter, you could probably use the Arduino's built-in time-since-reset ability; if you do want time-of-day then you'd need to look at a Real Time Clock (RTC) like a DS1302 or DS1307.

The notes on hardware has been made. The code for doing almost exactly what you want is already downloaded on your machin under examples: : The Blink example. Just adjust the on/off times to match and which pin to use..

Except that the blink-with-delay approach is a crap way to do things, since it locks the processor into doing nothing in the delay.... but I guess if that's all the processor is expected to do it doesn't matter. Look at the blink-without-delay example too, just to see another approach.

Thanks for the input guys!

So i need a transistor and a resistor, how do i know which kind of transistor and resistor i need?

http://bildr.org/blog/wp-content/uploads/2011/03/tip120-motor-400x225.png

Is that what i need?

My last question is about the power source, i mean there's one cable for the Arduino but then i need to split up that to also run the fans? so is there some extra module that can handle this so i don't have to run two 12V adapters from my outlet?

Thanks for helping out guys it's much appreciated!

Assuming the supply can handle the current, then I guess you could chop the end off and split it using a terminal block thingy. Or assuming it's got a barrel jack male end, buy a female socket and solder the wires on the end of that, so when you plug your male end in, it effectively gives you a whole bunch of "outs".

The label on the fan should give the current. I have one that says 0.3A

Note in that pic, the diode is deliberately back-to-front: the end with the silver stripe is the cathode (-ve) but it's correct here that it's on the +ve side of the motor.

I'm no transistor guru, but if I read the tip120 datasheet correctly, it can handle 5A on the Collector, so that should be plenty. Probably overkill!

You can simplify your solution by using an Arduino clone that has an integral motor driver. For example, the Pololu Baby Orangutan is a tiny 328-based Arduino with a dual h-bridge driver that is good for up to 1A continuous (3A peak) per channel and can run off anything from 5-12V. Combine that with a 12V 1A wall wart and a fan that will run on 12V or less and 1A or less, and you have a complete solution that is also tiny and inexpensive.

To make it easy to hook up, you can use a motor shield for arduino, like this:

https://shop.ruggedcircuits.com/index.php?main_page=product_info&products_id=38

Feed the Vin and gnd on your arduino to the power pins of the shield and you can control up to 2 motors individually and have air blow in either direction. Too much for this project? A simple transistor switch works too.

JimboZA:
Except that the blink-with-delay approach is a crap way to do things,

I agree. Sometimes, though a very simple example is an acceptable starting point. (I did worry whether this will limit a new Arduino person - showing a "bad" example to start. But given the requirements in the post I think this the exception that proves the rule)

Yep- if the sketch doesn't have to do anything else there's no harm done, and it's easy, but not a good habit and something that might need to be unlearned one day.

Thanks liudr and you all!

I think I'm gonna pick up a motor shield module to do this, sounds like it's much simpler.

When i mount the motor shield onto the arduino board it will feed the motor shield with power?

I thought this would be simple because i went to a electronic course for 6 months about 14 years ago but i guess everything has been forgotten, teflon brain? :slight_smile:

Best Regards!

After you mount the motor shield on arduino, connect the Vin pin on the shield to its power + connector, connect one GND pin on the shield to its power - connector. You need to plug in a 12V AC adapter on arduino's power barrel, which is routed to Vin and gnd.

Why not use a cheap relay? They can take 240VAC or 24VDC without throwing anything back at the controller.

GoForSmoke:
Why not use a cheap relay? They can take 240VAC or 24VDC without throwing anything back at the controller.

A relay would need a transistor to drive it, however as the fans are 12V PC fans, a transistor can drive them directly.

dc42:

GoForSmoke:
Why not use a cheap relay? They can take 240VAC or 24VDC without throwing anything back at the controller.

A relay would need a transistor to drive it, however as the fans are 12V PC fans, a transistor can drive them directly.

Since the OP did not ask for a variable speed fan and Arduino can drive up to 50mA I would use direct driven 5V relay.
Of course check the spec for drive current to make sure.
I am using an 8 channel 5V relay module but I am not driving it using Arduino so I do not know nor need to know the drive current, sorry.
Cheers Vaclav

I bought relay modules that run direct from MCU input so I shouldn't just say 'relay'.

Like this:
http://yourduino.com/sunshop2/index.php?l=product_detail&p=181

With high-current relay, AC250V 10A ; DC30V 10A Size: 5 X 4.2 X 1.8 (high) cm

USE: Connect +5V and Gnd to Arduino, Connect Arduino output pin to IN.

NOTE: Set pin LOW to turn on relay, HIGH for off.

NOTE: The digital inputs from Arduino are Active LOW: The relay actuates and an LED lights when the input pin is LOW, and turns off on HIGH. See the Wiki article for how-to assure relays do not activate at power-on time.

Vaclav:

dc42:

GoForSmoke:
Why not use a cheap relay? They can take 240VAC or 24VDC without throwing anything back at the controller.

A relay would need a transistor to drive it, however as the fans are 12V PC fans, a transistor can drive them directly.

Arduino can drive up to 50mA

Not quite. The Arduino pins are designed to drive loads of up to 20mA. Between 20 and 40mA, no damage will occur but voltage will drop and it is not good design practice. Above 40mA, damage to the pin or even the whole chip is expected.

Relay modules work well, I'm fond of them and use them often. However in this case a transistor is simple, cheap, reliable, and easy.

If you really want to use a relay (and not a bulky relay module), a 5V "reed relay" typically has a low coil amperage so most can be used directly on a pin without a transistor. But, you will still need a flyback diode.

Just trying to beat the price of a shield.

With the transistor you have to have the protection diode don't you? And a resistor between Arduino and diode and another one to limit current to the fans and hey, you're almost up to 30 cents right there...

GoForSmoke:
With the transistor you have to have the protection diode don't you?

MOSFETs usually don't need diodes in low-power applications. (BJTs still need them.)

And a resistor ... to limit current to the fans

I don't think you want to limit the current to the fans. The motor windings have inherent resistance and are self-current-limiting.

The attached diagram tells you what voltage to expect when the pin is sourcing a certain amount of current.

This is the official spec sheet fig 29-353. Although 40mA is not on the diagram, the pin is able to supply up to 40mA per spec sheet. I did some tests with one of my arduinos and my results match up with the figure.

fig 29-353.pdf (145 KB)