Quick relay question

So I have a project where I want to be able to turn some fans on and off. They require 12V and run at 130mAh so I have the digital pins from arduino switching a relay that has a 12V power source from a wall adapter.

My question is:
I want to run this using batteries, so I have a 12V battery with the proper current running that I want to use to power the arduino but I need to use a relay still to get the right voltage and current running to the fans since arduino only outputs 40mAh. Can I use the same batter to power both the arduino and going into the relay to power the fans?

Thanks,
Adam

Hello aml25,

Sure you can, but you must take some precautions:

1-> First, driving the relay directly from arduino pins can be not good. If the relay drains more than the 40mA you can damage the chip. Even worse, when relay is deactivated some voltage spikes occur what can damage the chip also. So you need protect diodes to eliminate this, Flyback diode - Wikipedia
2-> A good option is to drive the relay from a switch transistor, connected to arduino pin, this way you eliminate any danger to the chip, like this: http://www.ecs.umass.edu/ece/m5/tutorials/relay_tutorial.html
3-> You can use Darligton transitors for this, it´s better than the mechanical approach like this: http://www.ecs.umass.edu/ece/m5/tutorials/tip122_transistor_tutorial.html Just the TIP122 is too much for your case i guess, it can be the TIP51 or even any other, must check the datasheets.
4-> Other than this just wire your circuit and the Arduino from the battery.

Disclaimer: This answer is not error proof as I am kinda new to this stuff also :wink:

Hope it helps

So I understand that a transistor must be connected to a common ground, this is what I want. You're saying a relay can be connected to a common ground as well right?

All grounds must be common, see:-

http://www.thebox.myzen.co.uk/Tutorial/Power_Supplies.html

Driving a relay :-
http://www.thebox.myzen.co.uk/Workshop/Motors_1.html

My question is why are you bothering with a relay if you are willing to drive a transistor from the Arduino output pin anyway?

Just wire the fan(s) between the collector of the NPN transistor and +12vdc instead of the relay coil. Wire the emitter to ground. Base wires via a series resistor to the Arduino output pin. Wire the 12volt battery negitive to Arduino ground pin. The transistor must of course be rated for well above the total operating current of all the fans.

Lefty