Short version (in case someone's asked before and there's a link): I'm wondering if I'm running a fan or other nasty high current spikey device off an external supply, controlled by Arduino, how do the power wires hook up so both the Arduino and motor have power and can interact correctly without weird power loops or burning anything out?
Now the full version. I'm trying to do some pretty simple stuff: drive a couple 12V fans and switch some LEDs with an Arduino uno. I've found lots of info on the software and PWM part, great, and am planning to use the regular TIP120 switch to control the fan from one of the digital outputs (or maybe PWM, depending on what fan I have around).
The only thing that I'm wondering is how to connect the power. I have a 12VDC regulated supply, and a couple of wall warts around. What I'd probably do is pick one with enough current capacity and run the fans and devices off it. But the arduino? Arduino can take 12V from what I've read, so it could run off the same supply or wall wart as the fans. In the basic scenario, I'd simply hook up two cables, one goes to the circular connector on the Uno, the other to the breadboard and fans. Transistor switches and outputs on the Arduino do the rest. Is this right? Can I just hook them up both and wire it all up as usual?
Second scenario: let's say Arduino is on my desk, and the rest of the assembly in a cabinet on the other side of the room. So the cabinet has its own 12VDC supply driving everything, and the Arduino simply sends the switching signals via a cable. What do I do with the Arduino? Can I just plug in the USB power and run off that? Will doing that cause any kind of trouble, given the cabinet and Arduino have separate grounds?
3 things... 1. Power all separately. 2. Connect only the ground leads from all power supplies together unless otherwise directly indicated to be a bad idea. 3. Place an appropriate heatsink on the power transistors and appropriate means a case temp below 65 deg C. and 4. Bypass everything with really big electrolytic capacitors. a good starting point would be a 220 uF 25 V cap for the 12 V side and 100 uF 10 V for the 5 V side and increase as necessary for proper operation this means try a smaller value in parallel with the suggested part and notice any different operation If it (the cap) makes it work... better, you made a low initial choice. Double the capacitor value and run with it. If it (the cap) makes it work worse... Find out Why First as you have a very serious problem that needs to be dealt with.
Finally capacitors... Generally have no real max or min value but depend on a lot of factors; speed, current drawn, power supply current capability and most important board layout however remember that a capacitor on the power supply will if the correct value (see above) do no harm, it doesn't draw current (shouldn't) and should be considered required for a good design and very especially if battery powered. For all intent and purpose a capacitor is invisible but necessary.
(you didn't really think you were going to get off that easy did you?)
The Arduino Uno can take 12V. But the voltage regulator might get hot.
For a test it is okay, but try placing your finger on the voltage regulator. If you can't keep your finger on it, it is too hot.
You can use a DC/DC converter to convert 12V into 5V.
With heavy loads, you have to think about the ground currents. The common ground point could be the ground at the power supply. From that point the ground wires go to the the heavy loads and to the Arduino. The current through the heavy loads should not go via the ground wires to the Arduino.
You can use a separate power supply for the Arduino.
And you can use very long signal/control wires. But along those signal/control wires should be a ground wire.
If two different adapters are used, that doesn't matter. If one is actually the power from the USB bus, that also doesn't matter.
With long cables, you could use 100 ohm resistors at the outputs of the Arduino. That protects the Arduino and prevents peak currents in your cable.
About the post by Docedison: Using separater power supplies makes it easier. If someone is wrong, it is easier to find the problem. Using large enough capacitors for the power supplies is indeed important when using long wires or motors or fans.
try isolating it from the circuit using a transistor so your output pin should go to the base of the transistor (go down for more details on this but dont connect you arduino straight to the transistor unless you want to burn out the transistor XD) and the fan should be on a totally different power supply going to the collector of the transistor and the ground of the transistor should go to the ground of the arduino and the ground of the power supply (i did that and it worked fine its only if you connect it to the positive rail) but also try and find a transistor that will work for you i chose a BC338 for my application since the fan draws a huge 420mA 0.o so that was the transistor i chose also you need to do the math on what resistor you need for the base of the transistor dont connect the arduino up automatically because you will overheat the transistor and it will sizzle use ohms law if your not sure which is Ib = Ic/B(B is beta) and then work this one out RB = (Vin-Vbe)/Ib and you should be given the resistance. hope i helped but just remember isolate it otherwise something might go bang and fry your arduino.