Servo PWM with 8051

Discussion in 'Embedded Systems and Microcontrollers' started by x1222, Mar 18, 2012.

  1. x1222

    Thread Starter Member

    Oct 22, 2011

    I'm controlling my SG-5010 Towerpro Servo with my 8051 (180 degree). The pulse looks correct on the oscilloscope. But at certain angles the servo makes buzzing noises, slowly moving, less accurate, and the torque is a lot weaker, especially near the end angles near 180, but near 30 as well. The servo is connected to a 6v battery back.

    The PWM wire is directly connected to my 8051 output pin. Any idea why that would occur? Also should I be adding anything between the 8051 output and PWM? Thanks.
  2. jimkeith

    Active Member

    Oct 26, 2011
    I once had a problem like that on a phase control--it was caused by excessive interrupt processing time at certain delay angles--I solved the problem by simplifying and shortening the interrupt by moving a lot of code to the main loop

    This is how I trouble shoot such--set an unused output line at the beginning of the interrupt in question and clear it upon returning--then watch this line with one channel of your scope to see what may be happening and where...

    Hope this helps
  3. x1222

    Thread Starter Member

    Oct 22, 2011
    Thanks for the help, but unfortunately the same problem.

    I did have a lot of calculations in the interrupt, and I've moved them to the main body. The outputs and timings all look good with the scope. I'm just going to say it's the limitation of a cheaper servo.
  4. hgmjr


    Jan 28, 2005
    If you can try another servo by a different manufacturer you should be able to determine if it is a control code issue or a servo quality issue.