I am trying to get pan and tilt camera working with Raspberry Pi.

I have successfully gotten one servo to work following this tutorial:

I also found this tutorial showing pan and tilt, although it was a little confusing. Can anyone simplify it for me? I basically just need a good example of where all the wires need to go, etc.

Any help would be awesome, thanks!

I am using the Occidentalis Distro.

  • You didn't link to the pan and tilt tutorial nor did you mention what parts you are using. Dec 3, 2013 at 1:20

1 Answer 1


You can setup servos to use PWM-ish through the GPIO pins using the RPIO Module which will send a PWM pulse which works great with servos.

Setting up the Hardware

To set up the Servos in a Pan and Tilt situation, Put a bottom servo as Pan and attach the second servo sideways as tilt and attach it to the Servo arm on the Pan servo. You can add linkages if you want more tilt per servo degree etc.


You can setup a python script like so ( You may need to apt-get install RPIO ).

from RPIO import PWM

servo = PWM.Servo()
Pin = 17
Exit = False
while not Exit:
    In = raw_input("Enter Angle:")
    servo.set_servo(Pin, int(In) * 10)    # This will send a pulse
                                          # of 10 times your angle e.g.
                                          # In = 120, Out = 1200ms pulse

    if len(In) < 1:
        Exit = True                       # Exit if nothing entered.

# Cleanup servo Pin

which will loop through infinitely until you enter nothing. Each time setting the angle of one servo. Really simple to make 2 servos move. Just remember to Ground your Pins and to servo at least the recommended Voltage per servo.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.