3D Printed Raspberry Pi Pan-Tilt Camera Brackets

in #raspberrypi8 years ago

Previously we looked at running servos on our Raspberry Pi. What can we do with that?

Well, how about controlling a camera?

With this "pan and tilt" set up, you can direct the lens left and right, and up and down :)

Grab the STL files here at Thingiverse

Hooking Up

Ground: Black/Brown
Power: Red/Orange
Signal: White/Yellow

I am using pins 17 and 27 on the Pi for signal

2018-04-13 12.01.21.jpg

Code

Same deal as before

Run sudo pigpiod then the following Python:

from time import sleep
import pigpio

pi = pigpio.pi()

while True:

    pi.set_servo_pulsewidth(17, 0)    # off
    pi.set_servo_pulsewidth(27, 0)    # off
    sleep(1)
    pi.set_servo_pulsewidth(17, 1400) # start
    pi.set_servo_pulsewidth(27, 1400) # 
    sleep(1)
    pi.set_servo_pulsewidth(17, 1500) # middle 
    pi.set_servo_pulsewidth(27, 1500) # 
    sleep(1)
    pi.set_servo_pulsewidth(17, 1600) # end
    pi.set_servo_pulsewidth(27, 1600) # 
    sleep(1)

Coin Marketplace

STEEM 0.04
TRX 0.33
JST 0.097
BTC 63953.04
ETH 1857.95
USDT 1.00
SBD 0.38