If i want to hook up an external power supply to my existing circuit, say to run a motor, and it needs 12V - once i have it hooked up can I lead the negative of the 12V supply into the Arduino’s ground? Or will this “force” current in and blow something?
Thanks. I’ll go read those articles.
At the moment I’m going to use a relay.
Then no you don't need to connect the grounds. You will need some means of driving the relay though as most aren't suitable to be directly driven from an arduino pin.
Assuming i was using a transistor, I’m still a little confused though as to how you can put a higher volt into a low volt circuit GND. Is it just because the Arduino regulates it?
I am a bit confused as to what you are asking.
The arduino has a built in power regulator that cuts the jack socket voltage down to 5V. You can't put a higher voltage into the pins or switch a higher voltage without using a transistor.
Here's a drawing from another post
The VCC can be any reasonable voltage up to the rating of the transistor, the 1k resistor would be your motor, the 10k would be smaller, and GND has to be common between the two power supplies.
If however you use a relay the two circuits are independant and the GNDs don't have to connected (but no harm done if they are either). If you use a relay though you will almost certainly have to implement the above circuit to drive it unless you are using a very small relay.
Ok cool. So I can use the common grounds from the different supplies, only because the Arduino has the regulator? If I had an “unprotected” circuit I wouldn’t be able to do it?
Let’s assume I’m not using the Arduino… and if my assumption above is incorrect…
The way I see it is… 5V comes from supply1, which goes to the transistor to switch the 12V from supply2. The (-) from supply1 goes into ground at 5V, and the (-) from the 12V goes into the same ground. which means I’m putting the 12V into the 5V circuit. And this would be bad?
The (-) from supply1 goes into ground at 5V, and the (-) from the 12V goes into the same ground.
which means I'm putting the 12V into the 5V circuit. And this would be bad?
It would be bad if indeed that's what you were doing but the only real connection between the two is the GND.
I can't describe circuits with words so here's another (and I hope a clearer) pic.
Note that at no time does the 12v (the red wire) get anywhere near a 5v device (unless you screw up while breadboarding :)).
The circruit may need other components depending on what the load is, but that's the general idea. Note also that if you use a relay things will be slightly different.
Again take a look at this and see if it explains things for you:-
It shows why you need a common ground when using two supplies.
Graynomad: That makes sense, thanks. If you wouldn't mind I would like to see your relay pic as well :)
Mike: Yeah I read that a couple times. It makes sense to me. I was just concerned that current was going to get into the wrong circuit somehow.
If you wouldn't mind I would like to see your relay pic as well
I was about to do another drawing when I realised that I would do pretty much exactly what is shown in the bottom diagram in the page Grumpy pointed to.
In this case the "load" is the relay coil and the "extra component" I mentioned is the diode across the coil.
If you do that then the NC/C/NO contacts of the relay are isolated from everything and can be used to switch whatever you like up to the rating of the relay.
I appreciate the diagram on the link doesn't show how to hook up the relay contacts though so I'm still happy to do another drawing to show this if you need it as they may or may not be connected to your 12v.
Ok no, if it's the same then you don't need to worry. Thanks.
With a relay, you potentially have THREE power supplies. 5V for the arduino itself, a power supply that matches the relay coil voltage that must share a common ground with the Arduino (assuming the popular transistor driver as shown here), and a power supply for your final load that does NOT need a common ground with the Arduino or relay coil.