Driving servos under high CPU load with no jitter


#1

Im running a Ranger Auriga Mega 2560 and trying to control a servo. This works fine if the processor is not doing much but if I’m scanning ultrasonic, looking for IR commands and flashing some LEDs the servo jitters like mad. I have done some research and found this is likely to be caused by the way the servo library uses interrupts to run the servos which can cause delays in the pulse hence causing the servo to jump when the CPU is under load.

Some of the discussion can be found here…
http://forum.arduino.cc/index.php?topic=48542.30

Ive found a library called servo2 …
http://www.arduino.cc/playground/uploads/Code/Servo2.zip

Apparently this uses a hardware timer to avoid the problems associated with using interrupts, the only catch is it only runs 2 servos which is NOT a problem for my case as I’m only running one servo.

I’ve been trying to integrate the servo2 library with my program to no avail. Im quite new to the whole Audrino world.

Is there any easy way to get this working? how do i need to modify my code to get it to work with the servo2 library? Is there another way to get reliable servo operation under load that does not require messing with other libraries?

Thanks in advance.


#2

Tough to help answer how to integrate a library without seeing your code. Usually it’s just a matter of adding the library to the Sketch and then using a #include.


#3

Thanks, I have resolved the problem by using a Pololu Mini Maestro Servo controller. Integrates with the Auriga by serial port and works great.


#4