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 Servo Movement At Power Up Before Initialization
  • 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
  • State Not Answered
  • Replies 15 replies
  • Subscribers 384 subscribers
  • Views 2511 views
  • Users 0 members are here
  • servo
  • arduino
Related

Servo Movement At Power Up Before Initialization

colporteur
colporteur over 1 year ago

I am experiencing a problem with the servos operations on this project that members helped me develop.

When the Mega is powered on the servo track to a position before going to the initialized position. The power on position for the servo is outside the range of motion for the animation. The movement has over extended some mechanical connections and caused breakage.

I went in search of a solution and found this post. It doesn't solve the problem but the discussion is an example of what I am experiencing. One of the suggestions is to relay control power. Only apply power to the servo after full initialization thereby avoiding the issue.

I'm curious if anyone has experienced a servo movement issue on power up and how they may have solved it.

  • Sign in to reply
  • Cancel

Top Replies

  • shabaz
    shabaz over 1 year ago +3
    Hi Sean, The power on position is really the position with no PWM applied. I can think of four potential solutions. (a) Ideally there would be a mechanical solution (i.e. as Frank mentions, to try…
  • colporteur
    colporteur over 1 year ago in reply to beacon_dave +3
    I successfully adjusted the physical connection on one servo today after determining "horn initialization position" I was fortunate since the horn works from 90 to 0. 90 being the start and the initialization…
  • genebren
    genebren over 1 year ago in reply to colporteur +3
    Hi Sean, I build a series of DMX driven decoders that come in 6 and 12 servo channels. These boards have a switchable power bus that provides up to 10 Amps of servo power. On power up, the servo power…
  • fmilburn
    0 fmilburn over 1 year ago

    There is a post on the Arduino forum that may be useful: https://forum.arduino.cc/t/servo-motor-default-position/655932

    If I understand the problem though, can you just rotate the server horn such that the power on position is near the center of your acceptable range of motion?

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • shabaz
    0 shabaz over 1 year ago

    Hi Sean,

    The power on position is really the position with no PWM applied. I can think of four potential solutions.

    (a) Ideally there would be a mechanical solution (i.e. as Frank mentions, to try to have that 'no PWM' position to be a valid position within the desired range of motion). If that's not currently feasible (e.g. the mechanical work is complete and a software or electronic solution is needed) then the following two options could be worth considering:

    (b)initialize the PWM as early as possible within the Arduino code, to any value within the valid range. By doing it as soon as possible, there's less time for the servo to jump to the invalid position. However, there's a good chance it might be impossible to make this option (b) work, because of the time that the Arduino may take resetting and then running the user code.

    (c) have power control over the servos electronically, so that you can switch off the servo power, apply the PWM, and then switch on the servo power. An easy way to do that is to have a single relay, controlled by the Arduino, and have it wired to power all the servos when the relay is energized. The relay would be programmed in the Arduino to be energized after the PWM is initialized and within valid ranges. The relay could be replaced with a MOSFET if desired.

    A slightly luxury variation of (c) is to have a separate MOSFET per servo, i.e. ability to power off/on each servo separately. There are use-cases for that, but you may not need that level of servo power control granularity for the situation that you mention, and besides, it is a lot of circuitry to now retrofit into the project. But for future designs, that could be worth considering.

    (d) A manual version of (c) could be to simply have a switch to the servo power, so that you can apply it after the Arduino is running. But if the user forgets to toggle it off afterwards, then things will break when everything is next powered up. Perhaps it is solvable using warning messages on the power switches, with the power-on procedure labelled. Better yet, you could even use a rotary switch with three positions. The first position being all off. The next position powers on the Arduino, and the third position also powers on the servos. That way, the user has no choice but to power it up or down in the correct sequence. That would solve things with no code modifications, and no electronic modifications beyond obtaining a three-position switch with at least two gangs. (You'd still need a label on the mains plug to inform the user to ensure the switch is in the fully off position before plugging in).

    image

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • colporteur
    0 colporteur over 1 year ago in reply to shabaz

    I am working on a combination of your suggestions.

    My first attempt is (a). I wish I had known of the issue before assembly, it would have been easier to implement.

    I'm looking at (c) all in with servos. I have a server power bus that is easily switched. 

    It is two days away from a train show to discover the issue. I  didn't recognzie the issue during prototyping. The layout is finished and I am just getting to install everything in its final resting place to discover AH CRAP!

    I am at the site this afternoon to start working the problem.

    Really appreciate the insight. It is my problem but reaching out makes me feel like I am not alone to solve.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • beacon_dave
    0 beacon_dave over 1 year ago in reply to colporteur

    Could you use a weak spring link between the servo and the animals so that the spring gives outside of limits.

    Alternatively modify the linkage in such a way that the home position moves to within the allowable limits of movement.  

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • colporteur
    0 colporteur over 1 year ago in reply to beacon_dave

    I successfully adjusted the physical connection on one servo today after determining "horn initialization position" I was fortunate since the horn works from 90 to 0. 90 being the start and the initialization position worked out great. I have started another post within this post looking at some discovery. I don't want to confuse the issue. 

    I do like the spring idea. Going to investigate that.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • colporteur
    0 colporteur over 1 year ago

    My environment has me working with multiple servos and multiple arduino's mainly Nano and Mega. I'm not confident I have all the knowledge regarding what I am calling "Power on servo initialization position". The scenario is a servo connected to an Arduino moves to a specific position when power is applied and then moves to the coded position when under control.

    I have worked with a number of SG90, SG92 &  MG90S Micro Servo motors over the years and I have had anomalies happen that I couldn't explain. At first I thought it was something I imagined since I couldn't duplicate it. The more I work with the servos the more I can't ignore the anomalies. I would like to find out why.

    How is the power on initialization positions determined?

    What causes a servo initialization position to change?

    Will the power on initialization positions change if I change the Arduino?

    I've installed servo and had them working to having them not align later. I realign the mechanics, then to have them move again sometime back to their original position. I've immediately switched the servo thinking it is at fault. The same scenario has happened with different servos. It is frustrating to say the least.

    I'm going to grab a few servo's and a few different arduinos and run some tests to gather some data in the hope of developing a better understanding. If anyone has any insight to share, I welcome the contribution.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • shabaz
    0 shabaz over 1 year ago in reply to colporteur

    Hi Sean,

    These servos are cheap devices, they might not accurately move to a specific position at power-up, there could well be a slight difference each time, depending on where it starts from the last power-off position. They rely on analog feedback and there's quite a lot of hysteresis, so that will cause the differences.

    The simplest way to ensure a proper start position, is to not apply power to the servo, until the control signal is up and running and set to a specific desired value, and then power up the servo (e.g. using a relay or MOSFET). 

    It's unfortunately going to be unresolvable trying to characterize the initial position very well if the control signal is not set up first, before turning on the servo power, because these problems are inherent in cheap servos. Probably high-end servos can be configured with start positions when there is no control signal, but they will easily cost 10-20 times as much or more, and may require special hardware to configure them.

    Also, worth noting, with the cheap servos, if you try to set a position (with the control signal) that the servo cannot reach due to physically stopping the shaft from turning (for instance, a limit in the mechanism attached to the servo) then the servo will smoke and be destroyed. Again this is another limitation that can't easily be resolved satisfactorily beyond either coding so that the shaft doesn't try to rotate beyond that limit, or by including some sort of fuse (e.g. polyfuse).

    Hobby servos are pretty awful all-round, they really stink, but are popular because they are cheap and easy to control if precision is not required and if the types of limitations mentioned above are considered acceptable or can be worked around.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • genebren
    0 genebren over 1 year ago in reply to colporteur

    Hi Sean,

    I build a series of DMX driven decoders that come in 6 and 12 servo channels.  These boards have a switchable power bus that provides up to 10 Amps of servo power.  On power up, the servo power is off until the servo pulses are started.  In addition, the boards use EEPROM memory to store multiple parameters for each of the servos, like Min, Max and Default values to provide a sane range for each servo and to have then start at default value.  On startup the current position variable (RAM) is set to the default value, which can be updated with incoming commands to change this position.

    A neat thing about the switchable servo power is that you can also use this feature for servo position update timeouts, so that the boards do not always drive the servos.  Also, on my boards, I measure the current flow on the servo power bus and shut it off if the current exceeds a programmable level (this has saved my client big bucks as he uses expensive and powerful servos).

    Let me know if you need any more information.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • colporteur
    0 colporteur over 1 year ago in reply to shabaz

    It appears you are suggesting to find a power on initialization point for hobbyist servos is a Sisyphean task?

    I find it frustrating that these obstacles are not mentioned in servo projects. I'm lead to believe in maker posts just hook up the servo and it works. I guess the adage not all that glitter is gold has some relevance. 

    I am going to bench test the apply servo power after control signal is established to get some confidence before I implement.

    The animal farm (based on your code) is going to market this weekend, in a small model railroad show. I am unable to attend because of other commitments. I've asked for some video once the setup is in place to share. 

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • colporteur
    0 colporteur over 1 year ago in reply to genebren

    The project is small and doesn't have either the financial or physical commitment to take a commercial route. I take on maker projects and soon become disillusioned because they never include the fine print that identifies the pit falls a person is likely to encounter. 

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • 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