Servo jumps when arduino is powered up

I have a small servo driving sketch using the servo library.
Its working fine but upon powerup the servo rotates a few degrees CCW.
Normally its not a big deal but I am using it to drive a fragile mech and its possible it could damage something if the servo jumps out of its assigned min/max limits.

Is there a way to eliminate this little jolt at powerup??? It happens before the sketch reaches the setup() function so I'm assuming its happening as part of the bootup routine and has nothing to do with my sketch...

#include <Servo.h> 

Servo mouthservo;  

const int mouthServoPin = 8;  
const int mouthUpLimit = 1550;
const int mouthDownLimit = 1450;
int mouthServoPos = mouthUpLimit;



void setup() 
{ 
  mouthservo.attach(mouthServoPin,mouthDownLimit,mouthUpLimit);
  mouthservo.writeMicroseconds(mouthUpLimit);  
  delay(15);
}

void loop
{
}

Just tried it with a completely blank sketch:

void Setup()
{
}
void loop()
{
}

the jump is still there at powerup... When the arduino gets power it sends a small spike out of the digital pins....

fxmech:
I have a small servo driving sketch using the servo library.
Its working fine but upon powerup the servo rotates a few degrees CCW.
Normally its not a big deal but I am using it to drive a fragile mech and its possible it could damage something if the servo jumps out of its assigned min/max limits.

Is there a way to eliminate this little jolt at powerup??? It happens before the sketch reaches the setup() function so I'm assuming its happening as part of the bootup routine and has nothing to do with my sketch...

#include <Servo.h> 

Servo mouthservo;

const int mouthServoPin = 8;  
const int mouthUpLimit = 1550;
const int mouthDownLimit = 1450;
int mouthServoPos = mouthUpLimit;

void setup()
{
 mouthservo.attach(mouthServoPin,mouthDownLimit,mouthUpLimit);
 mouthservo.writeMicroseconds(mouthUpLimit);  
 delay(15);
}

void loop
{
}

All hobby type servos are subject to jumping or being twitchy when first powered up. They are not designed with any last valid position memory to survives a power off and on cycle. This was true even in their original intended application of radio control aircraft controls. Perhaps some of the newer 'digital' servos with proper servo programmer support have a failsafe position on power up mode?

Lefty

These are pretty high end servos, but you are correct.
I tried plugging it in with the signal wire disconnected and it jumped just the same.
The reason it not normally an issue is that servo cyclers and receivers seem to immediately correct the drift so before it finishes jumping its already getting a signal to go back to where it should be.
On the arduino there is a significant delay between powerup and when the sketch is executed so the servo finishes its jump completely so its about 4 times bigger than on a cycler...

Any solutions to this??? I am powering the servo directly off of the 5V out pin so if there was an internal solution it would be do add some kind of delay in the arduino code to delay the 5v out pin from connecting....if that's even physically possible....

Tricky!
Have you tried powering the servo after the main board?
I would suspect that it would have little effect since the setting time of the servo would be many times longer that the start-up time of the board, but may be worth a go.
It may also help to set the servo position on power-down and also initialise to the same position on power-up (maybe before applying servo power)

The jump is caused by the H-Bridge and feedback circuits inside the servo. When powered up the various stages may not power up at the same time and one side of the H-Bridge is enabled because of this. Servos will jump the same way every time and eventually would hit the end of travel if you kept cycling power. Its a "design feature". It doesn't affect them for their designed use so you might need to look into another method of moving your fragile device. Like a stepper motor.

Unfortunately that is not an option this time around...
I can however do something to cut the power to the servo until the arduino is booted up and sends a signal from another I/O pin...
That is something I am trying to avoid due to space and time limitations

Any solutions to this??? I am powering the servo directly off of the 5V out pin so if there was an internal solution it would be do add some kind of delay in the arduino code to delay the 5v out pin from connecting....if that's even physically possible....

You need to use a seperate power supply for the servo.