I have a robot with an Arduino Mega that gets data from a bluetooth module and sends it to an Arduino Leonardo to activate some functions. It all works amazing but only if the boards are connected to my computer. As soon as I disconnect them and power them from their own batteries, the serial communications seems to stop working. When I connect it to the PC again the communication between the Arduinos begins working.

Does anyone know why this is happening?

The Mega is powered by a 9V battery and the Leonardo by 4x AA (6V). On the Mega I use TX/RX(2) for communication with the BT module and TX/RX(3) for communication to the Leonardo.

  • By "stop working" do you mean the RX / TX LEDs don't blink? They never do unless the board is powered by USB. Commented Jun 22, 2015 at 18:00
  • Nope,from the Arduino Mega I am using TX2/RX2 to communicate with the bluetooth module, and TX3/RX3 to communicate with the arduino leonardo. by not working I mean that the arduino leonardo stops getting data from the MEGA. This only happens when I use a power bank or 9V Battery instead of connecting it directly to the Computer Commented Jun 22, 2015 at 18:03
  • Can you draw a diagram of how they're connected together? It might be that you need to pair the Mega ground to the Leonardo ground, otherwise the voltages will be all at sixes and sevens. Commented Jun 22, 2015 at 18:09
  • So the problem may be the change of voltage? Commented Jun 22, 2015 at 18:10
  • 2
    Connect any GND pin from one board to any GND pin on the other. Commented Jun 22, 2015 at 18:32

1 Answer 1


Voltage, Electrical Potential, Potential Difference, Electric Tension - whatever you refer to it as - is the always measured between two points.

Generally of course we mean two points within one circuit, and most of the time we mean between something and the circuit's 0-Volt rail; it's implied whenever somebody quotes a voltage, unless they specifiy otherwise.

We always refer to the 0-Volt rail as 'ground', no doubt stemming from the term 'earth', which is literally a connnection into the ground itself. In the case of a battery powered circuit, the 0-volt rail is only 0 Volts referenced to the rest of the circuit. In such a circumstance, the circuit's ground is said to be floating when referenced to another circuit. Thus, two circuits with independent power supplies and no interconnection cannot be compared to one another in sense of voltage.

This typically doesn't matter, but when you need to interconnect independently-powered circuits you run into a problem. As both grounds are floating, any other voltage on each circuit is referenced to said floating voltage, and therefore is also floating. This makes wired communication between them impossible.

Unless you create a voltage reference between the two.

Simply connect the ground rails of each together; the cicruits are then referenced to one another at 0 Volts. It doesn't have to be the ground rails that are connected - any two points connected together will allow you to reference any point on board A to board B and get a correct potential difference. However, it's pretty useless doing that except in some odd situations.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.