Connecting grounds together

After looking at a couple of wiring diagrams for various circuits, I noticed it seems quite common to wire the grounds of different power supplies together. E.g. for an LED strip, which draws power from a separate power supply but is controlled with a data pin from the Arduino, the ground of the LED power supply is fed through two ground pins on the Arduino. Similarly, when looking at relay circuits to control mains power, the 5v or 12v supply for the relay has a ground that's also connected to the ground of the Arduino.

My question is, as the Arduino is powered through the USB connection, is it safe to do this? And what's the purpose of doing it this way? Does it only work because the USB ground and the power supply ground are generally around the same voltage?

I think I'm right in thinking that, in theory, a power supply could have it's +ve and -ve be at, say 15v and 10v compared to the USB, and both USB and the power supply would be providing 5v (as it's the potential difference between the +ve and -ve that's important), but connecting the grounds of both together would be a bad idea, as the ground of the power supply would actually be 5v higher than the USB's positive in this case.

Is it generally just done this way as there's never usually any difference between the ground of two different power supplies (USB & external supply), as they're both connected to the same AC supply? Would there be any danger when using, say, batteries combined with USB?

Sorry if that's a bit rambling :slight_smile:

Hi,
See this page about grounding etc.

http://arduino-info.wikispaces.com/Arduino-Project-Planning-Electrical

I think I'm right in thinking that, in theory, a power supply.......

No you are absolutely wrong. Measurements of voltages are relative between two points, they are not absolute.

See this for why you need to connect grounds together. Power Supplies

Is it generally just done this way as there's never usually any difference between the ground of two different power supplies (USB & external supply), as they're both connected to the same AC supply?

Again not relevant because "the same AC supply" is isolated in the process of converting it to DC so the DC output floats with respect to any other DC output which is why you can't run into trouble like you say.

Also keep in mind that isolated circuits do NOT share grounds. Opto-isolators are commonly used for this, and you will see it on relay modules that have been designed properly. Transformers are another example, as well as fiberoptic.

Grumpy_Mike:
No you are absolutely wrong. Measurements of voltages are relative between two points, they are not absolute.

Again you show poor understanding of electronics. OP is afraid of connecting two "GNDs" which may have some (large) differential voltage. So he is speaking about differential voltage and he is somewhat right. AFAIK power supplies SHOULD be insulated from mains and floating - for supplies user may touch at least. But for example - is there any guarantuee GND of two USB ports of the same computer has the same potential?
Another problem closely related are ground loops. In short the GND wire has some resistance and noise and/or large current may cause voltage differential at different parts of the circuit. With longer wires the problem is more severe.
If you want two circuits to communicate with each other you must either connect grounds (or some other reference voltage) which may bring some problems; or you use some isolated communication which avoid those problems but is more complicated.

@gogorobot

Please excuse Smajdalf he is someone who thinks he knows about things and thinks a good way to confuse beginners is to pile on unnecessary details. He thinks he is being smart doing this but he is deluded.

He applies concepts out of context and is a prime example of a little knowledge being a dangerous thing.

The only time I have not connected all the gnd's together at a single point is when using opto isolators to isolate a circuit and when placing 2 ATX Power Supplies in series to create a 24V Output to power my LiPo Chargers