My robot project uses two continuous rotation servo motors to drive two wheels. I am using two 5V, 3A UBEC’s. One UBEC is for the Arduino. The other UBEC is for the servo motors.
After doing some reading and trying to fix my two servo jitter problem, I read some more, mostly from this forum. I was going to post a question on how to fix the jitter problem with my two servos using an Arduino Uno compatible mcu.
There was some talk of using the Adafruit servo library. It helped when I wrote a test program for the new library. The program just ran a loop and here is the relevant code called from the loop:
for(int count = 30; count < 150; count++)
Serial.print("left wheel, count = ");
Serial.print("right wheel, 180 - count = ");
Serial.println(180 - count);
The motors stopped approximately when they were supposed to, around the 90 mark.
Then I wrote an even simpler test with the following code:
servo_right.write(90); // ==> 120 rotates the right motor forward (looking at it from its
This is where I ran into problems again. I read about a number of things; twisting wires together, adding a 470uF capacitor across the power, using a servo shield, etc. I tried the a 220uF cap but that did not work.
Then it occurred to me that the purpose of the capacitor is to smooth out any power surges and supply extra current to top up when the power dips below a level. My two servos always would stop jittering when I removed one signal lead from the Arduino. The servo that was left would work fine. It was the same when I removed the other signal line to operate the other servo. The thought that this brought to mind is that maybe the 3A supply from the one UBEC was not enough. Either that, or the UBEC is not actually supplying 3A and the two servos need it.
Another UBEC added to the project fixed the problem. The battery pack and batteries can handle the extra current draw. Both functions used to test the servo motors work as expected. Now there are three UBEC’s, one for the Arduino and one for each servo motor. I suspect that I will no longer have problems of this sort when I work through the rest of the program.
I could try measuring the current used by the servo motors and be sure of how much current is needed but that is for another day.
I hope this helps.