Smooth control of servo motors and drive

Поделиться
HTML-код
  • Опубликовано: 10 сен 2024
  • Motors can be commanded to accelerate and decelerate smoothly to positions. In this video I show methods to drive motors simultaneously so they start/stop together and also how to control their acceleration

Комментарии • 10

  • @moriartymw
    @moriartymw 4 дня назад

    I wish to use a servo to control the traverse movement for a pickup winding machine. With guitar pickup winding there are various and varied scatter patterns used to enhance the tone produced by the pickups. The analog way of controlling the traverse pattern uses a rotating non-circular cam disk that pushes a spring loaded shaft that has a guide for the wire feeder that, in turn controls the accumulation of wire on the bobbin. I would rather use an Arduino to control the movements of the servo and therefore control the scatter pattern of the winding and have it accumulate evenly or ad-hoc in a scatter pattern on the bobbin. I am hoping to fully understand the mathematics and coding I would need to achieve my goal without overcomplicating it.

  • @SamWane
    @SamWane  Год назад +6

    Arduino Uno program for linear control:
    #include
    Servo turretservo;
    Servo gripservo;
    void setup() {
    turretservo.attach(5);
    gripservo.attach(46);
    }
    double theta1(double theta_s, double theta_e, double tf)
    {
    double a0;
    static unsigned long ts;
    static double endt;
    static double thet;
    double t;
    if (endt != theta_e)
    {
    ts = millis();
    endt = theta_e;
    }
    a0 = (theta_e - theta_s) / tf;
    t = (double)(millis() - ts) / 1000;
    if (t

  • @yannhuang6996
    @yannhuang6996 Год назад +2

    Thanks for the explanations of formulas

  • @theothergameygamer
    @theothergameygamer 3 месяца назад

    How is this an improvement over the AccelStepper library?

  • @jumbo999614
    @jumbo999614 8 месяцев назад

    Hi, I'm a beginner. I just finished assembled my robot arm.
    I want to use this code to move the servo smoothly but there is no need to loop back and forth.
    I want it to move by using value from potentiometer.
    Right now it's kind of jittering and shaking the whole body of the arm.
    How to modify your code?

    • @kirleyq1394
      @kirleyq1394 4 месяца назад +1

      That’s probably a power supply issue. Mine was doing the same thing until we fixed that.

    • @jumbo999614
      @jumbo999614 4 месяца назад

      @@kirleyq1394 Can you share your code?

  • @Francesco-mass
    @Francesco-mass 8 месяцев назад

    Hi can i have tour Word file?.thanks

  • @SamWane
    @SamWane  Год назад +2

    Servo program Arduino Mega for cubic polynomial control:
    #include
    Servo turretservo;
    Servo gripservo;
    void setup() {
    turretservo.attach(5);
    gripservo.attach(46);
    }
    double theta1(double theta_s, double theta_e, double tf)
    {
    double a0, a1, a2, a3;
    static unsigned long ts;
    static double endt;
    static double thet;
    double t;
    if (endt != theta_e)
    {
    ts = millis();
    endt = theta_e;
    }
    a0 = theta_s;
    a1 = 0;
    a2 = 3 / (tf * tf) * (theta_e - theta_s);
    a3 = -2 / (tf * tf * tf) * (theta_e - theta_s);
    t = (double)(millis() - ts) / 1000;
    if (t

  • @did3d523
    @did3d523 11 месяцев назад +2

    bad