Quote from Gert van Loo on December 19, 2011, 12:45
Beware that controlling a real servo requires you to generate a 50Hz square wave with variable duty cycle. It is not a simple GPIO on/off circuit.
(It may be easier to add the PIC and let that generate your square waves)
The length of each pulse controls the position of the servo. It doesn't matter much how often the pulse is repeated.10Hz will work, so will 300Hz.
It is rude, crude, and socially unacceptable, to write a device driver which disables interrupts, pulls a GPIO pin high, busy waits for 1000 to 2000 microseconds as set by the desired servo position, pulls the GPIO pin low, schedules itself to be called 10 to 300ms later, then enables interrupts. Such a device driver would interfere with other timing sensitive applications running on the system. In particular, audio would probably sound horrible. However, the servo would work.
Hobby servos need 4 to 7 volts for power. Depending on the motor in the servo, and the usage, they can draw hundreds of milliamps to several amps of power. They need a robust power supply. They should not feed off of the R-Pi's wimpy USB powersupply, unless a suitably wimpy servo has been chosen.
The control line of the servo is a digital input, that is 3.3volt tolerant, and requires virtually no drive current. It can be directly connected to a GPIO pin on the R-Pi, with one provision. The grounds for the R-Pi and the servo must always be connected. Bad things will happen, if the servo has a power supply which is floating relative to the R-Pi.