Finding information about how to control a servo through Arduino boards is pretty easy. There are many resources on the web on this regard. However, I find that proper emphasis about how important it is supplying the correct amount of power for the servo to work properly can’t be found very often.
Servos draw a considerable amount of power, so chances are that you need to supply power from an external power source.
I’ve been making some experiments with a non-high-quality servo that was working weird or not working at all sometimes. If I sent to it the instruction for turning more than 15 degrees (no matter what direction), the servo apparently went totally crazy, even my Arduino started to behave strange.
The thing is that, as stated above, motors in general (a particular form of inductive loads) draw considerable amounts of power. If we wire a servo motor directly to an Arduino board, the amount of current available for the servo will be quite limited (about 400 mA or less), not enough for most applications.
My advice is to always power servo motors controlled by Arduino with an external power supply.
Remember to connect ground lead of external power supply to Arduino ground pin
Regards!