Electronic – arduino – Motor noise interfering with I2C

arduinodc motori2cnoisepwm

I built a robot using the Arduino Due with all the sensors running at 5V over I2C. There is a level shifter on both I2C lines. The motors are controlled using a VNH5019 motor driver carrier from Polulu (which takes PWM input). The motor speed and direction changes rapidly in this particular application.

When the motors are not running, everything is dandy and the readings are fine. On running the whole robot on the ground, with the motors, it runs fine for around 30 seconds to a minute before the I2C bus completely stops responding. All the devices start to time out on the I2C bus and the robot starts catastrophically misbehaving as a result. The Arduino has to be reset. After a reset, it tends to take less time to go berserk.

I've run the motors with the wheels off the ground and I get a significantly better running time so I strongly suspect it has something to do with the current being drawn by the motors. The motors are separated from the arduino and the custom PCB I use to route the I2C signals by two layers of metal plates (presumably this provides some shielding). I have installed 0.1 uF ceramic capacitors across the motor terminals and a 220 uF capacitor on the power supply to the Arduino.

I have also placed additional pull-ups before and after the level shifter but none of this seems to stop the problem.

I'm presently at a complete loss as to what else I might do to stop motor noise.

Edit:
Some schematics (for what it's worth)
Power circuit

This circuit sends signals to the motors and provides power to the motor drivers. Vin and GND are not actually connected to the Arduino. There is are copper pours for GND and 12V on the two layers of the PCB to support the current.

Sensor circuit

This circuit connects the Arduino's I2C bus to the various components. There is a voltage level shifter from 3V3 to 5V (LS1 and LS2). The transistors are not in use.

Best Answer

EMI problems are frequent in such design and there is no a common medicine for that. One thing that must be done is gnd separation- only connect them near the power supply. Another- best possible filtering on motor drive supply. Each mesh with high current, including gate driving circuit, must be as short as possible. Maybe resistors on gates will help. Put ferrite ring on motor cable near the driver. Use buffers for i2c. Good luck!