Greetings! We have figured out the concept PWM and tried to connect our servo to Arduino, so in theory we will not dwell.
Connecting to Raspberry Pi
From the servo cable goes from three wires:
Red – Power – connected to a contact 5V (pin 2) or directly to the power supply;
brown or black – ground GND (pin 6 Raspberry Pi);
yellow or white – signal; Connect to pin 7.
Specifications of our servo
Model: TowerPro SG90
Operating Voltage: 4.8 DC
Speed: 60 degrees on 0.1 s
Torque: 1.6 kg cm
Weight: 9 g
The range of pulse width: 0.5 ms – 2.5 ms
This servo can not rotate 360 degrees. It has a neutral position (Neutral) and limits of zero and 180 degrees. To install the servo in the neutral position, you must submit a high signal duration of 1.5 ms at 0 degrees – 0.5 ms to 180 degrees – 2.5 ms.
Consider the following program:
import RPi.GPIO as GPIO
p = GPIO.PWM(7,50)
In this program we set seventh pin for pulse-width modulation frequency of 50 Hertz:
It was very useful video