3
\$\begingroup\$

I'm have grounding problems (80% sure of it). I have an MPU6050(gyro sensor which works on 3.3V) which is powered by the Arduino's 3.3V pin and SCA,SCL,INT pins are used with the I2C bus of the Arduino Uno which I believe is also 3.3V, and finally the ground is connected to the Arduino's ground. All works well now, I get raw values which is processed into angles and finally printed in the serial monitor. So far so good. Here comes the big problem, the minute I connect a 12V lipo's ground to the arduino ground the MPU6050 stops responding. Clearly the battery is producing some sort of noise to the arduino , I'm using the lipo to power a motor driver (L298) which controls two motors. If I separate the ground(motor driver i.e battery) from the arduino the motors do not respond, clearly they need a common ground to work in harmony. Will adding a capacitor in series with the ground of arduino and motor driver solve this problem? If yes, of what value? [I've attached Fritzing breadboard schematic,I dint get the exact battery part so I've just attached a random battery. The battery I've used in my setup is 11.1V 2200mah]

And here's a link to my motor driver specifications : Link

enter image description here

\$\endgroup\$
25
  • \$\begingroup\$ You need to tie all grounds together. It would work. I have same setup i.e. Motors, arduino, LiPO, MPU6050 \$\endgroup\$
    – ammar.cma
    Nov 9, 2015 at 11:04
  • 1
    \$\begingroup\$ We don't know what you are doing (schematics, connetors, measurements etc.) so it needs quite a bit of clairvoyance to figure out how to fix that. \$\endgroup\$
    – PlasmaHH
    Nov 9, 2015 at 11:05
  • 1
    \$\begingroup\$ That doesn't sound like grounding issues, it sounds like decoupling. Like PlasmaHH implied, we really need to see your schematics. \$\endgroup\$ Nov 9, 2015 at 11:06
  • 1
    \$\begingroup\$ @Vorac Actually fixing the source of the noise (probably insufficient decoupling, but it's impossible to say without a schematic) would be a better idea than throwing isolation at it. \$\endgroup\$ Nov 9, 2015 at 11:23
  • 1
    \$\begingroup\$ @RakshithGb What's powering the gyro and Arduino? Does the gyro function if you have everything wired up as described, but don't move the motors? \$\endgroup\$ Nov 9, 2015 at 12:09

2 Answers 2

4
\$\begingroup\$

First, the arduino's I2C bus is 5V. You have no guarantees that it'll work with a 3.3V device. So you were already living on the edge before adding the motor. Best case scenario, the MPU6050's 3.3V are not considered high by the arduino. Worst case, the arduino's 5V fries the MPU6050. You should use some kind of logic shifter or, at the very least, add a ~330 ohms resistor in series with the I2C bus to guarantee that when the arduino outputs 5V, the MPU6050's internal protection diodes survive (don't quote me on that though, the MPU6050's datasheet says nothing about this. For all I know, it could go singularity when you show VDD+0.5V to its I2C pins)

Now, assuming you don't care about that, you just want the motor to not influence the rest of the circuit: the reason you need to connect the grounds is because when the arduino sends a 5V signal, the driver has to understand that it's a 5V signal. It does so by comparing the signal's voltage to its own reference (GND pin). If the grounds are disconnected, the voltage the driver "sees" will be random, since the driver's ground could be, say, 2V above the arduino's ground, completely messing up your logic. The problem is that your motor is probably making a lot of current flow through this ground path, making some voltage drops appear on it.

Voltage drops in the ground path happen in every circuit. The problem is when two components are attached to the ground path in different points, causing them to "see" different grounds, and so they disagree on the logic levels. This is probably your problem: the inertial unit and the arduino see very different grounds when the motor produces a current pulse, and that's enough to make the logic mess up.

You could: (in order from less work to more work)

  • Add a big capacitor between the driver's +12V and GND terminals to supress pulses.
  • Assuming Add the 330R resistors I mentioned earlier: they should make the '1' logic level signal more robust (because of the arduino's I2C pull-up. See this). Also, safer. I'm assuming a pull-up resistor on the MPU6050's board.
  • Add a resistor between grounds so that the rise in one of them does not affect the other so much. Problem is, the driver uses the other ground, so it could stop understanding the arduino's control signals.
  • Connect the battery's GND to the USB's GND, so both the arduino and the MPU are not so far apart in the ground path. Bad dangerous idea, you'll fry your USB, don't do it at all.
  • Use the damn logic shift circuit.
  • Use an optoisolated driver. This way, you don't need to connect the grounds.
\$\endgroup\$
6
  • 1
    \$\begingroup\$ A series resistor on the I2C lines would be pointless; I2C is an open-collector bus, so all current when high is sourced via the pullup resistors already. \$\endgroup\$ Nov 9, 2015 at 13:31
  • \$\begingroup\$ Also, your point about connecting the battery ground terminal to the MPU(?) doesn't make any sense. \$\endgroup\$ Nov 9, 2015 at 13:32
  • \$\begingroup\$ please check the link i posted. Point is, in this setup, the MPU's 3.3V pull-up is a lot stronger than the arduino's internal 5V pull-up, so the open-collector voltage is closer to 3.3V than 5V. 3.3V is below the arduino's 3.5V guaranteed high-level voltage. By adding the 330R, both could be happy with the open-collector voltages they see. \$\endgroup\$
    – FrancoVS
    Nov 9, 2015 at 13:36
  • 1
    \$\begingroup\$ According to the MPU6050 datasheet, it does not provide pullup resistors. His breakout board might, but he hasn't specified. \$\endgroup\$ Nov 9, 2015 at 13:39
  • \$\begingroup\$ FrancoVS is right about the I2C bus frying the MPU6050, but my MPU6050 breakout has some resistors on it, my vendor doesn't know of what value. However I did add the 330ohm resistors in series and guess what happened? Everything started to run slowly on the gyro. So from this I understand my breakout must have sufficient pull ups. I can't even measure the right value cuz the components are too closely surface mounted. \$\endgroup\$ Nov 9, 2015 at 13:53
0
\$\begingroup\$

@RakshithGb Fixed his problem, but He ask me a circuit example using SI8660.

Because of confidentiality issues, I can't post the exact circuit, but this sketch shows an application of the digital isolator. It's only a simplified version.

enter image description here

The history of this circuit is that it has a UI and because of security issues is not recommended that's interface has some physical connection (grounds or power supplies) with the power part (half-bridge). To avoid any damage to users.

Then, We think about it. What's the best way to isolate low power circuit (control circuit) from power circuit?

Another AC/DC isolated power supply was used as solution. Check out the sketch: PGND and GND are not physically connected.

The current transformer and the safety relay are already isolated by nature. However, the relay signal is applied through SI8660 because it converts the signal in a range between 0 and VDRV (proper to relay).

\$\endgroup\$
1
  • \$\begingroup\$ Note that this circuit shows a digital isolator and is not suitable for analog signals. \$\endgroup\$ Nov 10, 2015 at 4:03

Your Answer

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

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