Under power a servo at startup to partially solve servo jump/twitch problem

I have read many threads already about this servo jump/twitch issue and tried every possible solution to prevent my particular servo from jumping (roughly 20 degrees) when power is first applied to it. None of the suggested solutions work on this servo (it's a DS04-NFC 360 degrees servo; my Arduino is a Pro Mini 5V).

In the end, the only (partial) solution I have found is to delay connection of full 5V 1000mA power to the servo until AFTER the jump movement. If I do this, the servo will be powered only from the Pro Mini VCC pin during this "annoying jump phase". After the jump phase, I will then apply full power (5V 1000mA) to the servo (I am assuming I can do this with some sort of relay thingy...still need to learn more about this though). This method does not prevent the annoying jump from happening, BUT it does have some benefits...

Since the amps from this VCC pin are well below the full amps needed for the servo (the servo needs roughly 5V 1000mA, but the Pro Mini VCC pin only gives out 150mA), the servo will jump a bit slower and most importantly, have much less torque. This way it is much less frightening/shocking for the unknowing user, plus it will not grind the servo gears if the servo happens to be positioned at one of the mechanical stops of my mechanism.

So, here's my question: Will doing this harm the Pro Mini? In other words, will it harm the Pro Mini to attempt to power a servo that wants 1000mA via the Pro Mini's underpowered VCC? This will only happen for about 10 seconds when the unit is initially powered on.

Thanks!

Now that I think about it, maybe it would make more sense to use some sort of relay that only supplies the servo with 150mA for the first ten seconds, and then ups the amps to 1000mA after that? That way I avoid all the risk of powering the servo via the Pro Mini VCC pin for the first ten seconds.

Question: Not knowing much about electronics, does such a "bi-modal relay" exist? How would I signal to the relay that 10 seconds has elapsed and now it should provide 1000mA?

Maybe I am totally off on this idea. If so, please correct me...gently :wink:

You should not be drawing power for a servo from an Arduino. Give the servo a separate power supply with a common GND with the Arduino. If you want the Arduino to control the power to the servo you could use a transistor as a switch in the servo power line. The Arduino can control the transistor.

You have not said exactly what problem you are trying to solve. Post your program and tell us exactly what the servo does when the Arduino starts.

...R

The Arduino has no way of knowing the servo's position when it starts, by default it sets it in the middle (90 degrees), but you can change that. If you KNOW the servo's position is going to be 20 degrees, then in setup():

void setup(){
 servo.write(20);
 servo.attach(9); // or whichever pin you're using
}

To explain more clearly, the original setup was:

The servo is a 360 continuous servo (DS04-NFC) with current draw of "less than 1000mA" operating at 5V.

Arduino Pro Mini

AC DC wall adaptor, 5V 1000mA, wired into a bread board (+/- rows) with servo +/- also connected to those rows
(i.e. receiving power from wall adaptor) and the Pro Mini raw and ground also connected to those rows on the breadboard. Pro Mini VCC is powering a HM-10 bluetooth module.

The problem: The first time that power is supplied to the servo, it moves at full speed 20 degrees (roughly) counterclockwise. This is a big negative because:
-it will possibly shut a sliding door on user's fingers,
-or grind the servo gears if the door/servo happens to hit a physical stop during that sudden movement,
-or just generally scare the user by moving so suddenly.

I have tried every solution mention in various threads such as servo.write(90) [which means "don't move at all" in 360 degree servo language], servo.detach then later servo.attach, attach only the info pin of the servo then later attach power, etc. etc.

In every situation I have tried, the servo jumps 20 degrees at full speed when power is first supplied. No exceptions. It does this when the Pro Mini has a blank sketch, or a regular sketch with servo objects, or any other sketch.

Here's a simple sketch I have been working with, but as you can see from the comments, none of these lines has any effect in stopping the sudden jump of the servo.

#include <SoftwareSerial.h>
#include <Servo2.h> // Include the Servo2 library (non standard library since regular servo library conflicted with software serial causing twitching when HM-10 data was sent over serial)

SoftwareSerial HM10(2, 3); //HM10(Receive Pin, Transmit Pin) -This assumes that the BLE RX to pin 3 and TX to pin 2. Any digital pins may be used. Basically, HM10 RX pin gets attached to Arduino TX pin.

// Variables and objects for servo motor
int servoPin = 10; // Declare the Servo pin; Putting this line here or taking it out has no effect on the jumping of the servo 
Servo Servo1; // Create a servo object; Putting this line here or taking it out has no effect on the jumping of the servo 

void setup()
{
  Serial.begin(57600);  // Begin the Serial Monitor connection at 57600bps
  Servo1.attach(servoPin); //attaches the servo to the variable servoPin; Putting this line here or taking it out has no effect on the jumping of the servo
  Servo1.write(90); //tells the servo to not move anywhere; Putting this line here or taking it out has no effect on the jumping of the servo
}

void loop()

{
  //Servo1.write(90); //tells the servo to not move anywhere; Putting this line here or taking it out has no effect on the jumping of the servo
}

Additionally, I should mention that simply connecting power to the servo with no connection whatsoever to the Pro Mini has no beneficial effect, i.e. the servo still jumps 20 degrees one time. Disconnect power and then reconnect, the servo jumps again.

In fiddling around, I discovered that connecting the Pro Mini to USB serial (which supplies 5V power to the Pro Mini) but NOT connecting the wall adaptor results in the servo still jumping 20 degrees (servo is getting power from the raw pin of the Pro Mini in this situation). But the good news is that this 20 degree jump is much milder since the amps coming through the raw pin are much lower than 1000mA. By "milder", I mean the jump is slower than full speed and has much less torque, so it does not grind the gears if the servo has reached a physical stop. This is a big improvement even though the servo is still making the annoying jump.

My.Idea1: Attach the Pro Mini to wall adaptor first, but don't attach the servo to the wall adaptor. In this situation, the servo will not get power from the wall adaptor but instead will only get low amp power from the raw pin of the Pro Mini. After the mild jump is complete, THEN attach the servo to wall adaptor power. I have simulated this with wires and it results in only the mild jump and no crazy jump later. (Not sure how to make this delayed connection between servo and wall adaptor, but I guess it will be a relay or transistor or something like that).

My.Idea2: Roughly the same BUT don't let servo pull power from Pro Mini for the mild jump (since this might damage the Pro Mini?). Instead, have a power connection from the wall adaptor to a transistor/relay (limiting the amps) to the servo, wait for the mild jump to complete, then increase the power to servo to regular levels. I'm even thinking that if the amps supplied to the servo during this initial period are really really low, there might be no jump, mild or wild, at all.

Your.Input?

:slight_smile:

@Zimbu Post a diagram showing your wiring connections. It is much too easy to misunderstand verbal descriptions.

Additionally, I should mention that simply connecting power to the servo with no connection whatsoever to the Pro Mini has no beneficial effect, i.e. the servo still jumps 20 degrees one time. Disconnect power and then reconnect, the servo jumps again.

I have some servos that do that - though I don't think it is as much as 20 degrees and it is always in the same direction so that, with several re-connections it will eventually get to the physical end stop. Maybe the larger jump in your case is because it is a continuous rotation servo. I had an online chat with HobbyKing about the problem and the guy said that the digital servos don't do that - and sure enough the one digital servo that I have does not move at startup.

From what I can see (for my own servos) there is no means to prevent the initial movement.

By the way I have some other older non-digital servos that do not move at startup, and some that did move at startup but I was able to stop that by putting a 4k7 resistor between the servo signal and GND.

I repeat - do NOT power the servo from the Arduino. An operating current of up to 1 amp is far too much for an Arduino and the servo is likely to draw a lot more than that very briefly when a movement starts.

...R

Here's a diagram of my breadboard hookup base case. First time Fritzer, so...sorry!

Robin2:
I repeat - do NOT power the servo from the Arduino. An operating current of up to 1 amp is far too much for an Arduino and the servo is likely to draw a lot more than that very briefly when a movement starts.

OK, that answers my question (confirms my doubt!) about this idea. Thanks.

Robin2:
By the way I have some other older non-digital servos that do not move at startup, and some that did move at startup but I was able to stop that by putting a 4k7 resistor between the servo signal and GND.

OK, I will give this a try. I doubt it will do anything, but this might be the one time in my entire life that I have been wrong. :wink:

I think I will also work on My.Idea2. I have a feeling that supplying the servo with very low amps will make the jump very mild or even unnoticeable. Plus the torque will be really low, so that should prevent the servo from stripping it's poor little plastic gears if it tries to jump when it is at a physical stop.

You mentioned something about transistors early so I will do some learning and see if I can make it do what I want.

Thanks!

Try installing 2 resistors like this, that will hold the feedback signal level near +Ve / 2 (90 degrees) until an external signal is applied.
Hope the drawing is legible.
out15.png

edgemoron:
Try installing 2 resistors like this, that will hold the feedback signal level near +Ve / 2 (90 degrees) until an external signal is applied.
Hope the drawing is legible.
out15.png

I'm not certain. but I think that is a bad idea. The servo position is not controlled by voltage. It is controlled by the width of a repeating square-wave pulse.

...R

Robin2:
The servo position is .... is controlled by the width of a repeating square-wave pulse.

But OP said this in #4:

Zimbu:
The servo is a 360 continuous servo (DS04-NFC)

I found this whole thread about a continuous servo moving some number of degrees to be very bamboozling, since it's the speed of a continuous servo that's controlled, not its position.

kenwood120s:
But OP said this in #4:

You are quite right to remind us. But the control input for a continuous rotation servo is exactly the same as for a regular servo. You can easily convert a regular servo to continuous rotation.

...R

kenwood120s:
But OP said this in #4:

I found this whole thread about a continuous servo moving some number of degrees to be very bamboozling, since it's the speed of a continuous servo that's controlled, not its position.

Yeah, I understand what you are saying, Kenwood120s. My comment that the servo is jumping "20 degrees" may be misleading.

Firstly, I can't say for sure that it is 20 degrees; that's just my rough visual estimate. And as you pointed out, it very likely is not a precise figure since these continuous servos don't work in terms of precise degrees of movement. (By definition, they can only be controlled in terms of speed of rotation and direction of rotation, not degree of rotation).

What I guess is happening is that the servo is getting a burst of power for X milliseconds. Since the controller chip inside the servo is not yet "awake" and functioning, this power is causing the servo to turn counterclockwise at full speed for X milliseconds. And based on the speed of the servo over X milliseconds, this is resulting is a roughly 20 degree turn. (The spec for this servo says its speed is "0.22sec/60° at 4.8V", so I think that means the servo motor is out of control for 0.07333 seconds resulting in roughly 20 degrees of movement). After X milliseconds, the controller chip has finally woken up and told the servo "Whoa, chill out! We haven't received any instructions to move yet!"

This also explains why any instructions or signals to the Arduino servo pin are useless; the servo controller chip on the other end of the pin wire is not listening, i.e. it's still asleep. (Sorry for all the fancy high tech jargon in my posts ;D ).

So My.Idea2 is to give the servo some limited power for X milliseconds...enough to wake up the controller chip but not enough to move the servo motor, or at least not enough to move the servo motor full speed and full torque. After X milliseconds, I then would supply full 5V 1000mA power to the "now under control" servo. The trick will be to figure out how to switch from low power to full power without cutting off the power even for a millisecond...otherwise, the same behavior will reoccur. I'm going to do some experiments today with transistors and resistors to see if I can make it work.

Side note: I pulled apart my first servo that I used last week and confirmed that the gears had been stripped when the servo made a sudden jump and hit the physical stop of my mechanism. So it really is vital that I solve this issue...or perhaps I might purchase a servo factory to replace all the stripped gear servos I will create.

Zimbu:
Side note: I pulled apart my first servo that I used last week and confirmed that the gears had been stripped when the servo made a sudden jump and hit the physical stop of my mechanism. So it really is vital that I solve this issue...or perhaps I might purchase a servo factory to replace all the stripped gear servos I will create.

Now I'm confused.

In Reply #4 you said "The servo is a 360 continuous servo"

Continuous servos don't have physical stops.

...R

Robin2:
Now I'm confused.

In Reply #4 you said "The servo is a 360 continuous servo"

Continuous servos don't have physical stops.

...R

The physical stop of the mechanism to which the servo is attached.

The physical stop in this case is actually a microswitch that, when activated, sends a signal via Arduino to the servo to stop moving (in continuous servo language, this is "Servo1.write(90)").

But in the case of the servo being positioned 5 degrees away from the switch (for example), when the initial power hits the servo and it wants to move rapidly 20 degrees, the switch is either not fast enough to stop the servo, or the Arduino is not awake enough to send the signal (since the Arduino has also just been powered up). If that happens, the servo plastic gears get stripped. (After opening up one thusly stripped servo today, I confirmed that it has a missing tooth on two gears).

By the way, I am working on your 4.7k resistor suggestion at this exact moment, so I will see if that works before getting into transistors, etc.

Zimbu:
By the way, I am working on your 4.7k resistor suggestion at this exact moment, so I will see if that works before getting into transistors, etc.

Nope. Doesn't solve the problem. Didn't hurt much to try though!

Zimbu:
The physical stop of the mechanism to which the servo is attached.

The physical stop in this case is actually a microswitch that,

A better mechanical design would allow the mechanism to move past the limit switch without causing damage.

Alternatively the limit switch should just cut off the power to the motor (independently of the Arduino) so there is no possibility of it causing damage.

...R

Robin2:
A better mechanical design would allow the mechanism to move past the limit switch without causing damage.

That would not achieve the goal of the limit though. The mechanism is a sliding door. It has physical stops at full open and full closed. It couldn't be any more fully open than full open...and it couldn't be more fully closed than full closed.

Robin2:
Alternatively the limit switch should just cut off the power to the motor (independently of the Arduino) so there is no possibility of it causing damage.

...R

Yes, that would prevent damage, but it would also shut down the entire thing.

Remember, this is something that happens when power is first applied. One or both of these two "bads" occur:

  1. The servo jumps suddenly one time. That's bad.
  2. If, by bad luck, the servo is positioned close to the physical stop, it will suddenly jump (that's bad) AND it will grind/strip the gears of the servo after it hits the stop but keeps powering along for X milliseconds.

Sure, I could shut the entire operation down with a "kill power to servo" limit switch to prevent #2, but then everything would cease to function, i.e. the servo would never move again until it was manually moved away from the limit switch. That's just not acceptable for this project.

My goal is either to:

G1: eliminate the sudden startup jump...but I think this is impossible with this servo.
G2: Minimize the two "bads" related to the sudden jump, i.e. lower the speed of the sudden jump and also reduce the torque that that even it it hits a stop, it will not grind/strip the gears of the servo.

Did you try this?

This servo carries meso-position adjustment potentiometer(it can only be seen by peeling off the outer cover and circuit board). We can set high level pulse at 1.5ms to observe that whether servo stops rotating. If it doesn’t stop rotating, we keep adjusting the potentiometer until it does.

edgemoron:
Did you try this?

Good idea but no dice. What that refers to is whether the servo stops when it is given the "Servo1.write(90);" (which means STOP in 360 servo language). If it doesn't stop, then you adjust the little screw until it does.

In my case, I have no problem getting it to stop with "Servo1.write(90);".

Got some new servos coming tomorrow afternoon and will fiddle around with them to see if any of them do not jump when initially powered up.

Alternatively, I could even accept (now that my resolve is weakening...) if they jumped but stayed in the middle range of motion, i.e. did not ever hit the physical stop and strip the gears.

One of the new servos is even a metal gear servo, so I am wondering if that one will NOT strip gears even if it hits a stop at full speed.

I will report back when I have more info.