Pages: [1]   Go Down
Author Topic: Servo jumps when arduino is powered up  (Read 800 times)
0 Members and 1 Guest are viewing this topic.
Los Angeles
Offline Offline
Full Member
***
Karma: 1
Posts: 148
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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...


Code:
#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
{
}
« Last Edit: January 16, 2013, 03:12:07 pm by fxmech » Logged

Los Angeles
Offline Offline
Full Member
***
Karma: 1
Posts: 148
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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....
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17301
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...


Code:
#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
« Last Edit: January 16, 2013, 03:06:57 pm by retrolefty » Logged

Los Angeles
Offline Offline
Full Member
***
Karma: 1
Posts: 148
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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....
Logged

Offline Offline
Full Member
***
Karma: 5
Posts: 113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
Logged

For whom does the clock pulse? It pulses for you!

South Texas
Offline Offline
Edison Member
*
Karma: 8
Posts: 1025
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Los Angeles
Offline Offline
Full Member
***
Karma: 1
Posts: 148
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Tesla Member
***
Karma: 145
Posts: 9675
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Pages: [1]   Go Up
Jump to: