The Importance of Sharing Grounds

Due to WordPress’s abysmal handling of code blocks this blog post is now hosted at

A lot of the time on the Arduino forums we get questions regarding wiring things together. One common format is:

I want to connect my 12V powered LED strip to my Arduino but I can’t get it to communicate. I have checked all the connections and they seem fine. I have a 12V power supply for the LEDs and the Arduino is powered from the computer.

And 9 times out of 10 the first question we have to ask in return is:

Have you connected the grounds together?

And guess what the reply to that usually is? Yep:

No, do I need to? And isn’t that dangerous, connecting a 12V ground to the 5V Arduno ground?

That in itself shows a fundamental lack of knowledge about what “ground” actually is. So let’s start by clearing that up:

Ground, technically, is just a name given to a point in your circuit. That point is a point chosen by you against which all other voltages in the circuit are measured. Often it is the point of lowest potential, such as the – side of a battery, or the – connection of a power supply. Or it may have been chosen for you, such as the ground signal from the USB connection to your computer.

The 5V pin of the Arduino isn’t actually 5V – it is 5V with respect to the ground pin. Equally you could rename the 5V pin to Ground, and what was the ground pin then becomes -5V with respect to [the new] ground.

So ground has to be a single point in your circuit against which all voltages “make sense”.

Let’s take a look at the typical circuit from the original question. An Arduino connected to some 12V device (such as some 12V LEDs):


Here you can see the Arduino connected to, for example, a 5V USB charger. It could be a battery, or it could be the USB port on your computer. It matters not. Connected to that is a 12V device which then has its own 12V power supply. Now. Where is ground in that circuit?

The 5V pin of the Arduino is 5V with respect to the ground pin of the Arduino. So seen from the Arduino’s point of view ground is, in the image above, the bottom line of the Arduino’s power circuit (charger -). However, the 12V of the external circuit is 12V with respect to the – side of the 12V PSU. So seen from the point of view of the 12V device the ground is the lower side of the 12V circuit – the “PSU -” connection.

That doesn’t sound too bad, does it? Each device’s power is correct with respect to the power supply it is running off. As far as that goes, sure. However take a look at the data signal going from the Arduino to the 12V device. What voltage is that at?

Well, seen from the Arduino’s point of view, with respect to it’s ground, since it is generating the signal, it is a 5V signal. But, what about what the 12V device sees? What voltage is that signal with respect to the 12V circuit ground?

Given that voltages aren’t absolute – they are only relative to a reference point within the same circuit, it is impossible to know what the voltage is there.

There’s something more fundamental at play here though which can help you to understand it even better. In the image above there are two red arrows in loops. That is the flow of the current around the circuit (shown as conventional current flow). The key phrase there is around the circuit. Current has to flow out of a supply, through a circuit, and back to the supply from where it came.

In the circuit above the current can flow out of the 5V, through the Arduino, and back to the 5V again because there is a complete loop there. Likewise there is a loop from the 12V supply, through the 12V device, and back to the 12V supply again. But there is no such loop for the signal from the Arduino to the 12V device.  If we think of the Arduino’s output pin as a small power supply there really should be some way for the current to get out of the Arduino, through whatever it is connected to, and then back to the Arduino again. There is no way for that to happen in this circuit.

So you connect the grounds. As soon as you do that a lot of things start to happen. Let’s do that now and see how the circuit looks:


The grounds are now linked by the green wire at the bottom. Immediately we can now see a loop has appeared where the current from the IO pin can flow through the 12V device, out of the ground connection of the device, along the green wire, and back up through the ground connection of the Arduino.

In actuality the loop is a branch from the 5V power loop. Current goes from 5V into the Arduino where it splits, some to run the Arduino and some out of the IO pin. From there it goes through the 12V device, down to ground, then joins the current flowing out of the ground of the Arduino to go back to the 5V supply. It’s useful to think in terms of discrete loops though so you can get a better idea of how the ground fits into things.

Also, now, since the ground of the 5V section and the ground of the 12V section are one and the same (in a schematic all points along a line are the same point) any signals generated from the 5V side are recognisable by the 12V side as 5V since the reference point (ground) is the same for every point in the circuit.

But isn’t it dangerous?

Absolutely not. Not only is it not dangerous, it’s safer than not connecting grounds together. Since now the whole circuit has a single baseline voltage to reference everything from 12V is 12V and 5V is 5V. Without that link the voltage difference between ground on the 5V side and 12V on the 12V side could potentially be many hundreds of volts (especially when the distances between the two points is great). For fully isolated systems, such as battery powered devices, that is not a problem. For anything using power supplies though it can be quite dangerous. And that leads me on to my next point – a slight variation on the question:

I built a circuit with a 12V device powered from a power supply which is controlled by my Arduino. It all works well. But as soon as I run the Arduino from a battery instead of my computer it stops working.

