2
\$\begingroup\$

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.

\$\endgroup\$
  • 1
    \$\begingroup\$ Could you post some graphical materials, such as draw a schematic with the tool on the forum or post pictures. Please include some information about how different things are grouped or connected. If everything is proper it should work fine, but there might be a small mistake anywhere. Also 100nF across a motor that moves a robot isn't going to do much at all, far too little power can be stored in that to make any difference. \$\endgroup\$ – Asmyldof May 30 '15 at 11:41
  • \$\begingroup\$ Even if its a small 12V motor with a stall current of 2A? \$\endgroup\$ – Dr Coconut May 30 '15 at 11:49
  • \$\begingroup\$ It'll be an earth/0V problem made worse by potentially poor routing of the IIC bus. The motor capacitor is a red herring - if you are using PWM to control the motor there is a likelihood of destroying the controller by increasing capacitance. \$\endgroup\$ – Andy aka May 30 '15 at 12:11
  • \$\begingroup\$ If you have an oscilloscope, can you post screenshots of the I2C bus at both ends when running on the ground? \$\endgroup\$ – Techydude May 30 '15 at 12:15
  • \$\begingroup\$ @Andyaka Routing the I2C bus and the motor power are handled by separate PCBs. 0V of the controller and motors is only connected at the battery terminal. The motor is controlled through a proper motor driver that uses PWM as input. The arduino and all the sensors are all still powered on and sensors over serial continue to work. Usually, it's just one of the i2c buses that stops responding entirely. \$\endgroup\$ – Dr Coconut May 30 '15 at 13:09
2
\$\begingroup\$

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!

\$\endgroup\$

Your Answer

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

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