Common ground problem

Hi guys,

I have two Arduinos connected to my Alienware, both of them are using Serial communication using Python serial library. Problem is both the Arduinos are working fine when separately, but when connected together, Arduino #1 is working but not Arduino #2.

Connections are as follow -

  • Arduino #1 has a L293D chip connected to it (using it as a potentiometer where I'm controlling the voltage between 0-5V) and a relay powered by the Arduinos VCC.
  • Arduino #2 has an encoder attached to it (5v, gnd, channel a and channel b) and enables of 3 relay modules (powered from different power source).

Problem - As mentioned above, when I connect the Arduinos to the same laptop, the L293D module (Arduino #1) stops working as a potentiometer, where it was giving 3V it is not giving 0.6 V with the same code. While the Arduino #2 works fine. When connected separately, both the Arduinos work fine.

Diagnosis - I thought the laptop is not able to provide sufficient power to both the Arduinos, so I connected a 12 V supply to the Arduino #1. But it didn't work. Then after doing connections and testing at each step, I found out that when I connect the Arduino to the laptop, the ground was common for both circuits which can be a reason for this problem. Please correct me if I am wrong.

Solution - I talked to some of my friends, they told me that probably a USB isolator can solve the problem as it will isolate the ground of Arduino #1. Please let me know if this is going to work.

Links to USB isolator - AST works usb isolator - uses ADUM4160. Will this help?

Code - Note: Arduino #1's L293D circuit is used to control a motor controller of a golf cart, by changing the voltage, it is actually changing the speed of the cart. Circuit are a little complicated as they require knowledge about the motor controller. But the below mentioned code works fine, we have tested that.

// L293D connections to Speed Arduino
int enable2 = 9;
int in3 = 10; 
int in4 = 11;

void setup() {
// Enable the IC pin for motor 2
  pinMode(enable2, OUTPUT);
  pinMode(in3, OUTPUT);
  pinMode(in4, OUTPUT);

  digitalWrite(in3, HIGH);
  digitalWrite(in4, LOW);
}

void loop() {
  //  Give value in the range 0 to 255
  // 0 being 0 voltage
  // 255 being 5 voltage
  analogWrite(enable2, 40);
}

Please help me out. Thank you.

They should be on the same ground. It's the ground that the laptop has and when you connect 12V, THAT should be grounded to the same ground. You should have 1 jumper connecting GND pins on the Arduinos, you want a good solid ground.

Have you checked the motor circuit as a source of electrical noise? Is it heavily decoupled?

GoForSmoke: They should be on the same ground. It's the ground that the laptop has and when you connect 12V, THAT should be grounded to the same ground. You should have 1 jumper connecting GND pins on the Arduinos, you want a good solid ground.

Have you checked the motor circuit as a source of electrical noise? Is it heavily decoupled?

It appears from the OP's post that the L293D is connected into the circuit at a point that needs to be floating above ground. As long as only one Arduino is used, and the laptop itself is not grounded to the golf cart, then there isn't a problem, but when the 2nd Arduino is connected, that establishes a ground point and causes the problem.

The USB isolator would probably work, as long as you could provide an isolated power supply for the Arduino (an isolated DC-to-DC converter), or there are companies that sell opto-isolated L293D boards, but there would still be the need for the isolated DC for that board.