I'm quite new to Arduino. I have build a number of projects successfully, like potentiometers, serial communication, DAC, sensors, motors etc.

I use a laptop to power my Arduino project and Atmel Studio to program and upload to the Arduino. I have created a project with 2 motors and I have successfully used a separate power supply (a transformer) to power the motors.

Now I want to continue my experiments but I'm afraid of the possibility to cause any problem to my laptop.

When I made the circuit with the 2 power sources (laptop for the Arduino, transformer for the motors) I had to connect the 2 grounds together.

So my question is that:

Can someone explain me or point me to some information about power electronics so to be absolutely sure that I won't cause any problem to the laptop?

Should I use optocouplers, or diodes etc? Is there a way to avoid the 2 grounds connection? What is the reason to connect both grounds (of the 2 power supplies) in the first place?


Connecting the grounds together is required since without that there would be no circuit for the current to flow through. Take this simple block diagram for instance:

enter image description here

In the top diagram there are two complete circuits - the green one (Arduino's 5V power) and the blue one (device's 12V power). The communication between the Arduino and the Device can't happen because there is no circuit (red).

In the bottom diagram the red circuit has been completed by joining the grounds together. That means that the current has some way to get back to where it came from (which current always has to do) so the signals you send can actually get through.

To avoid having to connect the grounds together you need something called Galvanic Isolation. This involves using some method that is not electricity to connect the two circuits together. That could be using light in the form of an opto-coupler, or magnetism in the form of a transformer, or even something even more physical like a relay. In that situation you have an arrangement like this:

enter image description here

The ground connection that was part of the red circuit above has now been sliced in half (red and orange now) and the isolation device is responsible for passing the signal from one side to the other.

Galvanic isolation is highly desirable when:

  • You are controlling a different type of current (e.g., using DC to switch AC)
  • You are working with voltages considerably higher than your drive voltage (e.g., switching mains)
  • You have different ground potentials (e.g., you have a long distance connection)
  • 1
    Galvanic isolation is also useful for long cable runs. For example, MIDI uses optocouplers. With a long cable, you might get earth loops. – Nick Gammon Sep 20 '15 at 22:29
  • @NickGammon Isn't that what point 3 in my answer says? – Majenko Sep 20 '15 at 22:40
  • Oh yeah, sorry. Well I'll let it stand because it mentions MIDI. I didn't quite pick up "long distance connection" as "long cable run". Plus I threw in the "earth loops" keywords. :) – Nick Gammon Sep 20 '15 at 22:52
  • @NickGammon Can't hurt ;) – Majenko Sep 21 '15 at 0:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy