element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum Montana Kid's Robotics Club Continuous 2 servo locomotion Is there a way to command the servo to completely stop?
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 5 replies
  • Subscribers 386 subscribers
  • Views 953 views
  • Users 0 members are here
Related

Montana Kid's Robotics Club Continuous 2 servo locomotion Is there a way to command the servo to completely stop?

PROFCW
PROFCW over 2 years ago

We are building an IR Arduino uno controlled (from NEC remote)  mobile robot with two servos.  Now we used the usual servo library and it worked well until we tried to stop the servo. The servo will drift ever so slightly, because the servo is updated about every 20 milliseconds, therefore it drifts and the robot at stop continues to move.  Is there a way to command the servo to completely stop?  I thought of a cutoff power rellay but maybe there's a better way

  • Sign in to reply
  • Cancel

Top Replies

  • shabaz
    shabaz over 2 years ago +3
    Both ways are good. If you kill the PWM signal (e.g. reconfigure the pin to be an input or set the PWM to an invalid value) then a decent (or semi-decent, or even some very low-end! but not always) hobby…
  • dougw
    dougw over 2 years ago +1
    Servo hunting or drift may be due to several things like load, servo position, coupling stiffness, local vibration, power fluctuations, etc. Hobby servos typically don't have adjustable loop gain or integral…
  • strb
    strb over 2 years ago +1
    Based on your description I understand that after setting the value that should means "no servo rotation" you continue getting a slight rotation, right? If so, you could try to find by trial and error…
  • dougw
    dougw over 2 years ago

    Servo hunting or drift may be due to several things like load, servo position, coupling stiffness, local vibration, power fluctuations, etc. Hobby servos typically don't have adjustable loop gain or integral and derivative feedback control so other solutions are needed. Power removal, like you suggest, is one method that would work if the load doesn't cause movement. You could also try just stopping the PWM signal to the servo. Another method is to add a large capacitor to the servo motor power supply right at the servo motor. This reduces power supply fluctuations due to servo activity.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • strb
    strb over 2 years ago

    Based on your description I understand that after setting the value that should means "no servo rotation" you continue getting a slight rotation, right?
    If so, you could try to find by trial and error the exact value each servo requires to completely stop and use those or as alternative (but I never tried this myself) you could try to use the "detach()" function on both of your servo object to shut off completely your signal.
    To restart movement you will need to "attach()" back your servo object to arduino pins before commanding any movement.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • robogary
    robogary over 2 years ago

    Tough one. Usually a futaba continuous servo has a teeny tiny zero adjust pot , that's the most obvious thing to try to make it perfect. It still may drift depending on temperature or just in jostling it around.

    Fyi - Zero speed is 1.5 ms pulse width every 20 ms. I'm not sure how the servo library handles multiple servos, could be arduino pwm accuracy, but also could be the servo itself drifting and offset. A mosfet could be put upstream to cut all servo power. I'm not sure what happens if pulse width goes to zero. 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • shabaz
    shabaz over 2 years ago

    Both ways are good. If you kill the PWM signal (e.g. reconfigure the pin to be an input or set the PWM to an invalid value) then a decent (or semi-decent, or even some very low-end! but not always) hobby servo will automatically stop movement as Doug says. It's a common situation, e.g. see here: https://forum.arduino.cc/t/turning-off-pwm-signal-to-servos/659723

    The other way, cutting off power, is also useful sometimes, simply because your power consumption goes to zero. For a robot running on batteries, that's very convenient if the robot will be at a standstill for long periods. If it were me, I'd be adding a MOSFET to control the power, and then that way I have two choices in the code. It consumes a GPIO signal to control the power, but that's usually of little consequence unless you're really cost-cutting and are using a small microcontroller or are unwilling to use an I/O expander for instance.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Cancel
  • PROFCW
    PROFCW over 2 years ago in reply to shabaz

    Thank you all for your help.  This closes this post.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube