Servo not moving the correct angle



  • I have a hobby servo connected to my duex5 and it works, but it's not turning the correct amount. It looks like it's turning about 50% of what it should be. Any suggestions?

    It looks like using the pulse width is working correctly, but not angle. I could use that, but I can't seem to get it to move in the opposite direction using pulse width. I thought maybe inverting the polarity would do it, but no luck.



  • if the pulse width is correct the issue would be the motor.

    not sure what you mean about not moving in the opposite direction, is it a continuous rotation servo or are you saying it only moves in one direction as you increase the pulse width but doesn't go back when reducing the pulse width?



  • It's a hobby steering servo from an RC car. it has a limited range. If I send M280 P3 S90, it moves 45 degrees. I was wrong about the M280 S>200 version of the command working, it still under drives the servo.

    If I send M280 S220, it moves forward, which is a timed move, not a distance move. There's no way to send a command to move in the opposite direction for 220us. I have to send M280 P3 S0 to get it to come back.

    Supposedly it has a frequency of 50, so I use M42 S1 F50 to enable it. I don't know what the S value is, I can't find a reference to an actual meaning.

    The servo also gets crazy hot. I wired it according to the wire colors on the servo. Is it possible it's wired incorrectly but still works, but incorrectly?



  • No. There is no notion of moving for 220us, there are only absolute possitions in degrees, which are encoded as pulse lengths widths.

    Edit: But i will agree that using the same S parameter for both angle and encoded pulse length can be confusing. Would be better to have different parameters for angles and pulse lengths widths.

    S220 and S90 should to the same thing if I read it correctly. Both will generate a 20us high which the motor will take as being to told to set its set point to 90 degrees.

    S1500 and S90 should to the same thing, and to go back you should use S1000 or S0.



  • @bearer it's also confusing when it's pulse length, but the docs say pulse width.



  • my bad, long night - national day celebrations here..

    It is refering to the high part of the pulse. the period is generally the same, normally 20ms/50hz, but most motors accept a little under, and a lot over.

    1000us high followed by 19ms low is 0 degrees. 2000us high followed by 18ms low is 180 degrees


  • administrators

    @bearer said in Servo not moving the correct angle:

    Edit: But i will agree that using the same S parameter for both angle and encoded pulse length can be confusing. Would be better to have different parameters for angles and pulse lengths widths.

    I copied the specification from Marlin, so don't blame me!



  • @dc42 said in Servo not moving the correct angle:

    @bearer said in Servo not moving the correct angle:

    Edit: But i will agree that using the same S parameter for both angle and encoded pulse length can be confusing. Would be better to have different parameters for angles and pulse lengths widths.

    I copied the specification from Marlin, so don't blame me!

    lol, I usually leave assigning blame to git;)

    But I get the rationale behind angles not being defined past 180 degrees for servos, and 200us being well below the 0 deg point of 1000us. Its also convenient to keep compatibility.

    In any case seems both hardware and firmware is doing exactly what it should here, so I would look into motor or wiring. OR maybe start a thread to have the output doubled to suit my wonky hardware..



  • @dc42 I was only following orders?!? Just kidding. I've seen it elsewhere, there seem to be quite a few config params like that.



  • @bearer how would it be doing what it should if it's moving half the distance? How can you rule anything out at this point?



  • Because you said it generated the correct pulse? Then again your understanding of what is correct should maybe taken into consideration, that is a valid point.



  • and what about the crazy heat. Can a wiring problem cause this behavior?



  • @bearer i don't remember saying it generated the right pulse. I don't know how to measure that. I might have misstated something. The servo spec says 110us for 60degrees. I sent S220 and it moved about 90. Which should have been 120, right?
    https://servodatabase.com/servo/traxxas/2080



  • I didn't see the (pulse width) specs in the link but if it says 110us for 60 degrees, then its not compatible with Reprap, or marlin or any of the other firmwares definitions of degrees.

    What i did see was the spec saying it needs 0.11 seconds to move 60 degrees at no load.



  • @gnydick said in Servo not moving the correct angle:

    It looks like using the pulse width is working correctly, but not angle.

    I presumed you had some sort of qualified means of determining that. My bad.



  • @bearer ah, yes, I was wrong when I said that.



  • If the servo has a standard interface you should get the same behavior with these two blocks. go to 0 degrees if not already there. wait 0-1s, go to 180 degress, wait about 0.5s, back to 0 degrees. Should sweep across the whole range, taking about 4-500ms from 0 to 180 at 5v.

    If it has different movement for the two blocks then there is something fishy, if it moves less than 180 degrees there is something fishy, if it goes back to 0 without stopping then you may want to increase the dwell but 1s should be plenty if it moves 60 degrees pr 0.11s at 6v.

    You'll need some means of measuring the pwm signal if it still doesn't behave as it should. If you have an arduino like board laying around pulseIn(PIN, HIGH, 20000); might give you some idea as to what the duet is doing. Or a scope.

    M280 P3 S0 ;0 degrees
    G4 P1000
    M280 P3 S180 ;180 degrees
    G4 P1000
    M280 P3 S0 ;back to 0
    

    and

    M280 P3 S1000 ;0 degrees 
    G4 P1000
    M280 P3 S2000 ;180 degrees
    G4 P1000
    M280 P3 S1000 ;back to 0
    


  • @bearer how is M280 P3 S90 == 180 degrees?



  • wow.....



  • @bearer the docs say for values <200 S is the angle, and I'm getting half the throw, not double. So, I'm not following.


 

Looks like your connection to Duet3D was lost, please wait while we try to reconnect.