Shop OBEX P1 Docs P2 Docs Learn Events
Can not calibrate servos — Parallax Forums

Can not calibrate servos

trelozakinthinostrelozakinthinos Posts: 13
edited 2017-02-08 20:11 in BASIC Stamp
Hello,
I have two servos for my robot and I read that I must calibrate them because it is very difficult to have the same speed both!
So I give them maximum values (500, 1000) and I see for example that the right servo is faster so I reduce its value until it goes straight.
The problem is that while I test the new settings it starts to turn to the opposite way (eg the left servo is faster).

I also made a programm that it turn the wheel only one time. I made a mark and I found the time it needs for the turn. But testing the same settings again and again I found that it is not accurate. Sometimes it was exactly on the spot and other was before or after the spot.

I wonder if this is normal. If it is not what could possibly wrong? The voltage is 5.59 (4*1.5V).
It is my first time I am working with servos

Comments

  • PublisonPublison Posts: 12,366
    edited 2017-02-08 20:56
    What platform are you running the servos on? Boe Bot ?
  • No, it is DeAgostini's robot (it was in Greece weekly based magazine with parts). Check my signature and profile picture for more info! I do not know what you need more! :)
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    Continuous rotation servos are modified from their original design and cannot go to a specific point. Even when you pulse them the same number of times you will be off a little each time to to over/undershoot and/or variations in the circuitry that adjusts the speed. You may also need different values for reverse than you use for forward (you can't just reverse them) to adjust trim.
  • Continuous rotation servos are modified from their original design and cannot go to a specific point. Even when you pulse them the same number of times you will be off a little each time to to over/undershoot and/or variations in the circuitry that adjusts the speed. You may also need different values for reverse than you use for forward (you can't just reverse them) to adjust trim.

    Yes I know about the reverse! But it is very odd that sometimes the right it's faster other is slower and other the same.


  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    Depending on the age of the servos it could just be normal wear causing your issues...binding in the gears...erratic contact in the brushed motors, etc.
  • There are at least 10 years old but first time working now! All that years were at the closet! So as I understand there is nothing I can do, right?
    Except of buying new ones!! :)
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    Yeah, if you're having as bad of issues as you describe, I would imagine the age of the servos is a contributing factor.
  • The way you calibrate the servos is to send them the neutral/stopped signal. Then you adjust them so they're not spinning. Is that what you're doing?

    Any open loop system is going to be subject to this. Brand new servos may help, but you won't get it to track perfectly straight without some kind of feedback.

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    @xanadu - He seemed to describe them changing speed after calibration.

    @trelozakinthinos - It occurred to me that I had also seen this once before from someone and what I eventually found out was that they were not pulsing the servos every 20 ms, but rather overdriving them within the main loop. Can you post the code you're using?
  • I figured that was the 5.59 V possibly dropping out, or bench testing unloaded servo motors that behave differently on the floor. All guesses...

    Personally, I didn't last long with 4x AA batteries in a servo driven robot. I don't know if that is what you're using. If not I would try to get a 5x AA pack, or LiPo pack and charger.

    Do you have a link to the DeAgostini Robot?

  • This is my test/calibration code.
    First I try to make it go forward, after this backward and then by changing the counter to make exactly 180 left and right.
    But when I realise that I couldn't calibrate the forward command I gave up because of the changes every time it was running.
    If I give 750 both servos it is not moving.
    I have 4*1.5v lr6 bateries that there are also 10 years old (but gives 1.5+volts).
    Unfortunattely there is no site of DeAgostini anymore :(
    Here is a video of the Italian (and original) DeAgostini's robot commercial
    ' {$STAMP BS2}
    ' {$PBASIC 2.0}
    
    left_servo CON 12
    right_servo CON 13
    
    stop_right CON 750
    clockwise_right CON 500
    anticlockwise_right CON 1000
    
    stop_left CON 750
    clockwise_left CON 500
    anticlockwise_left CON 1000
    
    downtime CON 20
    
    counter VAR Word
    pbin VAR IN2
    
    LOW left_servo
    LOW right_servo
    
    start:
      IF pbin=1 THEN start
    
    main:
      GOSUB forward
      GOSUB still
      GOSUB right
      GOSUB still
      GOSUB left
      GOSUB still
      GOSUB backward
      GOSUB still
      GOTO start
    
    forward:
      FOR counter=0 TO 100
      PULSOUT left_servo,anticlockwise_left
      PULSOUT right_servo,clockwise_right
      PAUSE downtime
      NEXT
      RETURN
    right:
      FOR counter=0 TO 100
      PULSOUT left_servo,anticlockwise_left
      PULSOUT right_servo,anticlockwise_left
      PAUSE downtime
      NEXT
      RETURN
    backward:
      FOR counter=0 TO 100
      PULSOUT left_servo,clockwise_left
      PULSOUT right_servo,anticlockwise_right
      PAUSE downtime
      NEXT
      RETURN
    left:
      FOR counter=0 TO 100
      PULSOUT left_servo,clockwise_left
      PULSOUT right_servo,clockwise_left
      PAUSE downtime
      NEXT
      RETURN
    still:
      FOR counter=0 TO 100
      PULSOUT left_servo,stop_left
      PULSOUT right_servo,stop_right
      PAUSE downtime
      NEXT
      RETURN
    
  • kwinnkwinn Posts: 8,697
    Even bad batteries may give 1.5V if there is no load on them. Try 4 new batteries or measure the old battery voltage when the motors are running.
  • OK,
    Power off : 5.69V
    Power on(stand by) : 5.59V
    Servos on: 5.41V

    I guess it is no so bad, Right?
  • kwinnkwinn Posts: 8,697
    OK,
    Power off : 5.69V
    Power on(stand by) : 5.59V
    Servos on: 5.41V

    I guess it is no so bad, Right?

    Pretty good, so the problem is not with the batteries. That leaves everything else. Main problem is that mass produced motors, power drivers, etc. have small differences due to manufacturing variations, so without some form of feedback there is no way to make them behave exactly the same. Even with feedback from the wheels small differences in the wheel surfaces and road surface will make a difference. Only thing I can suggest is calibrating forward/reverse travel over a longer distance or adding encoders.
  • Wouldn't VIN minimum for any BS2 board be at least 6v?

  • I don't know what an encoder is! Could you give some more info?
    My documentation says that servos can work between 5-6V.
  • You could look them up on the Parallax site, in Learn, Obex or the store, there are a many examples.

    An encoder is a device, circuit, transducer, software program, algorithm or person that converts information from one format or code to another, for the purposes of standardization, speed or compressions.
  • kwinnkwinn Posts: 8,697
    I don't know what an encoder is! Could you give some more info?
    My documentation says that servos can work between 5-6V.

    In this case an encoder is a device that measures how fast a wheel turns. That allows you to adjust the power going to the wheels for a more precise control of the speed and direction of the robot.

    As for the voltage, the motors may work with 5 or 6 volts in, but the regulator on the BS2 may need 6V or a bit more to regulate that down to a stable +5V.
  • Here is an encoder set that will work with the BOEBot:

    https://www.parallax.com/product/32501

    -Phil
  • kwinn wrote: »
    In this case an encoder is a device that measures how fast a wheel turns. That allows you to adjust the power going to the wheels for a more precise control of the speed and direction of the robot.

    I get it but does the servos purpose is to have feedback and control the turn? Why the encoder is better?

    kwinn wrote: »

    As for the voltage, the motors may work with 5 or 6 volts in, but the regulator on the BS2 may need 6V or a bit more to regulate that down to a stable +5V.

    That makes sense. I will check the dropout voltage of the regulator. And try with new batteries


  • MikeDYurMikeDYur Posts: 2,176
    edited 2017-02-16 13:55
    I get it but does the servos purpose is to have feedback and control the turn? Why the encoder is better?



    A servo is basically just a motor and gears. Like your car, without gps, it doesn't know where it's at. The encoder mounted on a servo keeps track of the servo's movement.

    So encoder's mounted on two servo's can be used to keep both servo's running the same speed, by monitoring the feedback from the encoder's.
  • But I know that servos has feedback .
    Is it different kind of feedback? Sorry for the questions but I try to understand what is wrong
  • That article is referring to standard servos, not Continuous Rotation servos. They are referring to the internal pot in the servo to indicate positional information. They are also talking about a special servo that has an analog output. This would not apply to Continuous Rotation servo used to drive wheels.
  • kwinnkwinn Posts: 8,697
    But I know that servos has feedback .
    Is it different kind of feedback? Sorry for the questions but I try to understand what is wrong

    What is described there is a standard servo that turns 90 or 180 degrees. It does have a potentiometer that provides a voltage that is proportional to the angle. The typical motor that drives a robot's wheels are "continuous rotation" motors that may or may not have a feedback signal. IMO if it does not have a feedback signal it should be called a "motor", not a "servo motor".
  • Read the Activity Bot page on the Learn site. It uses the encoders Phil was reffering to:

    http://learn.parallax.com/tutorials/robot/activitybot/activitybot

  • Hmm.. I see. I will reread my documentation and I ll be back! Thank you
Sign In or Register to comment.