Welcome to 9G Servo PTZ repository
For Raspberry Pi
Instructions for use of 180 degree servo --- Raspberry Pi
1.Raspberry Pi pin diagram

2. Hardware wiring
1.Connect the red wire (positive pole) of the servo to the 5V of the Raspberry Pi 2.Connect the brown wire (negative pole) of the servo to the GND of the Raspberry Pi 3.The yellow wire (signal wire) of the servo is connected to the physical pin of the Raspberry Pi motherboard (pin 33), BCM code (13)
Note: The GPIO of the Raspberry Pi is relatively fragile, and it is easy to burn the Raspberry Pi when driving high-current devices such as servos and motors. It is recommended that 5V and GND be powered by other 5V power supplies.
For other power supplies, please refer to the wiring below
1.Connect the red wire (positive pole) of the servo to the positive pole of the 5V battery 2.Connect the brown wire (negative pole) of the servo to the negative pole of the 5V battery 3.The yellow wire (signal wire) of the servo is connected to the physical pin of the Raspberry Pi motherboard (pin 33), BCM code (13) 4.Turn on the Raspberry Pi and connect any GND interface on the board to the negative terminal of the battery.
3.Upload and run the program
Upload the servo.py file in the folder to the root directory of the Raspberry Pi and enter the following command to run
python servo.py4.Phenomenon
After running the program. The servo will rotate from 0-45-90-135-180-135-90-45-0.