Shop OBEX P1 Docs P2 Docs Learn Events
Arduino uno shield bot servo rotates ~ 20 degrees on power up then works correctly — Parallax Forums

Arduino uno shield bot servo rotates ~ 20 degrees on power up then works correctly

Hi,

One of the servos on my uno shield bot rotates ~ 20 degrees on power up then works correctly. I recentered the servo several times. The other servo behave just fine. OIdeas?

Thanks,

Greg

Comments

  • Maybe the Arduino is sending a rotation signal when it starts up for some reason. about how long does the rotation last timewise?
  • Welcome to the forums!

    Can you post your code so it can be reviewed?
  • /* sketch_left_servo_test */

    #include <Servo.h>

    Servo servoLeft;
    //Servo servoRight;

    void setup()
    {
    servoLeft.attach(13);
    //servoRight.attach(12);

    // Clockwise
    servoLeft.writeMicroseconds(1300);
    //servoRight.writeMicroseconds(1300);

    delay(3000);

    // Still
    servoLeft.writeMicroseconds(1500);
    //servoRight.writeMicroseconds(1500);

    delay(1000);

    // Counter clockwise
    servoLeft.writeMicroseconds(1700);
    //servoRight.writeMicroseconds(1700);

    delay(3000);

    // Counter clockwise
    servoLeft.writeMicroseconds(1500);
    //servoRight.writeMicroseconds(1500);

    }

    void loop()
    {
    }

    Thanks,

    Greg
  • Have you swapped the servos to make sure the behavior stays the same? This will help isolate between hardware and software. If it moves with the swap, probably the servo is failing or the electronics on that channel has a problem.
  • Most of my servos twitch on power up. I never stopped to figure out how far, but they all go clockwise.
  • wild guess.... Are the servo's centering themselves at power up ?

    Say you always center them in your code, before powering down your project. And then try a powercycle- do they stay almost still at the next power up?
  • There's a reason for this twitch and Andy explained it to me more than once in the past ten years. Switch your two servo port connections (and code) to P14 and P15. I think the problem will go away.

    If I recall correctly, some of the Arduino pins toggle and this is interpreted by the servo as a signal. Specifically, the Arduino has a built-in LED on P13 that toggles on startup.

    Will be interested in the results.

    Ken Gracey
  • "Most of my servos twitch on power up. I never stopped to figure out how far, but they all go clockwise" ... If the pins are floating in any way, it could be picking up 50/60Hz mains until the pins are initialized to OUTPUTS. Try a 10k pull-down resistor on the signal line to the servo in question.
  • AwesomeCronkAwesomeCronk Posts: 1,055
    edited 2020-02-07 12:57
    I experience this on the BOEBOT kit with the servos plugged into the servo headers on pins the Board of Education or on the servo headers on the PropBOE. I’ve always taken it to mean they were initializing and never thought twice about it.

    I’ve never had any issues with the servos (Parallax CR servos).
  • I have only watched several videos on Arduino code so I'm not an expert by any stretch but from what I've seen the highlighted line looks like a command. I would comment it out to see if that worked.

    * sketch_left_servo_test */

    #include <Servo.h>

    Servo servoLeft;
    //Servo servoRight;

    void setup()
  • Thanks Ken, I will give it a try! Greg
  • Ken,

    There is no server port 14 and 15 on the BOA Shield, only 12 and 13.

    Greg
  • Ken GraceyKen Gracey Posts: 7,392
    edited 2020-02-10 04:05
    2020-02-09_13-08-44.png

    Never mind the reference to DHB-10; I realize you're using the Shield-Bot for Arduino.

    Ken Gracey
    766 x 708 - 135K
  • Sorry for the delay Ken. So I take it there is no appropriate solution for the Arduino? I switched servos and sampe thing with the other servo; it seems to be a board issue rather than the servo.

    Thanks,

    Greg
  • Greg, I'm not sure you tried my solution in the most recent post I made - did you? You put them on 10/11?

    Also, there's another problem that can be introduced by building circuits on the breadboard and using any of the servo pins. Do you have any circuits on P 10/11 - on the breadboard - when you are trying to drive servos?

    Can you post a picture of your robot, up close?

    Ken Gracey
  • Hi Ken,

    I did try P 10/11, but there appears to be no power at those ports. I don't have a voltmeter to check at the moment but will next week when I return home. Is there a jumper I need to move?

    Thanks and best,

    Greg
    2448 x 3264 - 2M
  • gscermak wrote: »
    Hi Ken,

    I did try P 10/11, but there appears to be no power at those ports. I don't have a voltmeter to check at the moment but will next week when I return home. Is there a jumper I need to move?

    Thanks and best,

    Greg

    Is the Power Switch in position 2 ,(board and servos)?
Sign In or Register to comment.