Controlling the position of a continuous servo with a potentiometer and arduino

Поделиться
HTML-код
  • Опубликовано: 18 окт 2024
  • I try here to control the position of a Parallax continuous servo with a potentiometer and Arduino nano board. I use here two different codes: first I check and take note of the exact middle point (where the servo stops), than I put this value on the second code to control it. As you can see the problem with this kind of servos is that you can’t express rotation in degrees so there is no angle feedback. In conclusion the positioning will be very approximately. Do you know a better way?
    Servo:
    PARALLAX STD PM BB HT HS
    Codes:
    drive.google.c...
    Basic wiring:
    www.arduino.cc...

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

  • @OMNI_INFINITY
    @OMNI_INFINITY Год назад +4

    This! Thanks! Was wondering why servos seemed so basic.

  • @colinkral4972
    @colinkral4972 Год назад +1

    You are a life saver

  • @carlosandressaldana8855
    @carlosandressaldana8855 3 года назад +2

    You are the best !!!!!!!!!!!!!!!!!!! Love u !!!!!!! :D

  • @henriquecoala2723
    @henriquecoala2723 2 года назад +4

    Hi.
    very good video.
    I got a question, should I start the variable "potStop" with what value?

    • @sandrolab
      @sandrolab  2 года назад

      Hi, thanks. The ‘potStop’ value starts at zero, such as ‘potVal’ and ‘servoStart’.

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

    Could you use millis() as a way of limiting the rotation? Is the speed and acceleration of the motors at a given pulse width consistent enough?

    • @sandrolab
      @sandrolab  Год назад

      It could be. But as I said, for that kind of precision I would use a different coding approach (see the library indicated in the description)

  • @sWetPlays
    @sWetPlays 2 года назад +1

    Is the acuraccy good enough ? I was thinking about using this method instead of stepper motor for controlling lens focus. What do you think ?

    • @sandrolab
      @sandrolab  2 года назад +2

      No, I think steppers are much better for your purpose. Servos are notoriously inaccurate, especially these one.

    • @sWetPlays
      @sWetPlays 2 года назад

      @@sandrolab OH ty for Fast reply I tried The small cheap stepper 28byj-48 but when I hold The shaft with my hand it started to spin other direction 😂 So I guess that motor Is too weak ? I am thinking about NEMA 17 17HS4023 0,14Nm do you think it is good ? Ty

    • @sandrolab
      @sandrolab  2 года назад +1

      The 28byj-48 is absolutely too weak for focusing a lens. Go ahead with NEMA 17 - no regrets! There are also a lot of good projects and tutorials out there.

    • @sWetPlays
      @sWetPlays 2 года назад +1

      @@sandrolab Thank you so much ! I am now deciding between NEMA 17 17HS2408 or NEMA 11 11HS2810 I need smallest possible version, that would be strong enough

    • @peterdenes6353
      @peterdenes6353 2 года назад +1

      Thank you all, this has been useful for me as I too am building a focus puller!

  • @sacheth2517
    @sacheth2517 2 года назад +1

    Bro.. Please help me out..
    The servo is rotating continuously.. The rotation is not corresponding to the potentiometer value.. Just the speed of rotation is being affected i think.. I used the same code and same connections as shown in the video..
    What should I do?

    • @sandrolab
      @sandrolab  2 года назад

      Did you try the first code for testing out the exact position of stop?

  • @chakradharv5118
    @chakradharv5118 11 месяцев назад

    What is 65000 in the code , can u explain why 65000 is used for, this would of great help.

  • @nikan9126
    @nikan9126 Год назад +1

    Hey man, cool video!! If you still have your code could you update your description link… It doesn’t seem to be working

  • @theonlyplaymaker8725
    @theonlyplaymaker8725 3 года назад

    Could I use a micro servo (180 degrees) to control the position of the Potentiometer, and program it to represent every degree of movement of the micro servo/pot as 2 degrees of movement on the continuous servo? I need 360 degree of positional control for a project, but I don't wanna spend $60 on a sail winch servo, or program an encoder. Any suggestions ?

    • @sandrolab
      @sandrolab  3 года назад

      You can try working on speed variable and do some calculations. The problem with this kind of servos is that you can’t express rotation in degrees and there is no angle feedback. So as you can see here, the positioning is very approximately.

  • @unknownmultipurpose9178
    @unknownmultipurpose9178 Год назад

    I have a question can I use the same code for Arduino Uno too ? And also can I use two servos and potentiometers in the setup ?

    • @sandrolab
      @sandrolab  Год назад

      Sure, you can use the same code for the Uno and with two servos as well (because both would be powered externally)

  • @Jimmy-rv5dh
    @Jimmy-rv5dh 7 месяцев назад

    hey man, just wondering if you could upload an updated link for the code? i was feeling pretty hopeless about this project im doing until i saw this :C

    • @sandrolab
      @sandrolab  6 месяцев назад

      github.com/sandrolab/continuous-servo-pot-control

  • @carlosandressaldana8855
    @carlosandressaldana8855 2 года назад

    Hello !! Continuous rotation servomotor can be controlled without potentiometer? Thanks !!

    • @sandrolab
      @sandrolab  2 года назад

      Hello! You can use writeMicroseconds() to control it in any way, although you can’t get an accurate position with any angle reference.

  • @remi19999
    @remi19999 2 года назад

    I am working on something like a vending machine in my graduation project and I am using cont. rotation servo motor but I discovered that the position is not fixed even when I specify an interval for it, the position changes. Is there any solution in your opinion? can I use something like this to fix the position by potentiometer I want to hear from you

    • @sandrolab
      @sandrolab  2 года назад

      I'm afraid not. You can’t be very accurate with a continuous servo. Try this library: github.com/akupila/ArduinoContinuousServo

  • @domtoretto9809
    @domtoretto9809 3 года назад

    What is the difference between using a normal motor and a continuous servo?
    And
    How to differentiate between a normal servo and continuous servo?

    • @sandrolab
      @sandrolab  3 года назад

      The servomotor has higher torque because of gears inside of it, and consequently it turns much slower than a normal motor.

  • @kentavarxd5820
    @kentavarxd5820 Год назад

    Link with codes has been expired. Could you refresh it or give another in the comments, please!

    • @sandrolab
      @sandrolab  Год назад +1

      github.com/sandrolab/continuous-servo-pot-control

  • @abungsubangga-ou9by
    @abungsubangga-ou9by Год назад

    codes link is not found. can you reupload ?

  • @kifahzaidan4505
    @kifahzaidan4505 2 года назад

    Hi,
    Thanks a lot, its really greate effort and great knowledge.
    i need to do a project for a preset position linear actuator with a DC motor abd a stepper motor, with Arduino Mega or UNO but i am not able to write the code and the scheme, can you please help.
    Regards

    • @sandrolab
      @sandrolab  2 года назад

      Please contact me in private.

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

    I really need the code for position control.... And the drive link is not working 😢.... Please help @sandro

  • @Iam.paradox-35
    @Iam.paradox-35 3 года назад

    Can you share the code please? I'm working in a project that needs position control on the servo. Thanks!

    • @sandrolab
      @sandrolab  3 года назад

      Check the description!

    • @remi19999
      @remi19999 2 года назад

      Have you reached a solution to control the position of the servo? share me if you don't mind.

  • @lymzlyrics4257
    @lymzlyrics4257 2 месяца назад

    can you share schematic from this ?

  • @printerautomations
    @printerautomations 2 года назад

    Which servo motor is this and what is the exact model?

    • @sandrolab
      @sandrolab  2 года назад

      PARALLAX STD PM BB HT HS

  • @JhonBhenzzonSaure
    @JhonBhenzzonSaure Год назад

    your code link aint working

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

    update Drive link please, it is not working

  • @domtoretto9809
    @domtoretto9809 3 года назад

    I have a servo name"tower pro mg 996r" is it continuous servo?

    • @sandrolab
      @sandrolab  3 года назад

      No, it should be 180 degrees.

    • @domtoretto9809
      @domtoretto9809 3 года назад

      It is a big servo

    • @domtoretto9809
      @domtoretto9809 3 года назад

      Can you give me a arduino code to test it out if it is a normal servo or continuous servo? Plz

    • @sandrolab
      @sandrolab  3 года назад +1

      @@domtoretto9809 www.arduino.cc/en/Tutorial/LibraryExamples/Sweep

  • @dansv3872
    @dansv3872 3 года назад

    Can I do this with any 360 servo?

    • @sandrolab
      @sandrolab  3 года назад +1

      Yes, only if you intend 360 "continuous" servo.

    • @dansv3872
      @dansv3872 3 года назад

      @@sandrolab I got one that says 360 a cheap mg996

    • @sandrolab
      @sandrolab  3 года назад

      @@dansv3872 In that case you probably don't need this code.

    • @heisenberg7722
      @heisenberg7722 2 года назад

      @@sandrolab Hello, Can you tell me how the code is gonna be different ? thank you

    • @sandrolab
      @sandrolab  2 года назад

      @@heisenberg7722 Here: docs.arduino.cc/learn/electronics/servo-motors

  • @OMNI_INFINITY
    @OMNI_INFINITY Год назад

    *Can repost the code files? Thanks in advance!*

    • @sandrolab
      @sandrolab  Год назад

      Check on the GitHub link in the description

    • @OMNI_INFINITY
      @OMNI_INFINITY Год назад

      There isn't a github link. That was why asked. There was a google drive link, but that link showed a 404 error. @@sandrolab

    • @sandrolab
      @sandrolab  Год назад +1

      @@OMNI_INFINITY github.com/sandrolab/continuous-servo-pot-control

    • @OMNI_INFINITY
      @OMNI_INFINITY Год назад

      Saw now. Thanks! @@sandrolab