This is a classic case where the grounds haven’t been connected together by the user, but there exists another path linking the grounds together. This is most often the earth connection of the computer and the earth connection of the power supply being linked together through the house wiring:


As you can see the current loop still exists, it just takes a longer route. As soon as you remove the Arduino from your computer and power it from batteries – or a power supply that has no connection to earth – the lower part of that loop disappears completely and you are back to the original circuit with only 2 loops. And it stops working.

Connect the grounds together manually, though, and you reinstate that portion of the loop, making it all work again.

So there you have it. If you have multiple power supplies in your project, whatever they may be (except in special circumstances) you must connect the grounds together for it to work. If it works without connecting the grounds together then you are inadvertently relying on some pre-existing ground connections to do the job for you, and that is likely to fail if your setup ever changes.


8 thoughts on “The Importance of Sharing Grounds

  1. RamOn

    Very nice article! Thanks! I’m totally new in electronics and the way you explain common grounds helps me a lot!!!


  2. Brad G.

    VERY Well put!!! Thank you. Yes, this fixed my problem yesterday by connecting a grd between the 3.3 and 5v devices. However, I still a little unclear relative to your setup, why does the 5V device not end up getting “charged” with 12V on the return portion of the signal. Therefore, possibly destroying sensitive components on the 5v device from the 12v? Is this where a Logic Level Shifter is put between the circuit with different voltages?


    1. majenko Post author

      The example assumes the “12V device” uses 5V signalling, or that there is some form of logic level translation in there. For example the “12V device” could be something like a relay that is switched by a low-side transistor. There’s no communication in the other direction. If there were, and that signal were something other than a 0-5V one then yes, of course you will need some form of level translation. The examples are not supposed to be schematics, merely block diagrams showing the important parts. The different voltages were chosen (they could be absolutely anything) to make it obvious that they are separate power supplies (if I’d had 5V for both then some may have assumed they were the same power supply…)


  3. Ken Kwapis

    Thank you so much for this clear explanation. I appreciated the direct address of my naive questions!

    I’m still left wondering the extent to which this applies. Specifically, is there a clear way to determine/verify what can safely be considered “ground” in an unknown circuit? Two examples:

    1. I want to connect my TV’s 5V USB port to my Arduino’s “analog in” to sense whether or not the TV is on. Say the Arduino is wall-powered. I know I need a common ground, but what if the TV is earth-grounded and the negative cable is between the TV’s +10V and +15V? Wouldn’t that end up shorting 10V to 0V? Can I check this with a multimeter?

    2. I want to use a transistor to automate a tactile switch on a foreign 12V battery-powered circuit. The switch covers a potential difference of 12V, like the battery, so is it safe to connect the switch’s negative side to ground or should I directly connect the battery’s negative side to ground?

    I expect I have a fundamental misunderstanding about something, perhaps the definition of a power supply or how “floating voltage” works. Or do these fall under the “special circumstances” you mentioned? Thank you!


    1. majenko Post author

      In both those situations I would recommend galvanic isolation. Use an opto-isolator (aka opto-coupler) to do the switching. For point 1 you don’t really care about the voltage, so putting it through an opto-isolator and making it a simple digital on/off signal would simplify your code too. For point 2 if you don’t know the internal construction of the rest of the circuit it’s better to be safe and just use an opto-isolator. If you’re not familiar with an opto-isolator it’s simply an infra-red LED coupled with an infra-red photo-transistor. One side lights the LED, the LED turns on the photo-transistor, which then passes current. Perfect for interfacing different voltages and where you don’t know quite what is going on in the rest of the circuits.


      1. Ken Kwapis

        Thank you for the response! I was unfamiliar with opto-isolators and isolation in general, so I’ve enjoyed reading up on it (and the power analog of transformers). Indeed, opto-isolators look perfect for my tasks, so I’ll have to pick up a few or try building one.

        When does this blog post apply, then?

        For the sake of argument, in point 1, how is the 5V USB fundamentally different from the 12V PSU in your example? Same for point 2, especially since I have the battery terminals exposed. I even noticed other projects designed precisely for Arduino communication using optical isolation ( when it seems they could have ensured the negative signal pin is connected to ground.

        I assume in may cases it will work, but it’s just safer to isolate? Any guidance as to how to tell for sure? Thank you!


      2. majenko Post author

        It applies when you are connecting things together where you know what they are. Typically if you have a microcontroller and a peripheral device, regardless of the voltages (I just used 5 and 12 for illustration). Such as if you are driving a 12V relay through a transistor with an Arduino, you must connect the 12V and Arduino grounds together to complete the circuit. Or if you have a 3.3V WiFi module driven by a 5V arduino and you have a separate 3.3V power for the WiFi – the WiFi’s ground must be connected to the Arduino’s ground even though it has its own separate power supply.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s