Prohibit Servo twitching at Poweron [solved]

For my current project I'm going to use two MG995 Tower Pro heavy duty Servos for pan/tilt movement of a platform. The problem I stumbled upon is that the servos "twitch" a bit (about 20°) when I power on the whole circuit. How can I get rid of it?

I noticed that it only happens when I switch on the Arduino and the Servo at once or the Servo before the Arduino. When I let the Arduino start up first untl it sends out a constant control signal and then give the servos power, it works fine. Should I use some power MOSFET or relais to switch on the power of the servos after initializing the Arduino?
Any Ideas?

Marv

Show us a sketch and schematic,

Same as “knob“ example of the servo lib. Arduino powered by usb 5v, Servo at 7v (two different power supplies), Gnd connected. Later the thing will be powered by a 7.2v battery pack and a single chip atmega regulated at 3.3v. This is rather a general problem (i tried both servos and different example code, all same result)

So you are doing this on pin 9?

You could have the Arduino turn on the Servo Power through a relay after the Arduino code is runing.

Yeah, that's what I used. Doesn't seem to matter though which pin I use. It also gets better when I use an atmega without the bootloader, since the delay is less. But the twich is still there.
As a relay, will the A5X-5SE work? I don't want the circuit being too heavy.

Is it that your rest position is not the default (90 "degrees") of the servo library?
If so, you can write the servo position before performing the "attach"

I don't think this is related to the problem, the twitching happens always, no matter which position the servo is, even at maximum. Writing to the servo before attach(), how is that possible? How would the arduino know where the servo is hooked up?

Writing to the servo before attach(), how is that possible?

It is possible because the library permits it - all you're doing is writing the initial, default position, which otherwise would be 90 "degrees"

The problem with that is, I don't know where the servos have to be initially. There has to be communication with some peripherals done first.
I don't think the twitching issue is caused by the Arduino, since it happens when the Arduino is unpowered. It seems that the servos get along with being powered and having no signal. Thats why I want to power the servos a few seconds after the Arduino and it's initialization when there is already a constant servo control signal.

I'm basically looking a for a way to switch on the power of the servos by the Arduino. I don't really want to use a relay since they cause other issues with analog readings and also weigh much. I'd rather use some MOSFET to do it.

Servo Voltage: 5-7.2 V (that's what needs to be switched)
Max Current: < 5 A
Arduino Voltage (standalone Atmega168): 3.3 V (that's what should switch it)

What type of Mosfet (N- or P-channel) should I use? Any other ideas?

Edit: solved!
A simple Pullup on the control line does the job.

The whole circuit is powered by 5-7.2 V DC through the DC plug. The following layout works fine for me (but there is still twitching):