Shop OBEX P1 Docs P2 Docs Learn Events
Standard Servo Command A Little Off? — Parallax Forums

Standard Servo Command A Little Off?

I've only tested a couple of my standard parallax servos but both are showing the same inaccuracies. 0 degree command seems ok. 90 degree command is 3 degrees off (ie 93 instead of 90). 180 degree command is 7 degrees off (ie 187 instead of 180). Actually the 180 degree command hits the hard stop on the servo.

Anyone else seeing this behavior on their standard servos?

Comments

  • That's about right for a hobby servo. You can tweak the pulses in software to achieve the angle you are after.

    For more precise servos with encoders, you have to pay a little more, such as:
    http://www.trossenrobotics.com/dynamixel-ax-12-robot-actuator.aspx
  • I think it's a mistake to use the builtin "angle" settings when using servos with microcontrollers.

    IMO, you're better off using your own conversion factor to figure out which pulse length you need to reach a desired angle.

    The range a servo moves will vary dramatically from servo to servo so you need to determine the range of motion for each servo model for yourself.

  • Thanks for your feedback. I agree with both comments. I was just trying to let Parallax know that their BlocklyProp Servo routine was a little off. Two servos were showing the exact same inaccuracies. Parallax might want to tweek their routine a little.
  • The center was adjusted, and the limits were adjusted, to prevent stalling Parallax servos. Interesting...
     * @code
     * servo_angle(pin, 0);     // for 0 degrees
     * servo_angle(pin, 900);   // for 90 degrees
     * servo_angle(pin, 1800);  // for 180 degrees
     * @endcode
     *
     * 0 to 1800 corresponds to control pulses ranging from 500 to 2300 with 1400
     * at center (90 degrees), which is slightly different from the 1500 center
     * convention, but it places the Parallax Standard Servo's range of motion neatly 
     * between its mechanical limits.
    

    What part number servo?
  • I was not able to reproduce your results. It might be your servos, but if two are doing the same thing it's more likely the code, can you post it?

    If there's noise on the signal wire or power issues you might see some other weird things going on.
  • ercoerco Posts: 20,256
    Agreed, all servos have a +/- tolerance and any angle command is an approximation at best. If you need accuracy better than 5-10 degrees, you may have to test each servo individually and map the angle vs. pulsewidth. The first thing I do with any new servo is test it to find both hard stop limits. Those values should be good for a while, although after a lot of use the internal potentiometers can wear and change values.
  • The development team could change the input values to something other than angles, like a pulse width with a range limitation. But this tool is intended to be for education (which keeps it relatively simple) but also very functional, so you'll encounter a number of design choices that favor new programmers.

    Perhaps the help file is the best place to address it. We could relate the servo angles to pulse widths a little more freely without confusing the actual code block.

    Ken Gracey
  • ercoerco Posts: 20,256
    Even with a few degrees error, I think the servo angle is more meaningful than pulse width, especially for beginners. It's comparable to Arduino code, which has the same issue:

    for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree


    Of course some servos rotate in opposite directions. No perfect solution.
Sign In or Register to comment.