Servo motor default position.

If this has been answered before accept my apologies but I really did try searching.

When using different servo motors that all do the same thing. When I load the new program from the IDE the servo motor reacts by moving to some default position for that particular servo. Once the program is actually run it goes and moves as programmed.

I have spoken to other servo users and they have experienced the same situation.

Is there a way change that position either mechanically or programmatically?

If I get you correctly, you're experiencing that different servo brands respond differently to the same PWM signal?

Well, yes, they are after all, different servos. What I usually do is calibrate my servos. This means I record the PWM signals needed for a +90 and a -90 angle. Then I base all values in my program on these two. This way, if I were to switch do a different servo, I can change the calibration values and everything will work as intended.

When you call servo.attach(pin); the servo will, by default, move to 90. If you want it to go elsewhere, use servo.write(angle); BEFORE servo.attach(pin).

I'll assume that you are using the Servo library and not some other way of driving the servos.

The default position when you call servo.attach() is the equivalent of a write(90). If you want it to go to some other position just do an actual servo.write(yourposition) immediately BEFORE the servo.attach() in startup().

(johnwasser just beat me too it!)

Steve

garyb_ca:
If this has been answered before accept my apologies but I really did try searching.

When using different servo motors that all do the same thing. When I load the new program from the IDE the servo motor reacts by moving to some default position for that particular servo. Once the program is actually run it goes and moves as programmed.

I have spoken to other servo users and they have experienced the same situation.

Is there a way change that position either mechanically or programmatically?

The way I read this is, as power is first applied before the servo actually gets a position signal, so no, there is no way to change this.

If you power a servo independent from the Arduino, you will see that each time the power is applied the servo will creep. Disconnect and reapply and it will creep again, usually in the same direction.

Note that this is not a “default” position as you imply.

I love this thread, there are 3 different answers to 3 different issues from 3 interpretations of the question. I hope the right one is among them! ¯_(ツ)_/¯

Thank you Johnwasser. I added servo.write(angle); where you suggested and the problem disappeared.

But thanks to all that replied, I learned sometime from each reply even so I haven't seen some of this problems yet.