4WD Motor stutter problem

Posted on January 5, 2012

Yes­terday I was building a Ar­duino-based robot (with the DFRobot 4WD kit). I put it all to­gether and used the Adafruit motor shield to con­trol it with my Ar­duino. I tested all 4 of the mo­tors, and luckily I had sol­dered all the wires the same way (so that when red is + and black GND the ve­hicle drives for­ward).

4WD Robot Platform

I then pro­grammed the Ar­duino using the Mo­torTest ex­ample which fol­lows with the AF­motor li­brary. I added all 4 mo­tors like this:

AF_D­C­Motor mo­tor(4);  

Re­placed with:

AF_D­C­Motor mo­tor1(1);  
AF_D­C­Motor mo­tor2(2);  
AF_D­C­Motor mo­tor3(3);  
AF_D­C­Motor mo­tor4(4);  

And then re­place all men­tion of motor with mo­tor1and motor2,3,4. Like this:




After I had done that I tested the ro­bot. All went well, but as the robot ap­proaches max ve­locity it simply stopped. I fig­ured that it was prob­ably due to the Ar­duino and mo­tors using the same power source (i used the black hopper on the motor shield). So I re­moved the hopper and added a sep­a­rate power source for the Ar­duino. It fi­nally worked, but soon more prob­lems arose.
The mo­tors started to stutter when the ve­locity was high. After some re­search I found out that the problem was that the mo­tors cre­ated elec­trical charge when moved, which caused them to stut­ter. I found a simple so­lu­tion for this: add a 100nF ca­pac­itor to each mo­tor.
100nF capacitor
Solder them on to the motor (so that one pin goes to the pos­i­tive-­side of the motor and one to the neg­a­tive-­side of the mo­tor). This will re­duce the stut­ter­ing. This worked like a charm for me! Now I can fi­nally start working on my Ar­duino-based room cleaner.

blog comments powered by Disqus