Hello everyone
I'm working on a robotics project and I was having some really odd issues. Basically I have 2 DC motors that drive the robot and they are equipped with rotary encoder. I already had a 10A H bridge as well, so I decided to use two arduinos, dedicated to motion control for each wheel.
I was only testing my code on the right side arduino and everything seemed fine but when I uploaded the code to the left one, nothing worked. arduino kept getting reset and go crazy, it would lose steps and position control was dodgy. I tried literally everything you can think of:
- Swapped the motors around
- Swapped which arduino was controlling which motor
- Swapped the H bridge that was controlling the motor
- Swapped the arduinos all together!
but the only thing that seemed to actually help was wrapping aluminum foil around the cables.
I have used this exact motors and an arduino before and never had EMI issues (mind you at lower power levels. they're rated for 12v but in this case I must use a 4s battery pack , hence 16V input, for which I'm currently using a wall adapter during the testing phase).
I'm not sure where the source of the EMI is however, the motor windings? the wires that run next to each other? (the motor comes with a 6 pin header, 2 for motor, 2 for encoder phases and 2 for 5v and GND for encoders) I have wrapped the pairs separately in aluminum foil and then wrapped another layer of aluminum foil over all of those as well, which has mostly solved the issues. no more weird rests, no more going crazy, but the left motor still loses position sometimes so I'm assuming I didn't do a great job with wrapping it.
Now to the main questions:
1) Is there a way to reduce the EMI? A ceramic capacitor soldered right at the motor terminals? perhaps some back to back zener diodes rated at let's say 20V?
2) Is there a better way to wrap the wires? does some sort of emi wrapping strip exist? the kitchen foil seems too stiff or perhaps my method isn't correct?
3) Does adding a capacitor to the arduino power lines stop the potential reset issues?
Some extra information:
The wheels are DFRobot KIT0085
The H bridge is the MDD10 A
Arduinos are nano, purchased very recently (comes with the new bootloader)