Servo Controlled Time-Lapse Camera

For our HAB mission, we created a servo controlled camera running on a RasPi Zero and using β˜’CHIPs to control/drive a servo.

IntermediateFull instructions provided2 hours3,604
Servo Controlled Time-Lapse Camera

Things used in this project

Hardware components

Raspberry Pi Zero
Raspberry Pi Zero
Get the newer version that has a camera interface. And make sure you got a Micro-USB cable to connect the Pi to your computer
XinaBox BR03
XinaBox OC05 - Servo Driver
XinaBox XC10
XinaBox MD01
Really just a spacer to mount the servo on, so very optional.
Camera Module
Raspberry Pi Camera Module
Remember to get the narrower flat cable that fits the RasPi Zero
3.7v LiPo battery (generic)
Servos (Tower Pro MG996R)
Any small servo with standard 2.54 mm 3 pin header cable, and mounting gear (nuts/bolts, rubber bands, cable ties, glue, or what ever is your preference)

Software apps and online services

Raspberry Pi Raspbian Lite
balena Etcher
XinaBox OC05 Servo Driver


Read more


from __future__ import division
import time
from datetime import datetime 
import rpOC05
import picamera

pwm = rpOC05.PCA9685()

servo_min = 150  # Min pulse length out of 4096
servo_max = 500  # Max pulse length out of 4096
i = servo_max + 10
chan = 8
filename = 'frames/frame-%s.jpg'
# signal ready with a wave
pwm.set_pwm(chan, 0, servo_min)
pwm.set_pwm(chan, 0, servo_max)

print('Time-Lapse Running...')
while True:
  if i > servo_max:
    i = servo_min      
  pwm.set_pwm(chan, 0, i)
  with picamera.PiCamera(resolution=(1920,1080)) as cam:
    ts = str(datetime.utcnow())
    cam.capture(filename % ts,quality=90,thumbnail=None)
  # time-lapse interval in seconds.
  i += 1